
load IR data from many text files

Frog
I need to load a large amount of IR data from text files having 2 column, first volume is wavemumber and second is absorbante. I need to extract them, remane them using the file name, scale them and duplicata them twice. I wrote a proc but cannot figure out where it bugged.
could anyone give me an hand with my short macro ? I have attached the .ipf.
thank you,
Sylvie
Load_IR() references the waves Wavenumber and Absorbance in the present data folder. Do they exist before you run the function?
Maybe it's easier if you can post also the raw data.
July 24, 2014 at 12:14 am - Permalink
thank you for spending time on my macro.
sylvie
July 24, 2014 at 12:26 am - Permalink
July 24, 2014 at 12:28 am - Permalink
// Load the actual waves.
String name = ParseFilePath(3, path, ":", 0, 0) // Extract the file name without extension.
name = CleanupName(name, 0)
LoadWave/A=$name/D/J/W/K=0/V={" "," $",0,0}/L={0,0,0,1,1} path
// addiitonal treaments: scalling and duplicate
wave newIR=$name
setscale /I x, 5000, 700, $newIR
duplicate newIR newIR_N
duplicate newIR newIR_F
help anyone ?
July 24, 2014 at 02:19 am - Permalink
You need the same wave three times?
hm….Sylvie … IR data….is that you??
Cheers
Christian….formerly at BGI ;-)
July 24, 2014 at 02:28 am - Permalink
let me try the new macro. ..coming back soon
July 24, 2014 at 02:32 am - Permalink
nop, the macro does not load the files. Anyway, I have a new version, way shorter, and which load the file succesffully, and rename them, BUT the scaling and duplicata still bugged. do you know why ?
thank again for your time !
in attachment new macro.
// Load the actual waves.
String name = ParseFilePath(3, path, ":", 0, 0) // Extract the file name without extension.
name = CleanupName(name, 0)
LoadWave/A=$name/D/J/W/K=0/V={" "," $",0,0}/L={0,0,0,1,1} path
// additional treaments: scalling and duplicate
String AbstrN="N"
String AbstrF="F"
String newIR=name
String newIRN=name+AbstrN
String newIRF=name+AbstrF
setscale /I x, 5000, 700, "", $newIR
Duplicate/O newIR $newIRN, $newIRF
July 24, 2014 at 03:01 am - Permalink
Print S_waveNames
after the LoadWave command.
Or use the Igor debugger. For details execute:
DisplayHelpTopic "The Debugger"
You will then see that the string variable name does not contain the name of any wave loaded. It is just the base name (e.g., "wave" is the base name of "wave0", "wave1").
After the LoadWave command add this:
Then use either first or second instead of your name variable.
Also, since newIR is t he name of a string variable containing a wave name you must use a $ before newIR in your Duplicate command. For details execute:
DisplayHelpTopic "Converting a String into a Reference Using $"
July 24, 2014 at 05:06 am - Permalink
I post the .ipf file below for other users
I have another question then, when the .txt is load, it add a 0 at the end of the file name ( 'olivine1.txt' becomes 'olivine10' )
I try to use
Print RemoveEnding("second" , "0")
but I could not get the syntaxe right.
any advise?
sylvie
July 24, 2014 at 06:25 am - Permalink
July 24, 2014 at 07:50 am - Permalink