We have hundreds simulations and need to analyse the results in Igor. The each simulation's analysis operations are all the same. For example, there are 300 simulations with the name A_1, A_2...A_300. Among these simulations, the only difference is their name. If I want to analyse A_1's results, I need to open a procedure (this procedure is generated particular for A_1 because the name "A_1" is contained in the codes, for simulation A_2, there is another procedure contains "A_2"), include several other procedures from User procedure (these procedures are universal to all simulations) and do some operations(input several commends in commend window). So the analysis operations for all simulations are the same, but I don't want to do it 320 times by hand!
Is there any simple way to solve this problem? For example, write a for loop in Python and control Igor using it.
Well you can (obviously) write in Igor Pro code which automates the analysis operation. In case you're not familiar with Igor Pro I'd suggest to take the Guided Tour inside Igor Pro.
In any case you can't use Python in Igor Pro.
Dahair,
from the sounds of it you need to modify your current procedures. If there is a procedure for A_1, A_2, ..., A_N, then a procedure needs to be rewritten to cope with a generic case. If you already have the code to analyse one of the simulations, and the analysis is the same for all of them, then it should be straightforward to write a procedure that will do all of them in one pass. Perhaps you could put the code up for one of the analyses and we could give you an idea of how to do it.
(Thomas, it is possible to call the Python interpreter from IGOR, I wrote some XOP code a while ago to do so. This was based on some work by Rick Gerkin).
Just to follow up on the good suggestions thus far, here is a template to consider ...
Function DoMany(nsims) variable nsims
string ncurr variable ic
for(ic=1;ic<nsims;ic+=1) sprintf ncurr, "A_%d", ic // load the file for this data set (write your commands here) // result is wave named A_1, A_2, A_3 ... or whichever in the current data folder wave theOne = $ncurr
DoOne(theOne) endfor return0 end
Function DoOne(theOne) wave theOne
// write your generic analysis here end
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
In any case you can't use Python in Igor Pro.
February 25, 2014 at 01:16 pm - Permalink
from the sounds of it you need to modify your current procedures. If there is a procedure for A_1, A_2, ..., A_N, then a procedure needs to be rewritten to cope with a generic case. If you already have the code to analyse one of the simulations, and the analysis is the same for all of them, then it should be straightforward to write a procedure that will do all of them in one pass. Perhaps you could put the code up for one of the analyses and we could give you an idea of how to do it.
(Thomas, it is possible to call the Python interpreter from IGOR, I wrote some XOP code a while ago to do so. This was based on some work by Rick Gerkin).
A
February 25, 2014 at 02:38 pm - Permalink
variable nsims
string ncurr
variable ic
for (ic=1;ic<nsims;ic+=1)
sprintf ncurr, "A_%d", ic
// load the file for this data set (write your commands here)
// result is wave named A_1, A_2, A_3 ... or whichever in the current data folder
wave theOne = $ncurr
DoOne(theOne)
endfor
return 0
end
Function DoOne(theOne)
wave theOne
// write your generic analysis here
end
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
February 25, 2014 at 04:27 pm - Permalink
February 26, 2014 at 02:02 pm - Permalink