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

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

fixed a few bugs in the transmission panel.

added patching operation for dead time of the back panel

File size: 20.2 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        SVAR newSamList = root:Packages:NIST:VSANS:Globals:Transmission:gSamMatchList
225        newSamList = newList
226       
227        return(newList)
228End
229
230
231Function/S V_getTransListForPopup()
232
233        String retStr = V_getFilePurposeList("TRANSMISSION",0)
234       
235        // now filter through the string to refine the list to only transmission files that match
236        // the open beam file conditions
237        String newList="",item
238        Variable num,ii
239       
240        String openStr
241        ControlInfo popup_2             //the open beam popup
242        openStr = S_Value
243       
244        num=ItemsInList(retStr)
245        for(ii=0;ii<num;ii+=1)
246                item = StringFromList(ii, retStr,";")
247                if(V_Trans_Match_Open(openStr,item))
248                        newList += item + ";"
249                endif
250        endfor
251
252        SVAR newTransList = root:Packages:NIST:VSANS:Globals:Transmission:gTransMatchList
253        newTransList = newList
254       
255        return(newList)
256       
257End
258
259Function V_TEmpBeamPopMenuProc(pa) : PopupMenuControl
260        STRUCT WMPopupAction &pa
261
262        switch( pa.eventCode )
263                case 2: // mouse up
264                        Variable popNum = pa.popNum
265                        String popStr = pa.popStr
266                       
267                        Print "empty beam match at ",popStr
268                        SetVariable setvar_4,value=_STR:V_getSampleDescription(popStr)
269                       
270
271                        WAVE boxCoord = V_getBoxCoordinates(popStr)
272                        Print boxCoord
273                        SetVariable setvar_5,value=_STR:V_NumWave2List(boxCoord,";")
274                       
275                        String detStr = V_getReduction_BoxPanel(popStr)
276                        SetVariable setvar_6,value =_STR:detStr
277                       
278                        PopupMenu popup_1,mode=1,value=V_getTransListForPopup()
279                       
280                        SVAR newBox = root:Packages:NIST:VSANS:Globals:Transmission:gEmptyBoxCoord
281                        newBox = V_NumWave2List(boxCoord,";")
282                       
283                        break
284                case -1: // control being killed
285                        break
286        endswitch
287
288        return 0
289End
290
291
292// NOTE: DIV is not needed for the transmission calculation, since it's a ratio
293// and the DIV simply drops out. (DIV is needed for ABS scaling calculation of Kappa, since
294// that is not a ratio)
295//
296// TODO
297// -- figure out which detector corrections are necessary to do on loading
298// data for calculation. Then set/reset preferences accordingly
299// (see V_isoCorrectButtonProc() for example of how to do this)
300//
301//  -- DIV (turn off)
302// -- NonLinear (turn off ?)
303// -- solid angle (turn off ?)
304// -- dead time (keep on?)
305//
306// -- once calculated, update the Transmission panel
307// -- update the data file
308// -- update the CATALOG (and/or delete the RawVSANS to force a re-read)
309//
310Function V_CalcTransmButtonProc(ba) : ButtonControl
311        STRUCT WMButtonAction &ba
312
313        switch( ba.eventCode )
314                case 2: // mouse up
315                        // click code here
316
317                        String SamFile,TransFile,EmptyFile
318
319                        ControlInfo/W=V_TransmissionPanel popup_0
320                        SamFile = S_Value
321
322                        ControlInfo/W=V_TransmissionPanel popup_1
323                        TransFile = S_Value             
324               
325                        ControlInfo/W=V_TransmissionPanel popup_2
326                        EmptyFile = S_Value
327               
328                        V_CalcOneTransmission(SamFile,TransFile,EmptyFile)                     
329
330                       
331                        // done
332                        break
333                case -1: // control being killed
334                        break
335        endswitch
336
337
338        return 0
339End
340
341Function V_CalcTransmListButtonProc(ba) : ButtonControl
342        STRUCT WMButtonAction &ba
343
344        switch( ba.eventCode )
345                case 2: // mouse up
346                        // click code here
347
348                        SVAR gSamMatchList = root:Packages:NIST:VSANS:Globals:Transmission:gSamMatchList
349
350                        String SamFile,TransFile,EmptyFile
351
352                        ControlInfo/W=V_TransmissionPanel popup_1
353                        TransFile = S_Value             
354               
355                        ControlInfo/W=V_TransmissionPanel popup_2
356                        EmptyFile = S_Value
357               
358                        String list
359                        list = gSamMatchList
360//                      list = list[1,strlen(list)-1]
361//                      list = list[0,strlen(list)-2]
362                       
363                        Variable num,ii
364                        num = ItemsInList(list, ";")
365                        for(ii=0;ii<num;ii+=1)
366                                SamFile = StringFromList(ii, list, ";")
367                               
368                                if(ii==0)
369                                        // calculate the transmission for the first file
370                                        V_CalcOneTransmission(SamFile,TransFile,EmptyFile)     
371                                else
372                                        // then just write in the values (globals) that V_CalcOne determined
373                                        NVAR gTrans = root:Packages:NIST:VSANS:Globals:Transmission:gTrans
374                                        NVAR gTransErr = root:Packages:NIST:VSANS:Globals:Transmission:gTransErr
375                                       
376                                        // write both out to the sample *scattering* file on disk
377                                        V_writeSampleTransmission(SamFile,gTrans)
378                                        V_writeSampleTransError(SamFile,gTransErr)     
379
380                                endif           
381                        endfor
382                       
383                        Print "Done Processing Transmission List"
384
385                        // done
386                        break
387                case -1: // control being killed
388                        break
389        endswitch
390
391
392        return 0
393End
394
395
396
397Function V_CalcOneTransmission(SamFileName,TransFileName,EmptyFileName)                 
398        String SamFileName,TransFileName,EmptyFileName
399
400                Variable trans,trans_err
401                Variable emptyCts,empty_ct_err,samCts,sam_ct_err
402                String detStr
403               
404               
405                // save preferences for file loading
406                Variable savDivPref,savSAPref
407                NVAR gDoDIVCor = root:Packages:NIST:VSANS:Globals:gDoDIVCor
408                savDivPref = gDoDIVCor
409                NVAR gDoSolidAngleCor = root:Packages:NIST:VSANS:Globals:gDoSolidAngleCor
410                savSAPref = gDoSolidAngleCor
411               
412                // set local preferences
413                gDoDIVCor = 0
414                gDoSolidAngleCor = 0
415               
416                // check for sample transmission + error
417                // if present -- exit
418               
419                trans = V_getSampleTransmission(samfileName)
420                trans_err = V_getSampleTransError(samfileName)
421//                      // TODO
422//                      // -- this criteria is rather crude. think it through better
423//                      // -- or should I simply let it overwrite? What is the harm in that?
424//                      if(trans != 0 && trans < 1 && trans_err != 0)
425//                              Printf "Sample transmission, error = %g +/- %g   already exists, nothing calculated\r",trans,trans_err
426//                              break
427//                      endif
428               
429        // for empty beam               
430                emptyCts = V_getBoxCounts(emptyFileName)
431                empty_ct_err = V_getBoxCountsError(emptyFileName)
432                WAVE xyBoxW = V_getBoxCoordinates(emptyFileName)
433                // TODO
434                // x- need to get the panel string for the sum.
435                // x- the detector string is currently hard-wired
436                detStr = V_getReduction_BoxPanel(emptyFileName)
437               
438                SVAR gEmptyPanel = root:Packages:NIST:VSANS:Globals:Transmission:gEmptyPanel
439                gEmptyPanel = detStr
440
441               
442                // check for box count + error values
443                // if present, proceed
444                // TODO
445                // -- this criteria is rather crude. think it through better
446                if(emptyCts > 1 && empty_ct_err != 0)
447                        Printf "Empty beam box counts, error = %g +/- %g   already exists, box counts not re-calculated\r",emptyCts,empty_ct_err
448                       
449                else
450                        // else the counts have not been determined
451                        // read in the data file
452                        V_LoadAndPlotRAW_wName(emptyFileName)
453                        // convert raw->SAM
454                        V_Raw_to_work("SAM")
455                        V_UpdateDisplayInformation("SAM")       
456                       
457                        // and determine box sum and error
458                        // store these locally
459                        emptyCts = V_SumCountsInBox(xyBoxW[0],xyBoxW[1],xyBoxW[2],xyBoxW[3],empty_ct_err,"SAM",detStr)
460       
461                        Print "empty counts = ",emptyCts
462                        Print "empty err/counts = ",empty_ct_err/emptyCts
463                       
464                        // TODO
465                        // write these back to the file
466                        // (write locally?)
467                       
468                endif
469
470        // for Sample Transmission File
471               
472                // check for box count + error values
473                samCts = V_getBoxCounts(TransFileName)
474                sam_ct_err = V_getBoxCountsError(TransFileName)
475                // if present, proceed
476                // TODO
477                // -- this criteria is rather crude. think it through better
478                if(samCts > 1 && sam_ct_err != 0)
479                        Printf "Sam Trans box counts, error = %g +/- %g   already exists, nothing calculated\r",samCts,sam_ct_err
480                       
481                else
482                        // else
483                        // read in the data file
484                        V_LoadAndPlotRAW_wName(TransFileName)
485                        // convert raw->SAM
486                        V_Raw_to_work("SAM")
487                        V_UpdateDisplayInformation("SAM")       
488                       
489                        // get the box coordinates
490                        // and determine box sum and error
491                       
492                        // store these locally
493                        samCts = V_SumCountsInBox(xyBoxW[0],xyBoxW[1],xyBoxW[2],xyBoxW[3],sam_ct_err,"SAM",detStr)
494       
495                        Print "sam counts = ",samCts
496                        Print "sam err/counts = ",sam_ct_err/samCts
497                       
498                        // TODO
499                        // write these back to the file
500                        // (write locally?)     
501                endif
502               
503        //then calculate the transmission
504                Variable empAttenFactor,emp_atten_err,samAttenFactor,sam_atten_err,attenRatio
505               
506                // get the attenuation factor for the empty beam
507                empAttenFactor = V_getAttenuator_transmission(emptyFileName)
508                emp_atten_err = V_getAttenuator_trans_err(emptyFileName)
509                // get the attenuation factor for the sample transmission
510                samAttenFactor = V_getAttenuator_transmission(TransFileName)
511                sam_atten_err = V_getAttenuator_trans_err(TransFileName)       
512                AttenRatio = empAttenFactor/samAttenFactor             
513                // calculate the transmission
514                // calculate the transmission error
515                trans = samCts/emptyCts * AttenRatio
516                                       
517                // squared, relative error
518                if(AttenRatio == 1)
519                        trans_err = (sam_ct_err/samCts)^2 + (empty_ct_err/emptyCts)^2           //same atten, att_err drops out
520                else
521                        trans_err = (sam_ct_err/samCts)^2 + (empty_ct_err/emptyCts)^2 + (sam_atten_err/samAttenFactor)^2 + (emp_atten_err/empAttenFactor)^2
522                endif
523                trans_err = sqrt(trans_err)
524                trans_err *= trans              // now, one std deviation
525               
526                //write out counts and transmission to history window, showing the attenuator ratio, if it is not unity
527                If(attenRatio==1)
528                        Printf "%s\t\tTrans Counts = %g\tTrans = %g +/- %g\r",SamFileName, samCts,trans,trans_err
529                else
530                        Printf "%s\t\tTrans Counts = %g\tTrans = %g +/- %g\tAttenuatorRatio = %g\r",SamFileName, samCts,trans,trans_err,attenRatio
531                endif
532               
533                // write both out to the sample *scattering* file on disk
534                V_writeSampleTransmission(SamFileName,trans)
535                V_writeSampleTransError(SamFileName,trans_err) 
536               
537                // (DONE)
538                // x- update the value displayed in the panel
539                // (NO) update the local value in the file catalog
540                // x- delete the file from RawVSANS to force a re-read?
541                NVAR gTrans = root:Packages:NIST:VSANS:Globals:Transmission:gTrans
542                gTrans = trans
543                NVAR gTransErr = root:Packages:NIST:VSANS:Globals:Transmission:gTransErr
544                gTransErr = trans_err
545
546                V_KillNamedDataFolder(V_RemoveDotExtension(samFileName))
547
548        // restore preferences on exit
549        gDoDIVCor = savDivPref
550        gDoSolidAngleCor = savSAPref
551
552        return(0)                       
553
554End
555
556
557
558
559
560
561
562Function V_WriteTransmButtonProc(ba) : ButtonControl
563        STRUCT WMButtonAction &ba
564
565        switch( ba.eventCode )
566                case 2: // mouse up
567                        // click code here
568                        break
569                case -1: // control being killed
570                        break
571        endswitch
572
573        return 0
574End
575
576Function V_HelpTransmButtonProc(ba) : ButtonControl
577        STRUCT WMButtonAction &ba
578
579        switch( ba.eventCode )
580                case 2: // mouse up
581                        // click code here
582                       
583                        DoAlert 0,"Transmission Help not written yet"
584                       
585                        break
586                case -1: // control being killed
587                        break
588        endswitch
589
590        return 0
591End
592
593Function V_DoneTransmButtonProc(ba) : ButtonControl
594        STRUCT WMButtonAction &ba
595
596        switch( ba.eventCode )
597                case 2: // mouse up
598                        // click code here
599                        DoWindow/K V_TransmissionPanel
600                        break
601                case -1: // control being killed
602                        break
603        endswitch
604
605        return 0
606End
607
Note: See TracBrowser for help on using the repository browser.