简体   繁体   中英

How to make a movie in Igor with one graph of multiple traces

I am running a program on Igor and I'd like to create a function that makes a movie of the traces graphed in a sequential manner. The program generates a table of waves that swaps between x and y axes such as,

Point Time0 Data0 Time1 Data1
1 5.3860002 14518253 5.3829999 15511268
2 5.4910002 13881730 5.487 15299764

The program allows me to create this graph/Table for as many waves as I have. Currently, I make a movie by calling

'''
NewMovie
AddMovie Frame
//Make a new graph
AddMovie Frame
//Make a new graph
AddMovie Frame
//Make a new graph
//etc etc
CloseMovie
'''

This is obviously very tedious, so I am trying to make it so I can just make one graph/table with many waves, then update a new graph with each wave and loop the NewMovie until it's complete.

The following code was made for something similar, but I cannot make it work for a double float dataset, which is what I have - not a matrix. I also cannot figure out how to call the waves in the way that the table above shows (ie, every other). Any help or tips are appeciated. '''

Function MakeMovie(matrix,xWave)
Wave matrix,xWave
variable i //loop variable
//make a dummy wave to accept individual rows
Make/O/N=(dimsize(matrix,1)) framewave
//create the first frame of the movie in a Graph windows called "FrameGraph"
Display/N=FrameGraph framewave vs xWave
Label/W=FrameGraph left "Intensity (a.u.)"
Label/W=FrameGraph bottom "Wavelength (nm)"
WaveStats/Q matrix //Get statistics of matrix
//set axis to a constant to prevent autoscaling
SetAxis left V_min,1.1*V_max
//Name the movie after the original wave
String movieName = NameofWave(matrix) + ".mov"
//create a new movie with the original wave's name
NewMovie /F=30/L/I/O as movieName
//start loop to add frames to movie
for (i = 0; i < dimsize(matrix,0);i += 1)
framewave=matrix[i][p] //advance to the next trace in the sequence
DoUpdate //update the graph with the next trace in the sequence
AddMovieFrame //add a frame to the movie
endfor
CloseMovie //Close the movie file and save it to disk.
Killwindow FrameGraph //clean up
Killwaves framewave //clean up
End
'''

Please wrap your code in code tags and indent it for readability. Igor Pro does that with selecting the code and choosing Edit->Adjust Indentation.

Regarding your question. The following works here:

Make/O/N=(75, 100) matrix = p + q
Make/O/N=(100) xwave = 0.1 * p
MakeMovie(matrix, xWave)

The row dimension in matrix gives the number of frames where as the columns holds the data for each trace.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM