#pragma rtGlobals=1 // Use modern global access method. // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // QI'S SECTION // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // KATJA'S SECTION // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // see other ipf's: // ConcatenateWaves.ipf // ConcatenateAll().ipf // cool functions under edit menu while writing a procedure: // commentize, decommentize, and adjust indentation // // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // JOSE'S SECTION // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // ALLISON'S SECTION // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // // works well to find the one major peak of Hist and AVG data function FindFWHM ( PSL_signal, RealDva ) string PSL_signal string RealDva wave localwave = $PSL_signal wave localwave2 = $RealDva variable HalfHeight variable point1 variable point2 variable dx_pts variable FWHM_time variable FWHM_d // quite self-evident, computes peak height and half height // FindPeak/M=5/Q localwave FindPeak/N/Q localwave // changed for BWP studies printf "Max PSL signal = %g, ", V_PeakVal HalfHeight = V_PeakVal/2 printf "Half height = %g: ", HalfHeight // used FindLevel to get point #s where the straddling half heights of the peak are (alternative?: BinarySearch) FindLevel/Q localwave, HalfHeight if ( V_flag == 0 ) printf "Point #s %g, ", V_LevelX else print "error, former point not found, " endif point1 = V_LevelX FindLevel/R=[point1+1, 650 ]/Q localwave, HalfHeight if ( V_flag == 0 ) print V_LevelX else print "error, latter point not found\r" endif // determines the number of points between the two points point2 = V_LevelX dx_pts = point2 - point1 // printf "dx (#pts) = %g\r", dx_pts // converts number of points to time for 10 us timescale data (x-waves) FWHM_time = dx_pts * 0.00001 printf "FWHM (dt) = %g s\r", FWHM_time // converts number of signal points to calculated diameter FWHM_d = localwave2[point2] - localwave2[point1] printf "--> FWHM (dd) = %g nm\r", FWHM_d // *Rd = PSL_RealDva/FWHM_d end // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // PETER'S SECTION // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // FUNCTION FunWithTextWaves() variable iwave string tempstring //Create the real waves Make /O /N=10 Larry, Curly, Moe //Create the Text Wave to hold the Names Make /O /N=3 /T WaveNames //Explicitly "hard code" strings WaveNames[0]="Larry" WaveNames[1]="Curly" WaveNames[2]="Moe" //Add a wave name Insertpoints numpnts(WaveNames), 1, WaveNames tempstring = num2str(3) + "_Stooges" WaveNames[numpnts(WaveNames)-1] = tempstring Make /O/N=10 $tempstring // Cycle through the text wave and "do something" to all the waves contained in that text wave For(iWave=0; iWave< numpnts(WaveNames); iWave+=1) wave OrgWave = $waveNames[iWave] OrgWave = iWave*x EndFor END FUNCTION //*************************************************************************** FUNCTION CreateWaves() Make/O /N=300 X_Wave, Y_wave Y_Wave[0,99] = abs(enoise(1)) Y_Wave[100,199] = -abs(enoise(1)) Y_Wave[200,299] = enoise(1) X_Wave = enoise(1) END FUNCTION //*************************************************************************** Window All() : Graph PauseUpdate; Silent 1 // building window... Display /W=(327,90.2,863.4,463.4) Y_wave vs X_Wave AppendToGraph Y_wave[0,99] vs X_Wave[0,99] AppendToGraph Y_wave[100,199] vs X_Wave[100,199] AppendToGraph Y_wave[200,299] vs X_Wave[200,299] ModifyGraph mode(Y_wave)=3,mode(Y_wave#1)=2,mode(Y_wave#2)=2,mode(Y_wave#3)=2 ModifyGraph marker(Y_wave#1)=19 ModifyGraph lSize(Y_wave#1)=0,lSize(Y_wave#2)=0,lSize(Y_wave#3)=0 ModifyGraph rgb(Y_wave#1)=(0,65280,0),rgb(Y_wave#2)=(0,12800,52224),rgb(Y_wave#3)=(52224,0,41728) EndMacro // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // ED'S SECTION // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // ################################################ // General stuff // ################################################ // Procedure files - a good system is to have one folder for Igor procedures somewhere // (perhaps the "User Procedures" folder if you'd like), and to use shortcuts to load // some procedures automatically - anything in the "Igor procedures" folder loads // every time you load up Igor // Right click on any keyword to get to help for that subject // or to go to that function or macro. Example = HandyGraphButtons // Use Data Browser // don't be afraid of creating data folders - I find the trade off between // having many data folders and having to switch amongst them is // far outweighed by the advantage of keeping things organized // data folders can be a little tricky in writing procedures, but simple stuff can be // accomplished easily with a few functions: // GetDataFolder, setdatafolder, NewDataFolder, killdatafolder // and MakeAndOrSetDF from Scott's Global Utilities ipf, mentioned below // a nice trick is if you need to load in a bunch of data from an external file all at once // but you only want to keep some of it, load everything into a temporary data folder, do what // you want to do, copy the waves you want to save up to the root directory, and // then kill off the temporary data folder // Naming waves - using a common prefix (and organizing your waves alphabetically) groups // common waves together, e.g., doas_time, doas_signal, ams_time, ams_NO3, etc. // Use formatted notebooks to keep track of what you're doing; can insert figures, can save notebooks // as stand-alone files // xcsr(a), xcsr(b), pcsr(a), x2pnt, pnt2x -- all useful for interacting with the cursors // numType is useful in order to test for NaNs, etc // // ################################################ // How to insert something into the main menus // ################################################ // Menu "Macros" // Submenu "Global Utils" // "Handy Graph Buttons", HandyGraphButtons() // "Set Mirror, Pos and StandOff", MirrorStandPos() // "-------------" // "Command Line Remote Access Monitor", IFJP_IgorFtpJournalProcDraw() // End // End // can also create new menus Menu "Cool Stuff" Submenu "Scott's Global Utils" "Handy Graph Buttons", HandyGraphButtons() "Set Mirror, Pos and StandOff", MirrorStandPos() "-------------" "Command Line Remote Access Monitor", IFJP_IgorFtpJournalProcDraw() End End // this function references functions from Scott Herndon's Global Utilities ipf // if you don't have it - get it // // ################################################ // Keyboard Shortcuts // ################################################ // Ctrl + W closes window // Alt + Ctrl + W closes window with no save // Ctrl + Y name your window and create window macro // Ctrl + M pull up the local procedure window // Ctrl + J pull up the command line // Ctrl + Z undoes last command - only allowed for limited number of things // primarily any expand within a graph // Ctrl + S saves experiment // Ctrl + Shift + S saves procedure file // Ctrl + A autoscale axes // Ctrl + I show info (gets you the cursors) // Ctrl + T show tools (you can draw arrows and lines and such, amonst other things) // // // ################################################ // Useful Functions from Scott Herndon's Global Utilities .ipf // ################################################ // AppendString( thewave, thestring ) and AppendVal( thewave, theval ) tag on an extra cell // to the end of a text wave or numerical wave respectively // HandyGraphButtons() -- too cool // can also use Alt + mouse drag // can also use slider -- graph menu, packages, axis slider // bunch of time functions: SAM2secs, secs2JulianDay, etc. // Igor commone scale is dateTime, which is the number of seconds from January 1, 1904 // all other dates and times can be converted in and out of this time base "easily" // Igor has a lot of other functions for dealing with dateTime, like date2secs, etc. // StackAllAxes(graphName, lo_twink, hi_twink) makes your multiple y-axis plot pretty // PrimaryColors(graphName) -- can make your multi-trace graph colorful quickly // // __________________________________________________________________________ // __________________________________________________________________________ // Ed got up to here presenting on 10/18/2004 // __________________________________________________________________________ // __________________________________________________________________________ // // MakeAndOrSetDF( data_folder ) -- especially useful in programming, nice in that it finds a // data folder if it exists already, or makes it from scratch if it doesn't exist // makeNaNsBetweenCursors() -- does just what it says // setScaleDateTime( wv, timeStep, yr, mon, day ) // scaled waves have the units in the x dimension instead of just point number // the guts of this function is just this command: setscale/P x, startTime, timeStep, "dat" wv // ################################################ // Saving Graphics // ################################################ // Alt, F, G creates and saves a stand alone picture file // from whatever graph or layout you are looking at // Alt, E, G copies the current graph or layout so that you // can paste it somewhere else (perhaps into a // notebook or into another program, like power point) // *** In either of these cases, I recommend using .png as your file type // it does an excellent job of not taking up too much space but giving you // what-you-see-is-what-you-get graphics // // // ################################################ // Annotations on Graphs and Layouts // ################################################ // a couple of favorites I've got memorized // modifygraph lsize = 2 // modifygraph fsize = 16 // This is my favorite trick ever // Right mouse click to get to Add Annotation // Pull-down menu at top for : TextBox, Legend, ColorScale, or Tag // Superscripts and subscripts \S and \B - need \M to get back to normal text // How to avoid doing \M\Z16 all the time: // Typical begin of text: \F'Arial'\K(0,12800,52224)\Z16\[0 my super text box // **** note the \[0 -- this sets whatever formatting is before it as the // default format that a \M will bring you back to //