#pragma rtGlobals=2 // Use modern global access method. #pragma IgorVersion = 4.0 #include "spec" Function deadTime(det) Variable det Variable W0 = 559897.975452345 Variable W1 = -563471.687494516 Variable W2 = 1.89519906301593e-06 Variable corrected = -ln((det-W0)/W1)/W2 if (numtype(corrected) || corrected=0) && (exists("sig_err")!=1)) if (exists("deadtime")==6 && exists("seconds")==1) WAVE seconds=seconds sig /= seconds sig = deadTime(sig) // dead time works on counts/second only sig *= seconds endif Duplicate $specYwave sig_err sig_err = sqrt(sig) / wI0 / filterTrans endif sig = sig / wI0 / filterTrans specYwave = "sig" endif End Proc extraSpecReadProcessOLD(extra) Variable extra Silent 1 if (!extra) return endif string wI0="" // find name of Io wave if it exists if (exists("I0")==1) wI0 = "I0" endif if (exists("Io")==1) wI0 = "Io" endif if ((exists("sig")!=1) && strlen(wI0)) // make a normalized wave String fldr= GetDataFolder(0) Variable scanNum = str2num(fldr[4,inf]) Variable filterTrans=specInfo(scanNum,"filterTrans") filterTrans = numtype(filterTrans) ? 1 : filterTrans Duplicate $specYwave sig String photonCounter="detector;scint;NaI;scint;oxfo;oxford;Bicr;Bicron;harmonic;Det_bot;Det_top" if ((FindListItem( :specYwave, photonCounter)>=0) && (exists("sig_err")!=1)) if (exists("deadtime")==6 && exists("seconds")==1) sig /= seconds sig = deadTime(sig) // dead time works on counts/second only sig *= seconds endif Duplicate $specYwave sig_err sig_err = sqrt(sig) / $wI0 / filterTrans endif sig = sig / $wI0 / filterTrans specYwave = "sig" endif End Proc extraSpecReadProcessOLDer(extra) Variable extra Silent 1 if (!extra) return endif string wI0="" // find name of Io wave if it exists if (exists("I0")==1) wI0 = "I0" endif if (exists("Io")==1) wI0 = "Io" endif if ((exists("sig")!=1) && strlen(wI0)) // make a normalized wave String fldr= GetDataFolder(0) Variable scanNum = str2num(fldr[4,inf]) Variable filterTrans=specInfo(scanNum,"filterTrans") filterTrans = numtype(filterTrans) ? 1 : filterTrans String photonCounter="detector;scint;NaI;scint;oxfo;oxford;Bicr;Bicron;harmonic;Det_bot;Det_top" if ((FindListItem( :specYwave, photonCounter)>=0) && (exists("sig_err")!=1)) Duplicate $specYwave sig_err sig_err = sqrt($specYwave) / $wI0 / filterTrans endif Duplicate $specYwave sig sig = sig / $wI0 / filterTrans specYwave = "sig" endif End Proc extraSpecRead(fileVar) Variable fileVar // file ref number Silent 1 String line1,line2 // line of input from file Variable i FStatus fileVar // this section special for reading #BL and #B lines Variable FilePos = V_filePos // this should be the start of the scan line1 = FindDataLineType(fileVar,"#I ",1) if (strlen(line1)>2) line1 = line1[3,inf] SetBValues("filter",line1) endif line1 = FindDataLineType(fileVar,"#B0 ",1) if (strlen(line1)>2) line1 = line1[4,inf] line2 = FindDataLineType(fileVar,"#B1 ",1) line2=line2[4,inf] SetBValues(line1,line2) endif line1 = FindDataLineType(fileVar,"#B2 ",1) if (strlen(line1)>2) line1 = line1[4,inf] line2 = FindDataLineType(fileVar,"#B3 ",1) line2=line2[4,inf] SetBValues(line1,line2) endif line1 = FindDataLineType(fileVar,"#B4 ",1) if (strlen(line1)>2) line1 = line1[4,inf] line2 = FindDataLineType(fileVar,"#B5 ",1) line2=line2[4,inf] SetBValues(line1,line2) endif line1 = FindDataLineType(fileVar,"#B6 ",1) if (strlen(line1)>2) line1 = line1[4,inf] line2 = FindDataLineType(fileVar,"#B7 ",1) line2=line2[4,inf] SetBValues(line1,line2) endif line1 = FindDataLineType(fileVar,"#B8 ",1) if (strlen(line1)>2) line1 = line1[4,inf] line2 = FindDataLineType(fileVar,"#B9 ",1) line2=line2[4,inf] SetBValues(line1,line2) endif line1 = FindDataLineType(fileVar,"#B10 ",1) if (strlen(line1)>2) line1 = line1[5,inf] line2 = FindDataLineType(fileVar,"#B11 ",1) line2=line2[5,inf] SetBValues(line1,line2) endif line1 = FindDataLineType(fileVar,"#R1 ",0) if (strlen(line1)>2) line1 = line1[4,inf] String r1Names="-- peakXmax peakmax peakFWHM peakCWHM peakCOM peakSUM" SetBValues(r1Names,line1) endif line1 = FindDataLineType(fileVar,"#R2 ",0) if (strlen(line1)>2) line1 = line1[4,inf] String r2Names="-- osaX osaY zpX zpY zpZ wireY" SetBValues(r2Names,line1) endif FSetPos fileVar, FilePos // reset file position to start of scan End //Function/T RemoveOneListFromAnotherXX(mainList,toRemove) // String mainList // String toRemove // String str // Variable ii // Variable i = 0 // do // str = StringFromList(i, mainList ) // ii = WhichListItem(str , mainList ) // mainList = RemoveListItem(ii, mainList) // i += 1 // while (strlen(str)>0) // return mainList //End