Difference between revisions of "Igor Quick Reference"
(→Helpful Wave Functions) |
(→Waves in Equations) |
||
Line 60: | Line 60: | ||
=== Waves in Equations === | === Waves in Equations === | ||
+ | |||
+ | You can treat a wave as a variable name in equations and assignments are made on a point-to-point (point 0, 1, etc.) basis. | ||
+ | |||
+ | For example, if you have | ||
+ | make/N=10 x_wave = x | ||
+ | you can make a wave of a line with slope 3 and intercept 4 by | ||
+ | make/N=10 y_wave = 3*x_wave + 4 | ||
+ | then | ||
+ | y_wave[0] = 3*x_wave[0] + 4 | ||
+ | y_wave[1] = 3*x_wave[1] + 4 | ||
+ | etc. | ||
== Loading Data == | == Loading Data == |
Revision as of 14:35, 25 August 2009
This page is intended to be a resource for the beginning and intermediate Igor user to quickly find help and tips about common tasks in Igor. Much of the information on this page is taken from the Igor "Getting Started" Introduction and Guided Tour, but is organized by topic so that the information is easy to find. Users of this page should also search (ctrl+f) for terms in case what they're looking for isn't found in the topic they expect.
This page was started by Ingrid Ulbrich.
Contents
Common Keyboard Shortcuts
- ctrl+j --> command window
- ctrl+k --> clears command line
- ctrl+m --> brings the procedure window to the front
- ctrl+t --> in a graph or panel, enables or disables tools
- ctrl+i --> in a graph, enables cursors ("info") (Graph -> Show Info)
- ctrl+a --> in a table or in the command window: select all
- --> in a graph: autoscale axes Graph -> Autoscale Axes
- Common Windows Commands
- ctrl+s --> save experiment
- ctrl+c, ctrl+x, ctrl+v --> copy, cut, paste
- ctrl+f, ctrl+g --> find, find again (with shift, go the opposite direction)
- ctrl+r --> search and replace
- ctrl+p --> print
- ctrl+z --> undo (only one action)
- ctrl+n --> new experiment
Waves
Waves are vectors (arrays) in which data is stored. Point number counts from 0 (i.e., MyWave[0] is the first element of the wave).
Waves have inherent x values that are by default equal to the point number. If you display a wave, it is automatically plotted versus the x value (0, 1, 2, etc.). It is possible to change the inherent wave scaling (see setScale), or you can plot a y-wave versus an x-wave.
Helpful Wave Functions
- make /O /N=points
- Data -> Make Waves...
- duplicate /O
- Data -> Duplicate Waves...
- rename
- Data -> Rename
- when the wave is in a table, right-click and choose Reanme
- setScale [/I/P] dim, num1, num2
- You can change the inherent values, but not the data values
- /P: num1 is start value, num2 is delta value
- /I: num1 is start value, num2 is last value
- Data -> Change Wave Scaling...
Putting Data in Waves
Typing in a Table
- First you need to view the wave in a table.
- If the wave exists
- double-click on it in the Data Browser to view it in a table
- single-click on it in the Data Browser, then right click and select "Edit"
- from the pulldown menus, choose Window -> New Table and select the wave(s) from the dialog window
- If the wave doesn't exist
- make the wave from the command line
- Make a new table (from the pulldown menus, choose Window -> New Table and don't choose any existing waves). You can rename the waves later.
- If the wave exists
- Now you can type values directly into the table
- Note that you are editing the only copy of the wave.
- Note that Igor can only undo 1 action (it doesn't remember more than 1 action).
- Note that if you paste into the table, you might insert points instead of overwriting existing data.
As a list of values, in the command line
Waves in Equations
You can treat a wave as a variable name in equations and assignments are made on a point-to-point (point 0, 1, etc.) basis.
For example, if you have
make/N=10 x_wave = x
you can make a wave of a line with slope 3 and intercept 4 by
make/N=10 y_wave = 3*x_wave + 4
then
y_wave[0] = 3*x_wave[0] + 4 y_wave[1] = 3*x_wave[1] + 4 etc.
Loading Data
From Igor Text Files (.itx)
- Double-click on the file icon on your computer. Waves will be loaded into the current DataFolder
- Data -> Load Waves -> Load Igor Text...' and choose the appropriate file
From non-Igor Text Files
- Data -> Load Waves -> ' and choose to load an appropriate file type
From Excel Files
Graphs
Helpful Graph Functions
- display
- Windows -> New Graph
- From the Data Browser, single-click on a wave then right-click and choose "Display" (can't choose a "vs" wave)
- appendToGraph
- legend
- ModifyGraph
Modifying Trace Appearance
- Getting to the window
- Double-click on a trace
- Right-click on a graph and choose "Modify (tracename)..."
- Graph -> Modify Trace Appearance...
- Notes and Tricks
- You can change several traces at once by selecting multiple waves (ctrl+click).
- "Offset" lets you do additive offsets (x and or y) and multiplicative scaling (x and or y)
- "Set as f(z)..." lets you set color, marker type, and marker size by any other wave of appropriate length (e.g., color by time, make marker size proportional to value)
- "Hide Trace" makes the selected trace not visible, but does not remove the associated axis.
- If the hidden trace had the highest or lowest value and controlled the axis range, the axis range will be reset unless "Autoscale" is checked.
- This can be useful if you want to show a graph in a presentation where you show versions with more traces in each view. This way you can make all the versions from the same graph.
Reorder Traces
Modifying Axes
- Getting to the window
- Double-click on an axis (look for vertical or horizontal double-arrow cursor)
- Graph -> Modify Axis
- Notes and Tricks
- You can make selections to any axis (or multiple axes at the same time) from the pulldown menu at the upper left of the window.
Adding Text
Legend
- legend produces the default legend in the top graph
- Graph -> Add Annotation..., change the Annotation type in the upper left corner to Legend
- Right-click in the graph and choose "Add Annotation...", change the Annotation type in the upper left corner to Legend
- Edit an existing legend by double-clicking on it.
Text box
- Graph -> Add Annotation..., change the Annotation type in the upper left corner to TextBox
- Right-click in the graph and choose "Add Annotation...", change the Annotation type in the upper left corner to TextBox
- Edit an existing text box by double-clicking on it.
Tag (Text that
- Graph -> Add Annotation..., change the Annotation type in the upper left corner to TextBox
- Right-click in the graph and choose "Add Annotation...", change the Annotation type in the upper left corner to TextBox
- Edit an existing text box by double-clicking on it.
"Drawn" text (less interactive than a text box)
- Get to the "Tools" by pressing ctrl+t (Graph -> Show Tools) when the top window is your graph. A set of buttons will appear to the left of your graph.
- Choose the "T..." icon and click in the graph where you want the text to be.
- Insert your text in the dialog box. Note that you can control the location and formatting of the text here.
- Press the top button on the "Tools" to return to normal graph interactions or press ctrl+t to close the "Tools" and return to normal graph interactions.
- Notes and Tips
- After closing the dialog, you must click the arrow icon to move your text.
- This text can only be moved or changed when "Tools" are available.
- When "Tools" are enabled (the long list of buttons is showing) you cannot copy a graph (for pasting into a Notebook or other programs). Close the tools (ctrl+t) or click the top button of the toolbar to allow copying.
Adding Lines
With Traces
- Create a 2-point wave with points = 0, 1
- Append this trace to the graph and scale it using multiplicative offset (same x-,y-scaling --> 1:1 line; different x-, y-scaling for different slopes)
Drawing Fixed Lines
- Enable drawing tools by pressing ctrl+t (Graph -> Show Tools).
- Select the line tool and draw a line.
- Select the arrow tool and double-click on the line.
- To make a fixed-value line, set the Coordinate System (upper left pull-down menus) to axes (e.g., "Axis Bottom", "Axis Left")
- Set the coordinates in the bottom of the dialog box to the axis values for the line. Note that (X0, Y0) is the point where you started the line.
Using Cursors
- Press ctrl+i or Graph -> Show info
- Drag the cursor icons onto points on the graph
- Note that the cursors attach only to points in a wave, not line segments
- You can change the wave that a cursor is on by right-clicking on the wave name and choosing a different name
- Wave information is displayed in the bar.
- Move the cursors by pressing right and left arrow keys or by moving the vertical bar between the wave names and the point information.
- "Highlighted" (dark) markers next to the wave name indicate that the cursor will move; open markers indicate that the cursor will not move.
- Tips and Tricks
- Note that point may not equal x value, depending on how your wave is plotted.
- You can get up to 10 cursors, but you can only see the info from two cursors at a time. Right-click over the names of the waves for the cursors and select "Show Cursor Pair" for a new pair of cursors.
Saving Graphs
Graph Macro
- ctrl+y. To save the macro choose a name for the macro and check the box to save or update the graph macro. You can give the graph a window title (optional).
- close the graph and choose "Save"
- A macro with the name you selected is created in the local procedure window (ctrl+m)
- This is a handy way to get the code to produce a graph when you want to create a function that makes this graph
Graph Style Macro
- ctrl+y
Save Graph as its own Experiment
- File -> Save Graph Copy...
Strings
Helpful String Functions
Variables
Helpful Variable Functions
- NVAR
- NVAR_exists
Functions
The Local Procedure File
Igor Procedure Files (.ipf)
Local vs. Global Objects
Lists
Miscellaneous Tips and Tricks
- To skip the "Close Window" dialog that asks if you want to save the window (Tables, Graphs, Panels), hold "Alt" while you click the Close icon in the window.
- The Graph Browser (Misc -> Graph Browser) can help keep track of lots of graphs in one experiment. There are two drawbacks:
- If you minimize a graph, the Graph Browser shows a minimized version, which can make it hard to identify the graph you're looking for. Instead of minimizing graphs, you can "hide" them from the graph browser and still see the full graph in the browser.
- If you hide graphs, there's no minimized version you can click on to find the graph again. You must retrieve it from the Graph Browser or from Windows -> Graphs -> and the graph name and waves plotted in the graph.