source: sans/Analysis/trunk/Put in User Procedures/SANS_Models_v3.00/Packages/Invariant/Invariant.ipf @ 42

Last change on this file since 42 was 42, checked in by srkline, 16 years ago

initial checkin of Analysis v.3.00 files

File size: 17.7 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2
3// 07 JAN 05 SRK
4// updated procedures (from SS 2002) to be used as a package
5// with the SANS analysis routines
6//
7// need to:
8// - verify accuracy (see John)
9// - help file
10
11// this is the main entry point for the panel
12Proc Make_Invariant_Panel()
13        DoWindow/F Invariant_Panel
14        if(V_flag==0)
15                //create global variables in root:invariant
16                Init_Invariant()
17                Invariant_Panel()
18        endif
19        //pop the file menu
20        Inv_FilePopMenuProc("",1,"")
21End
22
23//create the globals
24Proc Init_Invariant()
25        NewDataFolder/O/S root:invariant
26        Variable/G gNumLow=10
27        Variable/G gNumHigh=10
28       
29        Variable/G gInvMeas=0
30        Variable/G gInvLowQ=0
31        Variable/G gInvHighQ=0
32        Variable/G gInvTotal=0
33        String/G gDataPopList = "none"
34        Variable/G gIsSlitSmeared=0
35        Variable/G gDqv = 0.117         //default value for USANS slit height (re-read from file)
36       
37        NewDataFolder/O root:myGlobals          //just in case...
38       
39        SetDataFolder root:
40End
41
42// for testing - compare to the "perfect" value. This macro
43// calculates the invariant based on the contrast and volume fraction
44// - the extrapolated/integrated value should match this...
45Macro PrintModelInvariant(delta_rho,phi)
46        Variable delta_rho=3e-6,phi=0.1
47        // delta_rho [=] 1/A^2
48        Variable inv
49        inv = 2*pi*pi*delta_rho*delta_rho*phi*(1-phi)*1e8
50       
51        Printf "The model invariant is %g ^-3 cm^-1\r\r",inv
52End
53
54
55//integrates only over the given q-range, does no interpolation
56Function Invariant(qw,iw)
57        Wave qw,iw
58       
59        Variable num,invar
60        Duplicate/O qw integrand
61        integrand = qw*qw*iw
62//      integrand /= 1e8                //convert 1/cm to 1/A
63       
64        num = numpnts(qw)
65        invar = areaXY(qw,integrand,qw[0],qw[num-1])
66       
67        return(invar)           //units of ^-3 cm^-1
68End
69
70//integrates only over the given q-range, does no interpolation
71// function is for slit smeared data
72Function Invariant_SlitSmeared(qw,iw)
73        Wave qw,iw
74       
75        Variable num,invar
76        NVAR dQv = root:invariant:gDqv
77       
78        Duplicate/O qw integrand
79        integrand = qw*iw
80//      integrand /= 1e8                //convert 1/cm to 1/A
81       
82        num = numpnts(qw)
83        invar = areaXY(qw,integrand,qw[0],qw[num-1])
84       
85        invar *= dQv            //correct for the effects of slit-smearing
86               
87        return(invar)           //units of ^-3 cm^-1
88End
89
90Function Guinier_Fit(w,x) : FitFunc
91        Wave w
92        Variable x
93       
94        //fit data to I(q) = A*exp(B*q^2)
95        // (B will be negative)
96        //two parameters
97        Variable a,b,ans
98        a=w[0]
99        b=w[1]
100        ans = a*exp(b*x*x)
101        return(ans)
102End
103
104
105//pass the wave with the q-values
106Function SetExtrWaves(w)
107        Wave w
108
109        Variable num_extr=100
110       
111        Make/O/D/N=(num_extr) extr_hqq,extr_hqi,extr_lqq,extr_lqi
112        extr_lqi=1
113        extr_hqi=1              //default values
114        //set the q-range
115        Variable qmax,qmin,num
116        qmax=10
117        qmin=0
118        num=numpnts(w)
119       
120        extr_hqq = w[num-1] + x * (qmax-w[num-1])/num_extr
121        extr_lqq = qmin + x * (w[0]-qmin)/num_extr
122       
123        return(0)
124End
125
126Function DoExtrapolate(qw,iw,sw,nbeg,nend)
127        Wave qw,iw,sw
128        Variable nbeg,nend
129       
130        Wave extr_lqi=extr_lqi
131        Wave extr_lqq=extr_lqq
132        Wave extr_hqi=extr_hqi
133        Wave extr_hqq=extr_hqq
134        Variable/G V_FitMaxIters=300
135        Variable num=numpnts(iw)
136       
137        Make/O/D G_coef={100,-100}              //input
138        FuncFit Guinier_Fit G_coef iw[0,(nbeg-1)] /X=qw /W=sw /D
139        extr_lqi= Guinier_Fit(G_coef,extr_lqq)
140       
141        Printf "I(q=0) = %g (1/cm)\r",G_coef[0]
142        Printf "Rg = %g ()\r",sqrt(-3*G_coef[1])
143       
144        Make/O/D P_coef={0,1,-4}                        //input
145        //(set background to zero and hold fixed)
146        CurveFit/H="100" Power kwCWave=P_coef  iw[(num-1-nend),(num-1)] /X=qw /W=sw /D
147        extr_hqi=P_coef[0]+P_coef[1]*extr_hqq^P_coef[2]
148       
149        Printf "Power law exponent = %g\r",P_coef[2]
150        Printf "Pre-exponential = %g\r",P_coef[1]
151       
152        return(0)
153End
154
155//plot based on the wave selelctions
156Function Plot_Inv_Data(ctrlName) : ButtonControl
157        String ctrlName
158       
159        //access the global strings representing the last data file read in
160        SVAR QWave = root:invariant:QWave
161        SVAR IWave = root:invariant:IWave
162        SVAR SWave = root:invariant:SWave
163       
164        Wave qw=$QWave
165        Wave iw=$IWave
166        Wave sw=$SWave
167       
168        String str="",item=""
169        Variable num=0,ii
170       
171        //not used - just kill and re-draw
172        //remove everything from the graph and graph it again
173//      str = TraceNameList("",";",1)
174//      num=ItemsInList(str)
175//      for(ii=0;ii<num;ii+=1)
176//              item=StringFromList(ii, str  ,";")
177//              Print item
178//              RemoveFromGraph $item
179//      endfor
180
181        DoWindow/F invariant_graph
182        if(V_flag==1)
183                DoWindow/K invariant_graph
184        endif
185        Display /W=(5,44,375,321)/K=1 iw vs qw
186        DoWindow/C invariant_graph
187        ModifyGraph mode=3,marker=8
188        ModifyGraph grid=1
189        ModifyGraph log=1
190        ModifyGraph mirror=2
191        ModifyGraph standoff=0
192        Label left "Intensity (1/cm)"
193        Label bottom "q (1/)"
194        ModifyGraph rgb($NameofWave(iw))=(0,0,0)
195        ModifyGraph opaque($NameofWave(iw))=1
196        ErrorBars $NameofWave(iw) Y,wave=(sw,sw)
197        Legend
198       
199//      Print TraceNameList("",";",1)
200       
201        //create the extra waves now, and add to plot
202        SetExtrWaves(qw)
203        Wave extr_lqi=extr_lqi
204        Wave extr_lqq=extr_lqq
205        Wave extr_hqi=extr_hqi
206        Wave extr_hqq=extr_hqq
207        AppendtoGraph extr_lqi vs extr_lqq
208        AppendtoGraph extr_hqi vs extr_hqq
209        ModifyGraph lSize(extr_lqi)=2,lSize(extr_hqi)=2
210        ModifyGraph rgb($NameofWave(iw))=(0,0,0),rgb(extr_hqi)=(2,39321,1)
211       
212        //reset the invariant values to zero
213        NVAR meas = root:invariant:gInvMeas
214        NVAR lo = root:invariant:gInvLowQ
215        NVAR hi = root:invariant:gInvHighQ
216        NVAR total = root:invariant:gInvTotal
217        meas=0
218        lo=0
219        hi=0
220        total=0
221       
222        return(0)
223End
224
225
226Function LowCheckProc(ctrlName,checked) : CheckBoxControl
227        String ctrlName
228        Variable checked
229
230        Variable val=0
231//      print "checked = ",checked
232        if(cmpstr(ctrlName,"check_0")==0)
233                if(checked)
234                        val=1
235                endif
236        endif
237        CheckBox check_0,value= Val==1
238        CheckBox check_1,value= Val==0
239End
240
241
242Proc Invariant_Panel()
243        SetDataFolder root:             //use absolute paths?
244        PauseUpdate; Silent 1           // building window...
245        NewPanel /W=(510,44,796,529)    /K=2
246        DoWindow/C Invariant_Panel
247        ModifyPanel cbRGB=(65535,43690,0)
248        SetDrawLayer UserBack
249        DrawText 23,196,"Extrapolation"
250        DrawText 158,195,"Power-Law"
251        DrawText 158,211,"Extrapolation"
252        SetDrawEnv fstyle= 1
253        DrawText 58,349,"Units are [^-3 cm^-1]"
254        SetDrawEnv fstyle= 1
255        DrawText 61,16,"Calculate the Invariant"
256        DrawLine 16,135,264,135
257        DrawLine 16,19,264,19
258       
259        PopupMenu ywave,pos={10,60},size={154,19},title="Data File"
260        PopupMenu ywave,help={"Select the experimental intensity values"}
261        PopupMenu ywave,mode=1,value=root:invariant:gDataPopList,proc=Inv_FilePopMenuProc
262       
263        Button loadButton,pos={10,90},size={130,20},proc=Inv_Load_Proc,title="Load and Plot File"
264        Button loadButton,help={"After choosing a file, load it into memory and plot it with this button."}
265       
266        Button Inv_PathButton,pos={10,29},size={80,20},proc=Inv_PickPathButtonProc,title="Pick Path"
267        Button DoneButton,pos={215,453},size={50,20},proc=InvDoneButton,title="Done"
268        Button DoneButton,help={"This button will close the panel and the associated graph"}
269
270//      PopupMenu wavePop_0,pos={15,9},size={139,20},title="q-values"
271//      PopupMenu wavePop_0,mode=1,value= #"WaveList(\"*_q\",\";\",\"\")"
272//      PopupMenu wavePop_1,pos={15,38},size={140,20},title="Intensity"
273//      PopupMenu wavePop_1,mode=1,value= #"WaveList(\"*_i\",\";\",\"\")"
274//      PopupMenu wavePop_2,pos={15,65},size={124,20},title="error"
275//      PopupMenu wavePop_2,mode=1,value= #"WaveList(\"*_s\",\";\",\"\")"
276        SetVariable setvar_0,pos={27,249},size={80,15},title="# points"
277        SetVariable setvar_0,limits={5,50,0},value= root:invariant:gNumLow
278        SetVariable setvar_1,pos={166,249},size={80,15},title="# points"
279        SetVariable setvar_1,limits={5,200,0},value= root:invariant:gNumHigh
280        CheckBox check_0,pos={23,202},size={50,14},proc=LowCheckProc,title="Guinier"
281        CheckBox check_0,value= 1
282        CheckBox check_1,pos={23,223},size={68,14},proc=LowCheckProc,title="Power Law"
283        CheckBox check_1,value= 0
284        Button button_0,pos={29,275},size={90,20},proc=InvLowQ,title="Calc Low Q"
285        Button button_1,pos={56,141},size={170,20},proc=InvMeasQ,title="Calculate Measured Q"
286        Button button_2,pos={168,275},size={90,20},proc=InvHighQ,title="Calc High Q"
287//      Button button_3,pos={13,98},size={50,20},proc=Plot_Inv_Data,title="Plot"
288        Button button_4,pos={230,29},size={25,20},proc=Inv_HelpButtonProc,title="?"
289        GroupBox group0,pos={14,165},size={123,144},title="Low Q"
290        GroupBox group0_1,pos={147,165},size={123,144},title="High Q"
291        GroupBox group1,pos={23,318},size={239,124},title="INVARIANT"
292        ValDisplay valdisp0,pos={51,354},size={180,14},title="In measured Q-range "
293        ValDisplay valdisp0,limits={0,0,0},barmisc={0,1000}
294        ValDisplay valdisp0,value= #"root:invariant:gInvMeas"
295        ValDisplay valdisp0_1,pos={51,371},size={180,14},title="In low Q extrapolation "
296        ValDisplay valdisp0_1,limits={0,0,0},barmisc={0,1000}
297        ValDisplay valdisp0_1,value= #"root:invariant:gInvLowQ"
298        ValDisplay valdisp0_2,pos={51,388},size={180,14},title="In high Q extrapolation "
299        ValDisplay valdisp0_2,limits={0,0,0},barmisc={0,1000}
300        ValDisplay valdisp0_2,value= #"root:invariant:gInvHighQ"
301        ValDisplay valdisp0_3,pos={51,411},size={180,14},title="TOTAL "
302        ValDisplay valdisp0_3,limits={0,0,0},barmisc={0,1000}
303        ValDisplay valdisp0_3,value= #"root:invariant:gInvTotal"
304       
305        CheckBox check0,pos={10,116},size={101,14},proc=SlitSmearedCheckProc,title="Slit-Smeared Data"
306        CheckBox check0,value= root:invariant:gIsSlitSmeared
307        SetVariable setvar0,pos={136,116},size={130,15},title="Slit Height (1/A)"
308        SetVariable setvar0,limits={-inf,inf,0},value= root:invariant:gDqv
309       
310        //set up a dependency to calculate the total invariant
311        root:invariant:gInvTotal := root:invariant:gInvLowQ + root:invariant:gInvMeas + root:invariant:gInvHighQ
312EndMacro
313
314
315Function InvMeasQ(ctrlName) : ButtonControl
316        String ctrlName
317       
318        //no graph, get out
319        DoWindow/F Invariant_Graph
320        if(V_flag==0)
321                return(0)
322        endif
323       
324        //do the straight calculation of the invariant of the specified data
325        Variable inv,num
326       
327        SVAR QWave = root:invariant:QWave
328        Wave qw=$QWave
329        SVAR IWave = root:invariant:IWave
330        Wave iw=$IWave
331       
332        NVAR isSlitSmeared=root:invariant:gIsSlitSmeared
333        if(isSlitSmeared)
334                inv = Invariant_SlitSmeared(qw,iw)
335        else
336                inv = Invariant(qw,iw)
337        endif
338       
339        num=numpnts(qw)
340        Printf "The invariant over the measured q-range %g to %g is %g ^-3 cm^-1\r\r",qw[0],qw[(num-1)],inv
341       
342        // update the global display on the panel (there is a dependency for the total)
343        NVAR val = root:invariant:gInvMeas
344        val = inv
345       
346        return(0)
347End
348
349Function InvLowQ(ctrlName) : ButtonControl
350        String ctrlName
351       
352        //no graph, get out
353        DoWindow/F Invariant_Graph
354        if(V_flag==0)
355                return(0)
356        endif
357       
358        Variable yesGuinier=0,nume,inv
359        // do the extrapolation of the correct type
360        ControlInfo/W=Invariant_Panel check_0           //the Guinier box
361        yesGuinier = V_Value
362//      print "yesGuinier = ",yesGuinier
363        //number of points to use for fit
364        NVAR nbeg=root:invariant:gNumLow
365        //define the waves
366        Wave extr_lqi=extr_lqi
367        Wave extr_lqq=extr_lqq
368       
369        SVAR QWave = root:invariant:QWave
370        Wave qw=$QWave
371        SVAR IWave = root:invariant:IWave
372        Wave iw=$IWave
373        SVAR SWave = root:invariant:SWave
374        Wave sw=$SWave
375       
376        Wave/Z W_coef=W_coef
377        Variable/G V_FitMaxIters=300
378//      Variable numi=numpnts(iw)
379       
380        if(yesGuinier)
381                Make/O/D G_coef={1000,-1000}            //input
382                FuncFit Guinier_Fit G_coef iw[0,(nbeg-1)] /X=qw /W=sw /D
383                extr_lqi= Guinier_Fit(G_coef,extr_lqq)
384               
385                Printf "I(q=0) = %g (1/cm)\r",G_coef[0]
386                Printf "Rg = %g ()\r",sqrt(-3*G_coef[1])
387        else
388                //do a power-law fit instead
389                Make/O/D P_coef={0,1,-1}                        //input
390                //(set background to zero and hold fixed)
391                CurveFit/H="100" Power kwCWave=P_coef  iw[0,(nbeg-1)] /X=qw /W=sw /D
392                extr_lqi=P_coef[0]+P_coef[1]*extr_lqq^P_coef[2]
393                //     
394                Printf "Pre-exponential = %g\r",P_coef[1]
395                Printf "Power law exponent = %g\r",P_coef[2]
396                //     
397        endif
398       
399        //calculate the invariant
400        NVAR isSlitSmeared=root:invariant:gIsSlitSmeared
401        if(isSlitSmeared)
402                inv = Invariant_SlitSmeared(extr_lqq,extr_lqi)
403        else
404                inv = Invariant(extr_lqq,extr_lqi)
405        endif
406       
407        nume=numpnts(extr_lqq)
408        Printf "The invariant over the q-range %g to %g is %g ^-3 cm^-1\r\r",extr_lqq[0],extr_lqq[(nume-1)],inv
409       
410        // update the global display on the panel (there is a dependency for the total)
411        NVAR val = root:invariant:gInvLowQ
412        val = inv
413       
414        return(0)
415End
416
417Function InvHighQ(ctrlName) : ButtonControl
418        String ctrlName
419       
420        //no graph, get out
421        DoWindow/F Invariant_Graph
422        if(V_flag==0)
423                return(0)
424        endif
425       
426        // do the power-law extrapolation
427       
428        Wave extr_hqi=extr_hqi
429        Wave extr_hqq=extr_hqq
430        SVAR QWave = root:invariant:QWave
431        Wave qw=$QWave
432        SVAR IWave = root:invariant:IWave
433        Wave iw=$IWave
434        SVAR SWave = root:invariant:SWave
435        Wave sw=$SWave
436       
437        Variable/G V_FitMaxIters=300
438        Variable num=numpnts(iw),nume,inv
439        NVAR nend=root:invariant:gNumHigh               //number of points for the fit
440
441        Make/O/D P_coef={0,1,-4}                        //input
442        //(set background to zero and hold fixed)
443        CurveFit/H="101" Power kwCWave=P_coef  iw[(num-1-nend),(num-1)] /X=qw /W=sw /D
444        extr_hqi=P_coef[0]+P_coef[1]*extr_hqq^P_coef[2]
445       
446        Printf "Pre-exponential = %g\r",P_coef[1]
447        Printf "Power law exponent = %g\r",P_coef[2]
448       
449        //calculate the invariant
450        NVAR isSlitSmeared=root:invariant:gIsSlitSmeared
451        if(isSlitSmeared)
452                inv = Invariant_SlitSmeared(extr_hqq,extr_hqi)
453        else
454                inv = Invariant(extr_hqq,extr_hqi)
455        endif
456
457        nume=numpnts(extr_hqq)
458        Printf "The invariant over the q-range %g to %g is %g ^-3 cm^-1\r\r",extr_hqq[0],extr_hqq[(nume-1)],inv
459       
460        // update the global display on the panel (there is a dependency for the total)
461        NVAR val = root:invariant:gInvHighQ
462        val = inv
463       
464        return(0)       
465End
466
467Function UnloadInvariant()
468        if (WinType("Invariant_Panel") == 7)
469                DoWindow/K Invariant_Panel
470        endif
471        if (WinType("Invariant_Graph") != 0)
472                DoWindow/K $"Invariant_Graph"
473        endif
474        if (DatafolderExists("root:invariant"))
475                KillDatafolder root:invariant
476        endif
477        Execute/P "DELETEINCLUDE \"Invariant\""
478        Execute/P "COMPILEPROCEDURES "
479end
480
481Menu "Macros"
482        Submenu "Packages"
483                "Unload Invariant", UnloadInvariant()
484        End
485end
486
487Function Inv_HelpButtonProc(ctrlName) : ButtonControl
488        String ctrlName
489
490        DisplayHelpTopic "Calculate Scattering Invariant"
491End
492
493Function Inv_PickPathButtonProc(ctrlName) : ButtonControl
494        String ctrlName
495
496        A_PickPath()
497        //pop the file menu
498        Inv_FilePopMenuProc("",1,"")
499End
500
501//gets a valid file list (simply not the files with ".SAn" in the name)
502//
503Function Inv_FilePopMenuProc(ctrlName,popNum,popStr) : PopupMenuControl
504        String ctrlName
505        Variable popNum
506        String popStr
507       
508        String tempStr=Inv_filterButtonProc(ctrlName)
509        if(strlen(tempStr)==0)
510                tempStr = "Pick the data path"
511        Endif
512        String/G root:invariant:gDataPopList =tempStr
513        ControlUpdate/W=Invariant_Panel ywave
514       
515End
516
517//function called byt the popups to get a file list of data that can be sorted
518// this procedure simply removes the raw data files from the string - there
519//can be lots of other junk present, but this is very fast...
520//
521// could also use the alternate procedure of keeping only file with the proper extension
522//
523Function/S Inv_filterButtonProc(ctrlName)
524        String ctrlName
525
526        String list="",newList="",item=""
527        Variable num,ii
528       
529        //check for the path
530        PathInfo catPathName
531        if(V_Flag==0)
532                DoAlert 0, "Data path does not exist - pick the data path from the button on the invariant panel"
533                Return("")
534        Endif
535       
536        list = IndexedFile(catpathName,-1,"????")
537        num=ItemsInList(list,";")
538        //print "num = ",num
539        for(ii=(num-1);ii>=0;ii-=1)
540                item = StringFromList(ii, list  ,";")
541                //simply remove all that are not raw data files (SA1 SA2 SA3)
542                if( !stringmatch(item,"*.SA1*") && !stringmatch(item,"*.SA2*") && !stringmatch(item,"*.SA3*") )
543                        if( !stringmatch(item,".*") && !stringmatch(item,"*.pxp") && !stringmatch(item,"*.DIV"))                //eliminate mac "hidden" files, pxp, and div files
544                                newlist += item + ";"
545                        endif
546                endif
547        endfor
548        //remove VAX version numbers
549        newList = A_RemoveVersNumsFromList(newList)
550        //sort
551        newList = SortList(newList,";",0)
552
553        return newlist
554End
555
556// Loads the selected file for fitting
557// and graphs the data as needed
558Proc Inv_Load_Proc(ctrlName): ButtonControl
559        String ctrlName
560       
561        //Load the data
562        String tempName="",partialName=""
563        Variable err
564        ControlInfo/W=Invariant_Panel ywave
565        //find the file from the partial filename
566        If( (cmpstr(S_value,"")==0) || (cmpstr(S_value,"none")==0) )
567                //null selection, or "none" from any popup
568                Abort "no file selected in popup menu"
569        else
570                //selection not null
571                partialName = S_value
572                //Print partialName
573        Endif
574        //get a valid file based on this partialName and catPathName
575        tempName = A_FindValidFilename(partialName)
576
577        //prepend path to tempName for read routine
578        PathInfo catPathName
579       
580        tempName = S_path + tempName
581       
582        //load in the data (into the root directory)
583        A_LoadOneDDataWithName(tempName)
584        //Print S_fileName
585        //Print tempName
586       
587        String cleanLastFileName = "root:"+CleanupName(root:myGlobals:gLastFileName,0)
588       
589        // keep global copies of the names rather than reading from the popup
590        tempName=cleanLastFileName+"_q"
591        String/G root:invariant:QWave=tempName
592        tempName=cleanLastFileName+"_i"
593        String/G root:invariant:IWave=tempName
594        tempName=cleanLastFileName+"_s"
595        String/G root:invariant:SWave=tempName
596
597        //Plot, and adjust the scaling to match the axis scaling set by the popups
598        Plot_Inv_Data("")
599
600        //if the slit-smeared box is checked, try to read the slit height
601        // - if can't find it, maybe not really smeared data, so put up the Alert
602        ControlInfo/W=Invariant_Panel check0
603        if(V_Value==1)
604                SlitSmearedCheckProc("",1)
605        endif
606End
607
608Proc InvDoneButton(ctrlName): ButtonControl
609        String ctrlName
610        DoWindow/K Invariant_Graph
611        DoWindow/K Invariant_Panel
612end
613
614//get the slit height if the data is slit-smeared
615//set the globals as needed
616Function SlitSmearedCheckProc(ctrlName,checked) : CheckBoxControl
617        String ctrlName
618        Variable checked
619
620        NVAR isSlitSmeared=root:invariant:gIsSlitSmeared
621        SVAR fileStr=root:myGlobals:gLastFileName
622       
623        //reset the global to the checkbox state
624        isSlitSmeared = checked         //==0 if the data is not slit smeared
625       
626        if(checked)             //get the smearing info
627                String cleanLastFileName = "root:"+CleanupName(fileStr,0)
628                NVAR dQv=root:invariant:gDqv
629                String tempName = cleanLastFileName+"sq"
630                Wave/Z w=$tempName
631                if(WaveExists(w) && w[0] < 0)
632                        dQv = - w[0]
633                        Print "Data is slit-smeared, dqv = ",w[0]
634                else
635                        DoAlert 0,"Can't find the slit height from the data. Enter the value manually if the data is truly slit-smeared, or uncheck the box."
636                endif
637        endif
638       
639        return(0)
640End
Note: See TracBrowser for help on using the repository browser.