The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Python
 "in method 'OriginObject_SetNumProp', error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cts18488

United Kingdom
83 Posts

Posted - 07/11/2022 :  4:14:44 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 2021b and Service Release (Select Help-->About Origin): SR2
Operating System: Windows 10 Ent

Hi,

I am trying to plot 16 heatmaps in a graph using a template. The first heatmap is plotted, however when the second heatmap is trying to be plotted I get the following error: in method 'OriginObject_SetNumProp', argument 3 of type 'double'.

I am using the following code:
def origin_shutdown_exception_hook(exctype, value, traceback):
'''Ensures Origin gets shut down if an uncaught exception'''
op.exit()
sys.__excepthook__(exctype, value, traceback)
if op and op.oext:
sys.excepthook = origin_shutdown_exception_hook

if op.oext:
op.set_show(True)

wks = op.new_sheet(type='m', lname='16MM') # for matrices
wks.name = 'M00'
wks.from_np(M00_new) # for matrices

x1,x2,y1,y2 = minx, maxx, miny, maxy

wks.xymap = x1,x2,y1,y2

mb = wks.get_book().add_sheet('M01')
mb.from_np(M01_new)
mb.xymap = x1,x2,y1,y2 (and similar for the remaining 14 heatmaps)

new_path_template = path_template.replace('/', '\\')
gr = op.new_graph(template=(new_path_template + '\\Origin templates\\MMP_plot_heatmap16.otpu'), lname='16MM_plot')

gl_1 = gr[0]
p1 = gl_1.add_mplot(wks, 0, type = 105)
gl_1.axis('y').title = f'Y in mm ({distance_y} \u03BCm steps)'
gl_1.axis('x').title = f'X in mm ({distance_x} \u03BCm steps)'
gl_1.lt_exec("SPECTRUM1.title$=M00;")
gl_1.rescale()
z = p1.zlevels
z['minors'] = 6
z['levels'] = [0, 0.25, 0.5, 0.75, 1]
p1.zlevels = z
gl_1.set_float('x.inc', distance_x_mm)
gl_1.set_float('x.firstTick', minx)
gl_1.set_float('y.inc', distance_y_mm)
gl_1.set_float('y.firstTick', miny)
gl_1.set_int('x.label.decPlaces', 2)
gl_1.set_int('y.label.decPlaces', 2)

gl_2 = gr[1]
p2 = gl_2.add_mplot(mb, 0, type = 105)
gl_2.set_ylim(min_y, max_y)
gl_2.set_xlim(min_x, max_x)
gl_2.lt_exec("SPECTRUM1.title$=M01;")
z = p2.zlevels
z['minors'] = 6
z['levels'] = [min_value_M01, min_value_M01/2, 0, max_value_M01/2, max_value_M01]
p2.zlevels = z
gl_2.axis('y').title = f'Y in mm ({distance_y} \u03BCm steps)'
gl_2.axis('x').title = f'X in mm ({distance_x} \u03BCm steps)'
gl_2.set_float('x.inc', distance_x_mm)
gl_2.set_float('x.firstTick', minx)
gl_2.set_float('y.inc', distance_y_mm)
gl_2.set_float('y.firstTick', miny)
gl_2.set_int('x.label.decPlaces', 2)
gl_2.set_int('y.label.decPlaces', 2) (and then similar for the remaining 14 heatmaps)

Can you please help me sort out the issue?

Thanks, Tibi.

cpyang

USA
1406 Posts

Posted - 07/11/2022 :  4:27:24 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Maybe need to insert a delay between graph creation, like add

op.wait('s', 0.5)

before the next op.new_graph


CP
Go to Top of Page

cts18488

United Kingdom
83 Posts

Posted - 07/11/2022 :  5:20:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I have noticed that the issue is because of these lines:
gl_1.set_float('x.inc', distance_x_mm)
gl_1.set_float('x.firstTick', minx)
gl_1.set_float('y.inc', distance_y_mm)
gl_1.set_float('y.firstTick', miny)
gl_1.set_int('x.label.decPlaces', 2)
gl_1.set_int('y.label.decPlaces', 2)

But I don't understand why would this be a problem. I do really need those lines as I need to put the axis ticks at the middle of the square and label them with the coordinates.
Go to Top of Page

cts18488

United Kingdom
83 Posts

Posted - 07/11/2022 :  5:31:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Also, I forgot to mention that I am using the same logic in another part of my script and it is working fine.
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 07/11/2022 :  6:21:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
So it is related to one of those

set_float

but can you identify which one?

CP
Go to Top of Page

cts18488

United Kingdom
83 Posts

Posted - 07/12/2022 :  09:28:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It seems that this in this line the issue was: gl_1.set_float('y.inc', distance_y_mm)

I have floated distance_y_mm and it works. Thanks for help.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000