source: sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/Schematic.ipf @ 76

Last change on this file since 76 was 76, checked in by srkline, 15 years ago

2nd pass of pulling out NCNR calls. Also cleared a lot of deadwood from the code, removing depricated functions that were mostly already commented out.

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