T O P I C R E V I E W |
cts18488 |
Posted - 07/11/2022 : 4:14:44 PM 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. |
5 L A T E S T R E P L I E S (Newest First) |
cts18488 |
Posted - 07/12/2022 : 09:28:49 AM 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. |
cpyang |
Posted - 07/11/2022 : 6:21:18 PM So it is related to one of those
set_float
but can you identify which one?
CP
|
cts18488 |
Posted - 07/11/2022 : 5:31:14 PM Also, I forgot to mention that I am using the same logic in another part of my script and it is working fine. |
cts18488 |
Posted - 07/11/2022 : 5:20:51 PM 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. |
cpyang |
Posted - 07/11/2022 : 4:27:24 PM Maybe need to insert a delay between graph creation, like add
op.wait('s', 0.5)
before the next op.new_graph
CP
|
|
|