Place Cursor on Graph with Script

ItalliaVP
Posts: 3
Joined: 2017-06-12
Location: United States

Hey all,

I am completely new to scripting and to Igor. I'm trying to analyze waves that I've generated from my data. These waves are very stereotyped in their X-axis rise and fall. I need to place cursors around the base of each peak so it can find the peak Y-value. I have a lot of waves to analyze, and was hoping I could automate the system by not having to manually drag the cursors for each generated wave. Is there a script code that will allow me to place Cursor A and Cursor B at designated X values? I tried typing "Cursor A (X value=0.2)" but it said the cursors first have to be placed on the graph, and I can't figure out how to do this with script.

Any suggestions appreciated!

Thanks,

Itallia V.P.


hegedus
Posts: 284
Joined: 2009-03-21
Location: United States

Hi,

Note to use tracename which maybe different than wave name.

Cursor [flags] cursorName traceName x_value

cursorName is one of ten cursors A through J.
Flags
/A=a a =1: Activates the cursor.
a =0: Deactivates the cursor.
Active cursors move with arrow keys or the cursor panel.
/C=(r,g,b,[a] ) Sets the cursor color (default is black). r, g and b specify the amount of red, green and blue in the color of the waves as an integer from 0 to 65535.
In Igor Pro 7.00 or later, optionally provide a to set transparency, with 0 being fully transparent (invisible) and 65535 being fully opaque (default).
/F Allows cursor to roam free. The trace or image provides the axis pair that defines x and y coordinates for the setting and readout. Use /P to set in relative coordinates, where 0,0 is the top left corner of the rectangle defined by the axes and 1,1 is the right bottom corner.
/H=h Specifies crosshairs on cursors.
h =0 Full crosshairs off.
h =1 Full crosshairs on.
h =2 Vertical hairline.
h =3 Horizontal hairline.
/I Place cursor on specified image.
/K Removes the named cursor from the top graph.
/L=lStyle Line style for crosshairs (full or small).
lStyle =0: Solid lines.
lStyle =1: Alternating color dash.

See the manual for the rest of flags and more details.

Andy


[ last edited December 1, 2017 - 18:53 ]
ItalliaVP
Posts: 3
Joined: 2017-06-12
Location: United States

hegedus wrote:
Hi,

Note to use tracename which maybe different than wave name.

Cursor [flags] cursorName traceName x_value

cursorName is one of ten cursors A through J.
Flags
/A=a a =1: Activates the cursor.
a =0: Deactivates the cursor.
Active cursors move with arrow keys or the cursor panel.
/C=(r,g,b,[a] ) Sets the cursor color (default is black). r, g and b specify the amount of red, green and blue in the color of the waves as an integer from 0 to 65535.
In Igor Pro 7.00 or later, optionally provide a to set transparency, with 0 being fully transparent (invisible) and 65535 being fully opaque (default).
/F Allows cursor to roam free. The trace or image provides the axis pair that defines x and y coordinates for the setting and readout. Use /P to set in relative coordinates, where 0,0 is the top left corner of the rectangle defined by the axes and 1,1 is the right bottom corner.
/H=h Specifies crosshairs on cursors.
h =0 Full crosshairs off.
h =1 Full crosshairs on.
h =2 Vertical hairline.
h =3 Horizontal hairline.
/I Place cursor on specified image.
/K Removes the named cursor from the top graph.
/L=lStyle Line style for crosshairs (full or small).
lStyle =0: Solid lines.
lStyle =1: Alternating color dash.

See the manual for the rest of flags and more details.

Andy

Thanks for the suggestion. I'm still not clear on how it works. I tried a ton of variations but all of them say syntax error. I must be misunderstanding the language. Can you show me an example: what would it look like to activate the cursor A on Graph0 at x=0.2?


Posts: 1635
Joined: 2007-06-21
Location: United States

There are examples in the help documentation for the Cursor operation.


tony
Posts: 104
Joined: 2007-08-28
Location: Canada

cursor A $stringfromlist(0, TraceNameList("",";",1)) 0.2

puts cursor on first trace of top graph

if you're plotting with an x-wave it may not appear in the position you expect.


HJDrescher
Posts: 332
Joined: 2015-01-20
Location: Germany

Here's a small illustration to be run from the command line

make test
•setscale x,0,1,"s" test
•test=x*sin(10*x)cursor A test 0.2

HJ


ItalliaVP
Posts: 3
Joined: 2017-06-12
Location: United States

Thanks everyone, I've figured it out! :)


Back to top