source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Schematic.ipf @ 665

Last change on this file since 665 was 665, checked in by srkline, 13 years ago

Made preferences a common panel (moved to PlotUtilsMacro?.ipf and globals to root:Packages:NIST:) and added menu items for all packages. Many files had to be modified so that the preferences could be properly accessed

File Open dialog now is set to "All files" so that XML can be selected. I think that all open access that doesn't already have the full path go through this common function.

File size: 19.4 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2#pragma version=5.0
3#pragma IgorVersion=6.1
4
5//***********************
6// Vers. 1.2 092101
7//
8//procedures to display a schematic layout of the data reduction procedure
9//that was used to reduce a given file. useful for diagnosing
10//data reduction problems
11//
12// - due to pixelation differences between Mac/Windows, there are
13// two different procedures, one for each platform.
14//
15//************************
16
17
18//main entry procedure for drawing schematics of the data reduction
19//process - switches on platform, since screen pixels are different
20//on each, and no realiable platform independent method could
21//be found
22//
23Proc ShowSchematic()
24
25        Dowindow/F Schematic_Layout
26        if(V_flag==1)
27                Abort "Please close the existing schematic before creating a new one. Print it out if you want to save it."
28                //DoWindow/K Schematic_Layout
29        endif
30       
31        Variable oldScaling=root:Packages:NIST:gLogScalingAsDefault
32
33        Variable num=getNewScaling()
34        if(num==-99)            //use cancel
35                Abort
36        else
37                root:Packages:NIST:gLogScalingAsDefault=num
38        endif
39       
40        if(cmpstr("Macintosh",IgorInfo(2)) == 0)
41                DrawMacSchematic()
42        else
43                DrawWinSchematic()
44        Endif
45        //reset scaling back to old value
46        root:Packages:NIST:gLogScalingAsDefault=oldScaling
47End
48
49//returns the new color mapping
50//global is not changed by this function
51//
52// returns 0 for linear scaling, 1 for log scaling, -99 for user cancel
53//
54Function getNewScaling()
55
56        String scaleStr="Log"
57        Prompt scaleStr,"Select the color mapping for the 2D data",popup, "Log;Linear"
58        doPrompt "Color Mapping",scaleStr
59       
60        if(V_flag==1)
61                return(-99)
62        else
63                return(cmpstr(scaleStr,"Linear"))       
64        endif
65end
66
67//inStr is a keyword=value string (semicolon delimited)
68//outStr is "stacked" for nice printing, replacing the semicolons
69//with returns
70//
71Function/S StackText(inStr)
72        String inStr
73       
74        String item="",outStr=""
75        Variable ii=0,num=0
76       
77        num = ItemsInList(inStr, ";")
78        do
79                item = StringFromList(ii, inStr, ";")
80                outStr += item
81                outStr += "\r"
82                ii+=1
83        while(ii<num)
84       
85        return outStr
86End
87
88//procedure to draw a schamatic layout on a Macintosh
89//separate prcedure is used for Windows, due to screen pixel differences
90//
91//runs the data reduction on one file (so the files are fresh and correct)
92//and draws the schematic based on what the selected protocol dictates
93//     
94Proc DrawMacSchematic()
95
96        //run data reduction on one file, using a specified protocol
97        ReduceAFile()
98        DoWindow/K SANS_Data            //get the data window out of the way
99       
100        //parse protocol to set PICTs, text, and variables
101        String protocolName = root:myGlobals:Protocols:gProtoStr
102        String waveStr = "root:myGlobals:Protocols:"+protocolName       //full path to the protocol used
103       
104       
105        //set all of the text strings (0-23) that may need to be changed
106        String text2,text3,text5,text7,text22,text21,text11,text20,text23
107       
108        text2 = "Using Protocol: "+protocolName
109        text3 = "Sample file: "+ root:Packages:NIST:SAM:fileList
110        text5 = "T\\BSAM\\M = " + getTransStrFromReals("SAM")   //trans and thickness of the sample
111        text5 += "   d\\BSAM\\M = " + getThickStrFromReals("SAM") + " cm"
112        text7 = "T\\BEMP\\M = " + getTransStrFromReals("EMP")   //transmission of the empty cell
113        //attenuators used in sample measurement
114
115        text23 = "SAM Attenuator = "+GetAttenNumStrFromReals("SAM")
116       
117        text11 = "Final 1-D Dataset"
118        text20 = $waveStr[5]
119        //make KW-string easy to read
120        text20 = StackText(text20)
121       
122        //calculate KAPPA for absolute scaling
123        text21 = $waveStr[4]
124       
125        if(cmpstr(text21,"none")==0)
126                //no absolute scaling
127                text22= "KAPPA = none used"
128        else
129                //get the parameters, and calculate Kappa
130                Variable c2=0,c3=0,c4=1,c5=0
131                c2 = NumberByKey("TSTAND", text21, "=", ";")    //parse the list of values
132                c3 = NumberByKey("DSTAND", text21, "=", ";")
133                c4 = NumberByKey("IZERO", text21, "=", ";")
134                c5 = NumberByKey("XSECT", text21, "=", ";")
135                text22= ""
136                sprintf text22,"KAPPA = %g",1/(c2*c3*c5/c4)
137        Endif
138        text21 = StackText(text21)
139         
140        //draw the textboxes
141        PauseUpdate; Silent 1           // building window...
142        Layout/C=1/W=(5,42,500,600) as "Data Reduction Schematic"
143        DoWindow/C Schematic_Layout
144        Textbox/N=text0/F=0/A=LB/X=10.00/Y=94.49 "SAM"
145        Textbox/N=text1/F=0/A=LB/X=25.27/Y=94.49 "EMP"
146        Textbox/N=text2/F=0/A=LB/X=57.45/Y=93.66 text2
147        Textbox/N=text3/F=0/A=LB/X=57.45/Y=91.18 text3
148        Textbox/N=text4/F=0/A=LB/X=39.82/Y=94.49 "BGD"
149        Textbox/N=text6/F=0/A=LB/X=50.55/Y=76.61 "COR = (SAM - BGD) - (T\\BSAM\\M/T\\BEMP\\M)*(EMP - BGD)"
150        Textbox/N=text5/F=0/A=LB/X=62.00/Y=86.23 text5
151        Textbox/N=text7/F=0/A=LB/X=62.00/Y=83.61 text7
152        Textbox/N=text8/F=0/A=LB/X=47.45/Y=69.01 "CAL = COR / DIV"
153        Textbox/N=text9/F=0/A=LB/X=44.73/Y=52.48 "ABS = [1/(KAPPA*T\\BSAM\\M*d\\BSAM\\M)]*CAL"
154        Textbox/N=text10/F=0/A=LB/X=47.09/Y=37.88 "Masked pixels are excluded\rfrom final1-D file"
155        Textbox/N=text11/F=0/A=LB/X=5.82/Y=9.37 text11
156        Textbox/N=text12/F=0/A=LB/X=10.00/Y=77.41 "COR"
157        Textbox/N=text13/F=0/A=LB/X=25.27/Y=77.41 "DIV"
158        Textbox/N=text14/F=0/A=LB/X=10.00/Y=61.16 "CAL"
159        Textbox/N=text15/F=0/A=LB/X=25.73/Y=61.16 "ABSOLUTE SCALE"
160        Textbox/N=text16/F=0/A=LB/X=9.45/Y=44.49 "ABS"
161        Textbox/N=text17/F=0/A=LB/X=25.82/Y=44.49 "MSK"
162        //set at bottom of proc Textbox/N=text18/F=0/A=LB/X=10.18/Y=27.82 "END"
163        Textbox/N=text19/F=0/A=LB/X=22.00/Y=21.35 "1-D AVERAGE"
164        Textbox/N=text20/F=0/A=LT/X=44/Y=75 text20                      //AVG note "LT" anchor
165        Textbox/N=text21/F=0/A=LT/X=20.73/Y=42 text21                           //ABS par
166        Textbox/N=text22/F=0/A=LB/X=44.73/Y=55 text22           //KAPPA value
167        TextBox/N=text23/F=0/A=LB/X=62.00/Y=80.61 text23
168        //then draw the layout
169        ModifyLayout mag=1, units=1
170        SetDrawLayer UserFront
171        //braces
172        SetDrawEnv gstart
173        DrawLine 50,141,50,162         
174        DrawLine 306,141,306,162
175        DrawLine 50,162,306,162
176        SetDrawEnv arrow= 1
177        DrawLine 153,162,135,180
178        SetDrawEnv gstop
179        SetDrawEnv gstart
180        DrawLine 50,263,50,282
181        DrawLine 224,263,224,282
182        DrawLine 50,282,224,282
183        SetDrawEnv arrow= 1
184        DrawLine 153,282,135,302
185        SetDrawEnv gstop
186        SetDrawEnv gstart
187        DrawLine 50,380,50,402
188        DrawLine 224,380,224,402
189        DrawLine 50,402,224,402
190        SetDrawEnv arrow= 1
191        DrawLine 153,402,135,419
192        SetDrawEnv gstop
193        SetDrawEnv gstart
194        DrawLine 50,501,50,522
195        DrawLine 224,501,224,522
196        DrawLine 50,522,224,522
197        SetDrawEnv arrow= 1
198        DrawLine 153,522,135,540
199        SetDrawEnv gstop
200        SetDrawEnv gstart
201        DrawLine 50,623,50,642
202        DrawLine 224,623,224,642
203        DrawLine 50,642,224,642
204        SetDrawEnv arrow= 1
205        DrawLine 153,642,135,662
206        SetDrawEnv gstop
207        //end of braces
208       
209        //0 = background
210        //1= empty cell
211        //2= div
212        //3=msk
213        //4=ABS
214        //5=averaging
215        String temp = ""
216        Variable draw
217       
218        //place the sample file
219        temp = "SAM exists"
220        draw = SetGraphic("SAM",temp)
221        PlaceGraphic("SAM",draw,60,80,132,152)
222       
223        temp = $waveStr[0]
224        draw = SetGraphic("BGD",temp)
225        PlaceGraphic("BGD",draw,224,80,296,152)
226       
227        temp = $waveStr[1]
228        draw = SetGraphic("EMP",temp)
229        PlaceGraphic("EMP",draw,142,80,214,152)
230       
231        temp = $waveStr[2]
232        draw = SetGraphic("DIV",temp)
233        PlaceGraphic("DIV",draw,142,200,214,272)
234       
235        temp = $waveStr[3]
236        draw = SetGraphic("MSK",temp)
237        Variable maskDraw = 0
238        if (draw == 0)
239           maskDraw = 1
240        endif
241        PlaceGraphic("MSK",draw,142,440,214,512)
242       
243        //need to decide what to do with  COR, CAL, and END file
244        //COR will not be created IFF BGD and EMP are "none"
245        String temp1 = $waveStr[0]
246        String temp2 = $waveStr[1]
247        if( (cmpstr(temp1,"none")==0)  &&  (cmpstr(temp2,"none")==0)  )
248                //both are none, COR was not created
249                temp = "none"
250        else
251                //COR was created
252                temp = "yes, COR exists"
253        Endif
254        draw = SetGraphic("COR",temp)
255        PlaceGraphic("COR",draw,60,200,132,272)
256       
257        //keep track of the "latest" file reduction step"
258        String lastStep = "SAM"
259        if(draw==0)
260                lastStep = "COR"
261        Endif
262       
263        //CAL will not be created if DIV is "none"
264        temp1 = $waveStr[2]
265        if(cmpstr(temp1,"none")==0)
266                //CAL not created
267                temp = "none"
268        else
269                //CAL was created
270                temp = "yes, CAL exists"
271        Endif
272        draw = SetGraphic("CAL",temp)
273        PlaceGraphic("CAL",draw,60,320,132,392  )
274        if(draw==0)
275                lastStep = "CAL"
276        Endif
277       
278        temp = $waveStr[4]
279        draw = SetGraphic("ABS",temp)
280        PlaceGraphic("ABS",draw,60,440,132,512)
281        if(draw==0)
282                lastStep = "ABS"
283        Endif
284       
285        //put the appropriate graphic in the last step 
286        if(maskDraw==1)
287            temp = "MSK overlay"
288            draw = SetGraphic(lastStep,temp)
289            lastStep += "MSK"
290        Endif
291        PlaceGraphic(lastStep,0,60,560,132,632)
292        Textbox/N=text18/F=0/A=LB/X=10.18/Y=27.82 lastStep
293       
294End
295
296
297//input is "type" of data, and what the protocol actually did with
298//data in the "type" folder (either didn't use it, tried but no data was
299//there, or used the data that ws there
300//set the PNG of what is there  (if used), or instruct other graphics to be drawn
301//as placeholders
302//
303//returns 1)=NOT USED, 2)=no data, 0)= PNG graphic is available
304//return value is used by PlaceGraphic() to decide what graphic
305//is actually drawn
306//
307// 080802 - uses the default scaling of the data (log or lin) as the data scaling
308// being sure to re-convert the folder to log scale if needed
309//
310Function SetGraphic(type,choice)
311        String type,choice
312       
313        WAVE NIHColors = $"root:myGlobals:NIHColors"
314        String nameStr = type + "_PNG"
315        if(cmpstr(choice,"none")==0)
316                //none used, protocol did not need data from this folder
317                return (1)
318        else
319                NVAR doLogScaling = root:Packages:NIST:gLogScalingAsDefault
320               
321                wave data = $("root:Packages:NIST:"+type+":data")
322                if(waveExists(data))
323                        PauseUpdate; Silent 1           // building window...
324                        Display /W=(40,40,196,196)
325                        //plot and name the picture, then kill it
326                        AppendImage data
327//                      DoUpdate
328                        DoWindow/C temp_png
329                        //Make the mask look green
330                if(cmpstr(type,"MSK")==0)
331                        //don't convert the scaling of the mask file
332                                ModifyImage data ctab= {0,1,BlueRedGreen,0}
333                        else
334                                //convert the data to log/lin as requested
335                                If(doLogScaling)
336                                        ConvertFolderToLogScale(type)
337                                Else
338                                        ConvertFolderToLinearScale(type)
339                                Endif
340                                WaveStats/Q data
341                                ScaleColorsToData(V_min, V_max, NIHColors)
342                                ModifyImage data cindex=NIHColors
343                endif
344                //If we are working on the last step and overlaying
345                //a mask on it do this
346                        if(cmpstr(choice,"MSK overlay")==0)
347                                nameStr = type+"MSK_PNG"
348                                Duplicate/O root:Packages:NIST:MSK:data root:Packages:NIST:MSK:overlay
349                                Redimension/D root:Packages:NIST:MSK:overlay
350                                String tempStr = "root:Packages:NIST:MSK:overlay"
351                        ResetLoop(tempStr)
352                        AppendImage root:Packages:NIST:MSK:overlay
353                                ModifyImage overlay ctab={0,1,BlueRedGreen,0}
354                endif
355                        //end of overlay
356//                      DoUpdate
357                        ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14
358                        ModifyGraph nticks=4
359                        ModifyGraph minor=1
360                        ModifyGraph fSize=9
361                        ModifyGraph standoff=0
362                        ModifyGraph tkLblRot(left)=90
363                        ModifyGraph btLen=3
364                        ModifyGraph tlOffset=-2
365                        SVAR fileStr = $("root:Packages:NIST:"+type+":fileList")
366                        Textbox/N=text0/F=0/A=MT/X=0.00/Y=0.00/E fileStr
367                       
368// comment out line below for DEMO_MODIFIED version
369                        SavePICT/Z/E=-5 as "Clipboard"          //saves as PNG format
370                       
371                        LoadPICT/O/Q "Clipboard",$nameStr
372                        DoWindow/K temp_png
373                        return(0)
374                else
375                        //data not found, but protocol wanted to use it
376                        return(2)
377                Endif
378        Endif
379End
380
381//places appropriate graphic in the selected location in the layout
382//"draw" specifies the type of graphic to be displayed
383//"type" is the data (folder) type
384//l.r.b.t are the pixel specifications for where (and how large)
385//to draw the graphic
386//
387Proc PlaceGraphic(type,draw,left,top,right,bottom)
388        String type
389        Variable draw,left,top,right,bottom
390       
391        DoWindow/F Schematic_Layout
392        if(draw==0)
393                //graphic has been set, use the PNG of the proper "type"
394                String name = ""
395                sprintf name,"%s_PNG(%d,%d,%d,%d)/O=8",type,left,top,right,bottom
396                AppendToLayout $name
397        else
398                if(draw == 1)
399                        //"not used" graphic
400                        SetDrawEnv gstart
401                        SetDrawEnv fillpat= 0
402                        DrawRect left,top,right,bottom
403                        DrawText (left+23),(top+31),"NOT"
404                        DrawText (left+20),(top+54),"USED"
405                        SetDrawEnv gstop
406                else
407                        //"no data" graphic
408                        SetDrawEnv gstart
409                        SetDrawEnv fillpat= 0
410                        DrawRect left,top,right,bottom
411                        DrawText (left+27),(top+34),"NO"
412                        DrawText (left+18),(top+56),"DATA"
413                        SetDrawEnv gstop
414                Endif
415        Endif
416
417End
418
419//procedure to draw a schamatic layout on Windows
420//separate prcedure is used for Macintosh, due to screen pixel differences
421//
422//runs the data reduction on one file (so the files are fresh and correct)
423//and draws the schematic based on what the selected protocol dictates
424//     
425Proc DrawWinSchematic()
426
427        //run data reduction on one file, using a specified protocol
428        ReduceAFile()
429        DoWindow/K SANS_Data
430       
431        //parse protocol to set PICTs, text, and variables
432        String protocolName = root:myGlobals:Protocols:gProtoStr
433        String waveStr = "root:myGlobals:Protocols:"+protocolName       //full path to the protocol used
434       
435       
436        //set all of the text strings (0-23) that may need to be changed
437        String text2,text3,text5,text7,text22,text21,text11,text20,text23
438       
439        text2 = "Using Protocol: "+protocolName
440        text3 = "Sample file: "+ root:Packages:NIST:SAM:fileList
441        text5 = "T\\BSAM\\M = " + getTransStrFromReals("SAM")   //trans and thickness of the sample
442        text5 += "   d\\BSAM\\M = " + getThickStrFromReals("SAM") + " cm"
443        text7 = "T\\BEMP\\M = " + getTransStrFromReals("EMP")   //transmission of the empty cell
444        //attenuators used in sample measurement
445
446        text23 = "SAM Attenuator = "+GetAttenNumStrFromReals("SAM")
447       
448        text11 = "Final 1-D Dataset"
449        text20 = $waveStr[5]
450        //make KW-string easy to read
451        text20 = StackText(text20)
452       
453        //calculate KAPPA for absolute scaling
454        text21 = $waveStr[4]
455       
456        if(cmpstr(text21,"none")==0)
457                //no absolute scaling
458                text22= "KAPPA = none used"
459        else
460                //get the parameters, and calculate Kappa
461                Variable c2=0,c3=0,c4=1,c5=0
462                c2 = NumberByKey("TSTAND", text21, "=", ";")    //parse the list of values
463                c3 = NumberByKey("DSTAND", text21, "=", ";")
464                c4 = NumberByKey("IZERO", text21, "=", ";")
465                c5 = NumberByKey("XSECT", text21, "=", ";")
466                text22= ""
467                sprintf text22,"KAPPA = %g",1/(c2*c3*c5/c4)
468        Endif
469        text21 = StackText(text21)
470         
471        //draw the textboxes
472        PauseUpdate; Silent 1           // building window...
473        Layout/C=1/W=(5,42,360,460) as "Data Reduction Schematic"
474        DoWindow/C Schematic_Layout
475        Textbox/N=text0/F=0/A=LB/X=9.65/Y=98.03 "SAM"
476        Textbox/N=text1/F=0/A=LB/X=26.69/Y=98.03 "EMP"
477        Textbox/N=text2/F=0/A=LB/X=57.40/Y=93.62 text2
478        Textbox/N=text3/F=0/A=LB/X=57.40/Y=91.18 text3
479        Textbox/N=text4/F=0/A=LB/X=45.02/Y=98.03 "BGD"
480        Textbox/N=text6/F=0/A=LB/X=40.51/Y=79.58 "COR = (SAM - BGD) - (T\\BSAM\\M/T\\BEMP\\M)*(EMP - BGD)"
481        Textbox/N=text5/F=0/A=LB/X=62.06/Y=87.19 text5
482        Textbox/N=text7/F=0/A=LB/X=62.06/Y=84.64 text7
483        Textbox/N=text8/F=0/A=LB/X=47.43/Y=69.03 "CAL = COR / DIV"
484        Textbox/N=text9/F=0/A=LB/X=47.43/Y=52.44 "ABS = [1/(KAPPA*T\\BSAM\\M*d\\BSAM\\M)]*CAL"
485        Textbox/N=text10/F=0/A=LB/X=47.11/Y=37.94 "Masked pixels are excluded\rfrom final1-D file"
486        Textbox/N=text11/F=0/A=LB/X=12.06/Y=6.15 text11
487        Textbox/N=text12/F=0/A=LB/X=9.65/Y=80.63 "COR"
488        Textbox/N=text13/F=0/A=LB/X=27.01/Y=80.74 "DIV"
489        Textbox/N=text14/F=0/A=LB/X=9.65/Y=62.06 "CAL"
490        Textbox/N=text15/F=0/A=LB/X=22.03/Y=62.06 "ABSOLUTE SCALE"
491        Textbox/N=text16/F=0/A=LB/X=9.65/Y=44.55 "ABS"
492        Textbox/N=text17/F=0/A=LB/X=25.88/Y=44.55 "MSK"
493        Textbox/N=text19/F=0/A=LB/X=23.63/Y=21.35 "1-D AVERAGE"
494        Textbox/N=text20/F=0/X=47.75/Y=74.83 text20
495        Textbox/N=text21/F=0/X=22.03/Y=41.07 text21
496        Textbox/N=text22/F=0/A=LB/X=47.11/Y=59.98 text22
497       TextBox/N=text23/F=0/A=LB/X=62.00/Y=82.61 text23
498        //then draw the layout
499        ModifyLayout mag=1, units=1
500        //braces
501        SetDrawLayer UserFront
502        SetDrawEnv gstart
503        DrawLine 84,146.25,84,167.25
504        DrawLine 339,146.25,339,167.25
505        DrawLine 84,167.25,339,167.25
506        SetDrawEnv arrow= 1
507        DrawLine 186,167.25,168,185.25
508        SetDrawEnv gstop
509        SetDrawEnv gstart
510        DrawLine 84,261.875,84,280.875
511        DrawLine 258.125,261.875,258.125,280.875
512        DrawLine 84,280.875,258.125,280.875
513        SetDrawEnv arrow= 1
514        DrawLine 187.125,280.875,169.125,300.875
515        SetDrawEnv gstop
516        SetDrawEnv gstart
517        DrawLine 84,380,84,402
518        DrawLine 260.75,380,260.75,402
519        DrawLine 84,402,260.75,402
520        SetDrawEnv arrow= 1
521        DrawLine 189.75,402,171.75,419
522        SetDrawEnv gstop
523        SetDrawEnv gstart
524        DrawLine 84,501,84,522
525        DrawLine 260.75,501,260.75,522
526        DrawLine 84,522,260.75,522
527        SetDrawEnv arrow= 1
528        DrawLine 189.75,522,171.75,540
529        SetDrawEnv gstop
530        SetDrawEnv gstart
531        DrawLine 84,623,84,642
532        DrawLine 260.75,623,260.75,642
533        DrawLine 84,642,260.75,642
534        SetDrawEnv arrow= 1
535        DrawLine 189.75,642,171.75,662
536        SetDrawEnv gstop
537        //end of braces
538       
539        //0 = background
540        //1= empty cell
541        //2= div
542        //3=msk
543        //4=ABS
544        //5=averaging
545        String temp = ""
546        Variable draw
547       
548        //place the sample file
549        temp = "SAM exists"
550        draw = SetGraphic("SAM",temp)
551        PlaceGraphic("SAM",draw,91.5,88.5,163.5,160.5)
552       
553        temp = $waveStr[0]
554        draw = SetGraphic("BGD",temp)
555        PlaceGraphic("BGD",draw,255,87.75,327,159.75)
556       
557        temp = $waveStr[1]
558        draw = SetGraphic("EMP",temp)
559        PlaceGraphic("EMP",draw,173.25,88.5,245.25,160.5)
560       
561        temp = $waveStr[2]
562        draw = SetGraphic("DIV",temp)
563        PlaceGraphic("DIV",draw,173.25,200.25,245.25,272.25)
564       
565        temp = $waveStr[3]
566        draw = SetGraphic("MSK",temp)
567        Variable maskDraw = 0
568        if (draw == 0)
569                maskDraw = 1
570        endif
571        PlaceGraphic("MSK",draw,177,440.25,249,512.25)
572       
573        //need to decide what to do with  COR, CAL, and END file
574        //COR will not be created IFF BGD and EMP are "none"
575        String temp1 = $waveStr[0]
576        String temp2 = $waveStr[1]
577        if( (cmpstr(temp1,"none")==0)  &&  (cmpstr(temp2,"none")==0)  )
578                //both are none, COR was not created
579                temp = "none"
580        else
581                //COR was created
582                temp = "yes, COR exists"
583        Endif
584        draw = SetGraphic("COR",temp)
585        PlaceGraphic("COR",draw,91.5,200.25,163.5,272.25)
586       
587        //keep track of the "latest" file reduction step"
588        String lastStep = "SAM"
589        if(draw==0)
590                lastStep = "COR"
591        Endif
592       
593        //CAL will not be created if DIV is "none"
594        temp1 = $waveStr[2]
595        if(cmpstr(temp1,"none")==0)
596                //CAL not created
597                temp = "none"
598        else
599                //CAL was created
600                temp = "yes, CAL exists"
601        Endif
602        draw = SetGraphic("CAL",temp)
603        PlaceGraphic("CAL",draw,92.25,320.25,164.25,392.25)
604        if(draw==0)
605                lastStep = "CAL"
606        Endif
607       
608        temp = $waveStr[4]
609        draw = SetGraphic("ABS",temp)
610        PlaceGraphic("ABS",draw,93.75,440.25,165.75,512.25)
611        if(draw==0)
612                lastStep = "ABS"
613        Endif
614       
615        //put the appropriate graphic in the last step 
616        if(maskDraw==1)
617                temp = "MSK overlay"
618                draw = SetGraphic(lastStep,temp)
619                lastStep += "MSK"
620        Endif
621
622        PlaceGraphic(lastStep,0,94.5,560.25,166.5,632.25)
623        Textbox/N=text18/F=0/A=LB/X=9.65/Y=25.52 lastStep
624
625End
626
627
628//returns a string containg the transmision stored in the file that is
629//currently in the "type" folder (not from the binary header)
630//returns "none" if the value (in RealsRead) cannot be found
631//
632Function/S getTransStrFromReals(type)
633        String type
634       
635        String name="root:Packages:NIST:"+type+":realsread"
636        WAVE reals = $name
637        if(waveExists(reals))
638                return(num2str(reals[4]))
639        else
640                return("none")
641        endif   
642End
643
644//returns a string containg the sample thickness stored in the file that is
645//currently in the "type" folder (not from the binary header)
646//returns "none" if the value (in RealsRead) cannot be found
647//
648Function/S getThickStrFromReals(type)
649        String type
650       
651        String name="root:Packages:NIST:"+type+":realsread"
652        WAVE reals = $name
653        if(waveExists(reals))
654                return(num2str(reals[5]))
655        else
656                return("none")
657        endif   
658End
659
660//returns a string containg the sample thickness stored in the file that is
661//currently in the "type" folder (not from the binary header)
662//returns "none" if the value (in RealsRead) cannot be found
663//
664Function/S GetAttenNumStrFromReals(type)
665        String type
666       
667        String name="root:Packages:NIST:"+type+":realsread"
668        WAVE reals = $name
669        if(waveExists(reals))
670                return(num2str(reals[3]))
671        else
672                return("none")
673        endif   
674End
Note: See TracBrowser for help on using the repository browser.