source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Transmission.ipf @ 1097

Last change on this file since 1097 was 1097, checked in by srkline, 5 years ago

added procedures to compare files to see if they are from the same configuration, same wavelength, etc. so they can be properly chosen for transmission files, scattering files, and properly identified for the different resolution conditions.

Re-worked the logic of dispatching averaging, plotting, and saving in Execute_Protocol. Hopefully this will alow for easier dispatching for future conditions, including getting the correct resolution calculation.

File size: 19.9 KB
Line 
1#pragma TextEncoding = "MacRoman"
2#pragma rtGlobals=3             // Use modern global access method and strict wave access.
3
4
5
6// TODO
7// x- initialization
8// x- link to main panel
9//
10// ?? redesign the panel based on the CATALOG?
11// -- refresh the catalog, then work with those waves?
12//
13// -- this still seems to be very awkward to use. Come up with something better
14//
15// -- need more checks - be sure that the files match
16// -- SDD, wavelength, beam on proper panel, etc.
17//
18// -- need popups (transmission, open) to respond to popup changes and
19//   update their fields, since they may be auto-located incorrectly.
20//
21// to patch the box coordinates
22// err = V_writeBoxCoordinates(fname,V_List2NumWave(str,";","inW"))
23
24
25
26//
27Function V_InitTransmissionPanel()
28       
29        DoWindow/F V_TransmissionPanel
30        if(V_Flag == 0)
31                V_InitTransPanelGlobals()
32                Execute "V_TransmissionPanel()"
33        endif
34End
35
36Function V_InitTransPanelGlobals()
37
38// root:Packages:NIST:VSANS:Globals:Transmission
39        NewDataFolder/O/S root:Packages:NIST:VSANS:Globals:Transmission
40        Variable/G gSamGrpID,gTrnGrpID,gTrans,gTransErr
41        String/G gSamLabel="file label",gTransLabel="file label",gEmptyLabel="file label"
42        String/G gEmptyBoxCoord="1;2;3;4;",gEmptyPanel="ENTER PANEL"
43        String/G gSamMatchList = "_none_"
44        String/G gTransMatchList = "_none_"
45
46
47        SetDataFolder root:
48        return(0)
49End
50
51Window V_TransmissionPanel() : Panel
52        PauseUpdate; Silent 1           // building window...
53        NewPanel /W=(1496,366,1974,990) /K=1
54        ModifyPanel cbRGB=(32896,16448,0,19621)
55        DoWindow/C V_TransmissionPanel
56
57//      ShowTools/A
58        PopupMenu popup_0,pos={16.00,359.00},size={104.00,23.00},fstyle=1,fsize=12,proc=V_TSamFilePopMenuProc,title="Sample"
59        PopupMenu popup_0,mode=1,popvalue="_none_",value= #"root:Packages:NIST:VSANS:Globals:Transmission:gSamMatchList"
60        PopupMenu popup_1,pos={12.00,229.00},size={195.00,23.00},fstyle=1,fsize=12,proc=V_TTransmFilePopMenuProc,title="Transmission"
61        PopupMenu popup_1,mode=1,popvalue="_none_",value = #"root:Packages:NIST:VSANS:Globals:Transmission:gTransMatchList"//value= V_getFilePurposeList("TRANSMISSION",0)
62        PopupMenu popup_2,pos={17.00,79.00},size={188.00,23.00},fstyle=1,fsize=12,proc=V_TEmpBeamPopMenuProc,title="Open Beam"
63        PopupMenu popup_2,mode=1,popvalue="sans1.nxs.ngv",value= V_getFileIntentList("OPEN BEAM",0)
64        Button button_0,pos={34.00,499.00},size={100.00,20.00},proc=V_CalcTransmButtonProc,title="Calculate"
65        Button button_2,pos={349.00,13.00},size={30.00,20.00},proc=V_HelpTransmButtonProc,title="?"
66        Button button_3,pos={410.00,13.00},size={50.00,20.00},proc=V_DoneTransmButtonProc,title="Done"
67        Button button_4,pos={164.00,500.00},size={150.00,20.00},proc=V_CalcTransmListButtonProc,title="Calculate All In Popup"
68        SetVariable setvar_0,pos={18.00,390.00},size={300.00,14.00},title="Label:"
69        SetVariable setvar_0,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gSamLabel
70        SetVariable setvar_1,pos={18.00,417.00},size={300.00,14.00},title="Group ID:"
71        SetVariable setvar_1,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gSamGrpID
72        SetVariable setvar_2,pos={15.00,257.00},size={300.00,14.00},title="Label:"
73        SetVariable setvar_2,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTransLabel
74        SetVariable setvar_3,pos={14.00,283.00},size={300.00,14.00},title="Group ID:"
75        SetVariable setvar_3,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTrnGrpID
76        SetVariable setvar_4,pos={18.00,108.00},size={300.00,14.00},title="Label:"
77        SetVariable setvar_4,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gEmptyLabel
78        SetVariable setvar_5,pos={18.00,132.00},size={300.00,14.00},title="XY Box:"
79        SetVariable setvar_5,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gEmptyBoxCoord
80        SetVariable setvar_6,pos={18.00,157.00},size={300.00,14.00},fstyle=1,fsize=12,title="Panel:"
81        SetVariable setvar_6,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gEmptyPanel
82        SetVariable setvar_7,pos={18.00,442.00},size={300.00,14.00},title="Transmission:"
83        SetVariable setvar_7,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTrans
84        SetVariable setvar_8,pos={18.00,467.00},size={300.00,14.00},title="Error:"
85        SetVariable setvar_8,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTransErr
86EndMacro
87
88
89//Window V_TransmissionPanel() : Panel
90//      PauseUpdate; Silent 1           // building window...
91//      NewPanel /W=(1286,328,1764,952)
92//      ModifyPanel cbRGB=(32896,16448,0,19621)
93//      DoWindow/C V_TransmissionPanel
94//
95////    ShowTools/A
96//      PopupMenu popup_0,pos={19.00,55.00},size={86.00,23.00},proc=V_TSamFilePopMenuProc,title="Sample"
97////    PopupMenu popup_0,mode=1,value= V_getFilePurposeList("SCATTERING",0)//+V_getFileIntentList("EMPTY CELL",0)
98//      PopupMenu popup_0,mode=1,value=root:Packages:NIST:VSANS:Globals:Transmission:gSamMatchList
99//      PopupMenu popup_1,pos={102,248},size={72.00,23.00},proc=V_TTransmFilePopMenuProc,title="Transmission"
100//      PopupMenu popup_1,mode=1,value= V_getFilePurposeList("TRANSMISSION",0)
101//      PopupMenu popup_2,pos={164,353},size={72.00,23.00},proc=V_TEmpBeamPopMenuProc,title="Open Beam"
102////    PopupMenu popup_2,mode=1,value= V_getFileIntentList("EMPTY BEAM",0)
103//      PopupMenu popup_2,mode=1,value= V_getFileIntentList("OPEN BEAM",0)
104//      Button button_0,pos={37,193},size={100.00,20.00},proc=V_CalcTransmButtonProc,title="Calculate"
105////    Button button_1,pos={23.00,491.00},size={100.00,20.00},proc=V_WriteTransmButtonProc,title="Write"
106//      Button button_2,pos={349.00,13.00},size={30.00,20.00},proc=V_HelpTransmButtonProc,title="?"
107//      Button button_3,pos={410.00,13.00},size={50.00,20.00},proc=V_DoneTransmButtonProc,title="Done"
108//      SetVariable setvar_0,pos={21.00,86.00},size={300.00,14.00},title="Label:"
109//      SetVariable setvar_0,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gSamLabel
110//      SetVariable setvar_1,pos={21.00,113.00},size={300.00,14.00},title="Group ID:"
111//      SetVariable setvar_1,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gSamGrpID
112//      SetVariable setvar_2,pos={105,276.00},size={300.00,14.00},title="Label:"
113//      SetVariable setvar_2,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTransLabel
114//      SetVariable setvar_3,pos={104,302},size={300.00,14.00},title="Group ID:"
115//      SetVariable setvar_3,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTrnGrpID
116//      SetVariable setvar_4,pos={165,382},size={300.00,14.00},title="Label:"
117//      SetVariable setvar_4,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gEmptyLabel
118//      SetVariable setvar_5,pos={165,406},size={300.00,14.00},title="XY Box:"
119//      SetVariable setvar_5,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gEmptyBoxCoord
120//      SetVariable setvar_6,pos={165,431},size={300.00,14.00},title="Panel:"
121//      SetVariable setvar_6,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gEmptyPanel
122//      SetVariable setvar_7,pos={21,138},size={300.00,14.00},title="Transmission:"
123//      SetVariable setvar_7,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTrans
124//      SetVariable setvar_8,pos={21,163},size={300.00,14.00},title="Error:"
125//      SetVariable setvar_8,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTransErr
126//EndMacro
127
128// TODO
129// -- fill in the details
130// -- currently, I pick these from the Catalog, for speed
131// -- ? is the catalog current?
132// -- T error is not part of the Catalog - is that OK?
133//
134// when the SAM file menu is popped:
135//  fill in the fields:
136// x- label
137// x- group id
138// x- transmission
139// -- T error
140//
141Function V_TSamFilePopMenuProc(pa) : PopupMenuControl
142        STRUCT WMPopupAction &pa
143
144
145// **** TODO
146// short-circuit the switch, and simply report the values
147// -- the TransFile popup now drives the panel
148                SVAR gSamLabel = root:Packages:NIST:VSANS:Globals:Transmission:gSamLabel
149                gSamLabel = V_getSampleDescription(pa.popStr)
150                NVAR gSamGrpID = root:Packages:NIST:VSANS:Globals:Transmission:gSamGrpID
151                gSamGrpID = V_getSample_GroupID(pa.popStr)
152                NVAR gTrans = root:Packages:NIST:VSANS:Globals:Transmission:gTrans
153                gTrans = V_getSampleTransmission(pa.popStr)
154                NVAR gTransErr = root:Packages:NIST:VSANS:Globals:Transmission:gTransErr
155                gTransErr = V_getSampleTransError(pa.popStr)
156
157        return(0)       
158       
159End
160
161// TODO
162//
163// Given the group ID of the sample, try to locate a (the) matching transmission file
164// by locating a matching ID in the list of transmission (intent) files
165//
166// then pop the menu
167//
168//
169Function V_TTransmFilePopMenuProc(pa) : PopupMenuControl
170        STRUCT WMPopupAction &pa
171
172        switch( pa.eventCode )
173                case 2: // mouse up
174                        Variable popNum = pa.popNum
175                        String popStr = pa.popStr
176                       
177                        SVAR gTransLabel = root:Packages:NIST:VSANS:Globals:Transmission:gTransLabel
178                        gTransLabel = V_getSampleDescription(popStr)
179                        NVAR gTrnGrpID = root:Packages:NIST:VSANS:Globals:Transmission:gTrnGrpID
180                        gTrnGrpID = V_getSample_GroupID(popStr)                 
181                       
182//                      SVAR gSamMatchList = root:Packages:NIST:VSANS:Globals:Transmission:gSamMatchList
183//                      String quote = "\""
184//                      gSamMatchList = quote + V_getFileIntentPurposeIDList("SAMPLE","SCATTERING",gTrnGrpID,0) + quote
185                        // this resets a global string, since I can't pass a parameter (only constants) in value=fn()           
186//                      PopupMenu popup_0,mode=1,value=#gSamMatchList
187                        PopupMenu popup_0,mode=1,value=V_getSamListForPopup()
188                       
189                        break
190                case -1: // control being killed
191                        break
192        endswitch
193
194        return 0
195End
196
197Function/S V_getSamListForPopup()
198
199//      String quote = "\""
200        NVAR gTrnGrpID = root:Packages:NIST:VSANS:Globals:Transmission:gTrnGrpID
201
202        String retStr = V_getFileIntentPurposeIDList("SAMPLE","SCATTERING",gTrnGrpID,0)
203
204// and be sure to add in the empty cell, since it's not a "sample"
205        retStr += V_getFileIntentPurposeIDList("EMPTY CELL","SCATTERING",gTrnGrpID,0)
206
207        // now filter through the string to refine the list to only scattering files that match
208        // the transmission file conditions
209        String newList="",item
210        Variable num,ii
211       
212        String transStr
213        ControlInfo popup_1                     //the transmission file popup
214        transStr = S_Value
215       
216        num=ItemsInList(retStr)
217        for(ii=0;ii<num;ii+=1)
218                item = StringFromList(ii, retStr,";")
219                if(V_Scatter_Match_Trans(transStr,item))
220                        newList += item + ";"
221                endif
222        endfor
223
224        return(newList)
225End
226
227
228Function/S V_getTransListForPopup()
229
230        String retStr = V_getFilePurposeList("TRANSMISSION",0)
231       
232        // now filter through the string to refine the list to only transmission files that match
233        // the open beam file conditions
234        String newList="",item
235        Variable num,ii
236       
237        String openStr
238        ControlInfo popup_2             //the open beam popup
239        openStr = S_Value
240       
241        num=ItemsInList(retStr)
242        for(ii=0;ii<num;ii+=1)
243                item = StringFromList(ii, retStr,";")
244                if(V_Trans_Match_Open(openStr,item))
245                        newList += item + ";"
246                endif
247        endfor
248
249        return(newList)
250       
251End
252
253Function V_TEmpBeamPopMenuProc(pa) : PopupMenuControl
254        STRUCT WMPopupAction &pa
255
256        switch( pa.eventCode )
257                case 2: // mouse up
258                        Variable popNum = pa.popNum
259                        String popStr = pa.popStr
260                       
261                        Print "empty beam match at ",popStr
262                        SetVariable setvar_4,value=_STR:V_getSampleDescription(popStr)
263                       
264
265                        WAVE boxCoord = V_getBoxCoordinates(popStr)
266                        Print boxCoord
267                        SetVariable setvar_5,value=_STR:V_NumWave2List(boxCoord,";")
268                       
269                        String detStr = V_getReduction_BoxPanel(popStr)
270                        SetVariable setvar_6,value =_STR:detStr
271                       
272                        PopupMenu popup_1,mode=1,value=V_getTransListForPopup()
273                       
274                        break
275                case -1: // control being killed
276                        break
277        endswitch
278
279        return 0
280End
281
282
283// NOTE: DIV is not needed for the transmission calculation, since it's a ratio
284// and the DIV simply drops out. (DIV is needed for ABS scaling calculation of Kappa, since
285// that is not a ratio)
286//
287// TODO
288// -- figure out which detector corrections are necessary to do on loading
289// data for calculation. Then set/reset preferences accordingly
290// (see V_isoCorrectButtonProc() for example of how to do this)
291//
292//  -- DIV (turn off)
293// -- NonLinear (turn off ?)
294// -- solid angle (turn off ?)
295// -- dead time (keep on?)
296//
297// -- once calculated, update the Transmission panel
298// -- update the data file
299// -- update the CATALOG (and/or delete the RawVSANS to force a re-read)
300//
301Function V_CalcTransmButtonProc(ba) : ButtonControl
302        STRUCT WMButtonAction &ba
303
304        switch( ba.eventCode )
305                case 2: // mouse up
306                        // click code here
307
308                        String SamFile,TransFile,EmptyFile
309
310                        ControlInfo/W=V_TransmissionPanel popup_0
311                        SamFile = S_Value
312
313                        ControlInfo/W=V_TransmissionPanel popup_1
314                        TransFile = S_Value             
315               
316                        ControlInfo/W=V_TransmissionPanel popup_2
317                        EmptyFile = S_Value
318               
319                        V_CalcOneTransmission(SamFile,TransFile,EmptyFile)                     
320
321                       
322                        // done
323                        break
324                case -1: // control being killed
325                        break
326        endswitch
327
328
329        return 0
330End
331
332Function V_CalcTransmListButtonProc(ba) : ButtonControl
333        STRUCT WMButtonAction &ba
334
335        switch( ba.eventCode )
336                case 2: // mouse up
337                        // click code here
338
339                        SVAR gSamMatchList = root:Packages:NIST:VSANS:Globals:Transmission:gSamMatchList
340
341                        String SamFile,TransFile,EmptyFile
342
343                        ControlInfo/W=V_TransmissionPanel popup_1
344                        TransFile = S_Value             
345               
346                        ControlInfo/W=V_TransmissionPanel popup_2
347                        EmptyFile = S_Value
348               
349                        // gSamMatchStr has " at each end. remove these
350                        String list
351                        list = gSamMatchList
352                        list = list[1,strlen(list)-1]
353                        list = list[0,strlen(list)-2]
354                       
355                        Variable num,ii
356                        num = ItemsInList(list, ";")
357                        for(ii=0;ii<num;ii+=1)
358                                SamFile = StringFromList(ii, list, ";")
359                               
360                                if(ii==0)
361                                        // calculate the transmission for the first file
362                                        V_CalcOneTransmission(SamFile,TransFile,EmptyFile)     
363                                else
364                                        // then just write in the values (globals) that V_CalcOne determined
365                                        NVAR gTrans = root:Packages:NIST:VSANS:Globals:Transmission:gTrans
366                                        NVAR gTransErr = root:Packages:NIST:VSANS:Globals:Transmission:gTransErr
367                                       
368                                        // write both out to the sample *scattering* file on disk
369                                        V_writeSampleTransmission(SamFile,gTrans)
370                                        V_writeSampleTransError(SamFile,gTransErr)     
371
372                                endif           
373                        endfor
374                       
375                        Print "Done Processing Transmission List"
376
377                        // done
378                        break
379                case -1: // control being killed
380                        break
381        endswitch
382
383
384        return 0
385End
386
387
388
389Function V_CalcOneTransmission(SamFileName,TransFileName,EmptyFileName)                 
390        String SamFileName,TransFileName,EmptyFileName
391
392                Variable trans,trans_err
393                Variable emptyCts,empty_ct_err,samCts,sam_ct_err
394                String detStr
395               
396               
397                // save preferences for file loading
398                Variable savDivPref,savSAPref
399                NVAR gDoDIVCor = root:Packages:NIST:VSANS:Globals:gDoDIVCor
400                savDivPref = gDoDIVCor
401                NVAR gDoSolidAngleCor = root:Packages:NIST:VSANS:Globals:gDoSolidAngleCor
402                savSAPref = gDoSolidAngleCor
403               
404                // set local preferences
405                gDoDIVCor = 0
406                gDoSolidAngleCor = 0
407               
408                // check for sample transmission + error
409                // if present -- exit
410               
411                trans = V_getSampleTransmission(samfileName)
412                trans_err = V_getSampleTransError(samfileName)
413//                      // TODO
414//                      // -- this criteria is rather crude. think it through better
415//                      // -- or should I simply let it overwrite? What is the harm in that?
416//                      if(trans != 0 && trans < 1 && trans_err != 0)
417//                              Printf "Sample transmission, error = %g +/- %g   already exists, nothing calculated\r",trans,trans_err
418//                              break
419//                      endif
420               
421        // for empty beam               
422                emptyCts = V_getBoxCounts(emptyFileName)
423                empty_ct_err = V_getBoxCountsError(emptyFileName)
424                WAVE xyBoxW = V_getBoxCoordinates(emptyFileName)
425                // TODO
426                // x- need to get the panel string for the sum.
427                // x- the detector string is currently hard-wired
428                detStr = V_getReduction_BoxPanel(emptyFileName)
429               
430                SVAR gEmptyPanel = root:Packages:NIST:VSANS:Globals:Transmission:gEmptyPanel
431                gEmptyPanel = detStr
432
433               
434                // check for box count + error values
435                // if present, proceed
436                // TODO
437                // -- this criteria is rather crude. think it through better
438                if(emptyCts > 1 && empty_ct_err != 0)
439                        Printf "Empty beam box counts, error = %g +/- %g   already exists, box counts not re-calculated\r",emptyCts,empty_ct_err
440                       
441                else
442                        // else the counts have not been determined
443                        // read in the data file
444                        V_LoadAndPlotRAW_wName(emptyFileName)
445                        // convert raw->SAM
446                        V_Raw_to_work("SAM")
447                        V_UpdateDisplayInformation("SAM")       
448                       
449                        // and determine box sum and error
450                        // store these locally
451                        emptyCts = V_SumCountsInBox(xyBoxW[0],xyBoxW[1],xyBoxW[2],xyBoxW[3],empty_ct_err,"SAM",detStr)
452       
453                        Print "empty counts = ",emptyCts
454                        Print "empty err/counts = ",empty_ct_err/emptyCts
455                       
456                        // TODO
457                        // write these back to the file
458                        // (write locally?)
459                       
460                endif
461
462        // for Sample Transmission File
463               
464                // check for box count + error values
465                samCts = V_getBoxCounts(TransFileName)
466                sam_ct_err = V_getBoxCountsError(TransFileName)
467                // if present, proceed
468                // TODO
469                // -- this criteria is rather crude. think it through better
470                if(samCts > 1 && sam_ct_err != 0)
471                        Printf "Sam Trans box counts, error = %g +/- %g   already exists, nothing calculated\r",samCts,sam_ct_err
472                       
473                else
474                        // else
475                        // read in the data file
476                        V_LoadAndPlotRAW_wName(TransFileName)
477                        // convert raw->SAM
478                        V_Raw_to_work("SAM")
479                        V_UpdateDisplayInformation("SAM")       
480                       
481                        // get the box coordinates
482                        // and determine box sum and error
483                       
484                        // store these locally
485                        samCts = V_SumCountsInBox(xyBoxW[0],xyBoxW[1],xyBoxW[2],xyBoxW[3],sam_ct_err,"SAM",detStr)
486       
487                        Print "sam counts = ",samCts
488                        Print "sam err/counts = ",sam_ct_err/samCts
489                       
490                        // TODO
491                        // write these back to the file
492                        // (write locally?)     
493                endif
494               
495        //then calculate the transmission
496                Variable empAttenFactor,emp_atten_err,samAttenFactor,sam_atten_err,attenRatio
497               
498                // get the attenuation factor for the empty beam
499                empAttenFactor = V_getAttenuator_transmission(emptyFileName)
500                emp_atten_err = V_getAttenuator_trans_err(emptyFileName)
501                // get the attenuation factor for the sample transmission
502                samAttenFactor = V_getAttenuator_transmission(TransFileName)
503                sam_atten_err = V_getAttenuator_trans_err(TransFileName)       
504                AttenRatio = empAttenFactor/samAttenFactor             
505                // calculate the transmission
506                // calculate the transmission error
507                trans = samCts/emptyCts * AttenRatio
508                                       
509                // squared, relative error
510                if(AttenRatio == 1)
511                        trans_err = (sam_ct_err/samCts)^2 + (empty_ct_err/emptyCts)^2           //same atten, att_err drops out
512                else
513                        trans_err = (sam_ct_err/samCts)^2 + (empty_ct_err/emptyCts)^2 + (sam_atten_err/samAttenFactor)^2 + (emp_atten_err/empAttenFactor)^2
514                endif
515                trans_err = sqrt(trans_err)
516                trans_err *= trans              // now, one std deviation
517               
518                //write out counts and transmission to history window, showing the attenuator ratio, if it is not unity
519                If(attenRatio==1)
520                        Printf "%s\t\tTrans Counts = %g\tTrans = %g +/- %g\r",SamFileName, samCts,trans,trans_err
521                else
522                        Printf "%s\t\tTrans Counts = %g\tTrans = %g +/- %g\tAttenuatorRatio = %g\r",SamFileName, samCts,trans,trans_err,attenRatio
523                endif
524               
525                // write both out to the sample *scattering* file on disk
526                V_writeSampleTransmission(SamFileName,trans)
527                V_writeSampleTransError(SamFileName,trans_err) 
528               
529                // (DONE)
530                // x- update the value displayed in the panel
531                // (NO) update the local value in the file catalog
532                // x- delete the file from RawVSANS to force a re-read?
533                NVAR gTrans = root:Packages:NIST:VSANS:Globals:Transmission:gTrans
534                gTrans = trans
535                NVAR gTransErr = root:Packages:NIST:VSANS:Globals:Transmission:gTransErr
536                gTransErr = trans_err
537
538                V_KillNamedDataFolder(V_RemoveDotExtension(samFileName))
539
540        // restore preferences on exit
541        gDoDIVCor = savDivPref
542        gDoSolidAngleCor = savSAPref
543
544        return(0)                       
545
546End
547
548
549
550
551
552
553
554Function V_WriteTransmButtonProc(ba) : ButtonControl
555        STRUCT WMButtonAction &ba
556
557        switch( ba.eventCode )
558                case 2: // mouse up
559                        // click code here
560                        break
561                case -1: // control being killed
562                        break
563        endswitch
564
565        return 0
566End
567
568Function V_HelpTransmButtonProc(ba) : ButtonControl
569        STRUCT WMButtonAction &ba
570
571        switch( ba.eventCode )
572                case 2: // mouse up
573                        // click code here
574                       
575                        DoAlert 0,"Transmission Help not written yet"
576                       
577                        break
578                case -1: // control being killed
579                        break
580        endswitch
581
582        return 0
583End
584
585Function V_DoneTransmButtonProc(ba) : ButtonControl
586        STRUCT WMButtonAction &ba
587
588        switch( ba.eventCode )
589                case 2: // mouse up
590                        // click code here
591                        DoWindow/K V_TransmissionPanel
592                        break
593                case -1: // control being killed
594                        break
595        endswitch
596
597        return 0
598End
599
Note: See TracBrowser for help on using the repository browser.