- Timestamp:
- Feb 14, 2018 2:44:22 PM (5 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Marquee_Operations.ipf
r1073 r1084 307 307 308 308 End 309 310 311 312 // 313 //function will write new box coordinates to the data file 314 // 315 Function V_UpdateBoxCoords() : GraphMarquee 316 GetMarquee left,bottom 317 if(V_flag == 0) 318 Print "There is no Marquee" 319 else 320 Variable count,x1,x2,y1,y2,ct_err 321 x1 = V_left 322 x2 = V_right 323 y1 = V_bottom 324 y2 = V_top 325 326 // NOTE: 327 // this function MODIFIES x and y values on return, converting them to panel coordinates 328 // detector panel is identified from the (left,top) coordinate (x1,y2) 329 String detStr = V_FindDetStrFromLoc(x1,x2,y1,y2) 330 // 331 SVAR gCurDispType = root:Packages:NIST:VSANS:Globals:gCurDispType 332 string boxStr 333 // this function will modify the x and y values (passed by reference) as needed to keep on the panel 334 V_KeepSelectionInBounds(x1,x2,y1,y2,detStr,gCurDispType) 335 sprintf boxStr,"%d;%d;%d;%d;",x1,x2,y1,y2 336 337 SVAR gCurrentFile = root:Packages:NIST:VSANS:Globals:gLastLoadedFile //for the status of the display 338 339 V_writeBoxCoordinates(gCurrentFile,V_List2NumWave(boxStr,";","inW")) 340 341 // count = V_SumCountsInBox(x1,x2,y1,y2,ct_err,gCurDispType,detStr) 342 // Print "counts = ",count 343 // Print "err/counts = ",ct_err/count 344 345 endif 346 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_PatchFiles.ipf
r1083 r1084 1569 1569 1570 1570 Make/O/D/N=48 deadTimeWave 1571 Variable/G gFileNum_Lo,gFileNum_Hi 1571 1572 1572 1573 SetDataFolder root: … … 1611 1612 1612 1613 SetVariable setvar0,pos={20,141},size={100.00,14.00},title="first" 1613 SetVariable setvar0,value= K01614 SetVariable setvar0,value= root:Packages:NIST:VSANS:Globals:Patch:gFileNum_Lo 1614 1615 SetVariable setvar1,pos={20.00,167},size={100.00,14.00},title="last" 1615 SetVariable setvar1,value= K11616 SetVariable setvar1,value= root:Packages:NIST:VSANS:Globals:Patch:gFileNum_Hi 1616 1617 1617 1618 … … 1872 1873 Make/O/D/N=(3,48) calibrationWave 1873 1874 1875 Variable/G gFileNum_Lo,gFileNum_Hi 1874 1876 SetDataFolder root: 1875 1877 … … 1914 1916 1915 1917 SetVariable setvar0,pos={20,141},size={100.00,14.00},title="first" 1916 SetVariable setvar0,value= K01918 SetVariable setvar0,value= root:Packages:NIST:VSANS:Globals:Patch:gFileNum_Lo 1917 1919 SetVariable setvar1,pos={20.00,167},size={100.00,14.00},title="last" 1918 SetVariable setvar1,value= K11920 SetVariable setvar1,value= root:Packages:NIST:VSANS:Globals:Patch:gFileNum_Hi 1919 1921 1920 1922 … … 2013 2015 // V_writeDet_cal_y(filename,"B",tmpCalib) 2014 2016 // 2017 // "Perfect" values here are from Phil (2/2018) 2018 // 2015 2019 Function V_GeneratePerfCalibButton(ba) : ButtonControl 2016 2020 STRUCT WMButtonAction &ba … … 2028 2032 case "ML": 2029 2033 // // for the "tall" L/R banks 2030 calibrationWave[0][] = -5 122031 calibrationWave[1][] = 8 2034 calibrationWave[0][] = -521 2035 calibrationWave[1][] = 8.14 2032 2036 calibrationWave[2][] = 0 2033 2037 break … … 2037 2041 case "MB": 2038 2042 // // for the "short" T/B banks 2039 calibrationWave[0][] = -2 562040 calibrationWave[1][] = 4 2043 calibrationWave[0][] = -266 2044 calibrationWave[1][] = 4.16 2041 2045 calibrationWave[2][] = 0 2042 2046 … … 2228 2232 Make/O/T/N=9 panelW 2229 2233 2234 Variable/G gFileNum_Lo,gFileNum_Hi 2235 2230 2236 SetDataFolder root: 2231 2237 … … 2262 2268 Button button0_1,pos={20,220},size={50.00,20.00},proc=V_WriteXYButtonProc,title="Write" 2263 2269 SetVariable setvar0,pos={20,141},size={100.00,14.00},title="first" 2264 SetVariable setvar0,value= K02270 SetVariable setvar0,value= root:Packages:NIST:VSANS:Globals:Patch:gFileNum_Lo 2265 2271 SetVariable setvar1,pos={20.00,167},size={100.00,14.00},title="last" 2266 SetVariable setvar1,value= K12272 SetVariable setvar1,value= root:Packages:NIST:VSANS:Globals:Patch:gFileNum_Hi 2267 2273 2268 2274 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Protocol_Reduction.ipf
r1079 r1084 736 736 String path = S_path 737 737 738 String match=" EMPTYBEAM"738 String match="OPEN BEAM" 739 739 740 740 // get the list from the file catalog (=0.0007s) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Transmission.ipf
r1083 r1084 5 5 6 6 // TODO 7 // -- initialization7 // x- initialization 8 8 // x- link to main panel 9 9 // … … 19 19 // update their fields, since they may be auto-located incorrectly. 20 20 // 21 22 // TODO 23 // -- currently, the initialization does nothing. 21 // to patch the box coordinates 22 // err = V_writeBoxCoordinates(fname,V_List2NumWave(str,";","inW")) 23 24 25 26 // 24 27 Function V_InitTransmissionPanel() 25 28 26 29 DoWindow/F V_TransmissionPanel 27 30 if(V_Flag == 0) 31 V_InitTransPanelGlobals() 28 32 Execute "V_TransmissionPanel()" 29 33 endif 30 34 End 31 35 36 Function 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 45 46 SetDataFolder root: 47 return(0) 48 End 32 49 33 50 Window V_TransmissionPanel() : Panel 34 51 PauseUpdate; Silent 1 // building window... 35 NewPanel /W=(1 286,328,1764,952)52 NewPanel /W=(1496,366,1974,990) /K=1 36 53 ModifyPanel cbRGB=(32896,16448,0,19621) 37 54 DoWindow/C V_TransmissionPanel 38 55 39 56 // ShowTools/A 40 PopupMenu popup_0,pos={19.00,55.00},size={86.00,23.00},proc=V_TSamFilePopMenuProc,title="Sample" 41 PopupMenu popup_0,mode=1,value= V_getFilePurposeList("SCATTERING",0)//+V_getFileIntentList("EMPTY CELL",0) 42 PopupMenu popup_1,pos={102,248},size={72.00,23.00},proc=V_TTransmFilePopMenuProc,title="Transmission" 43 PopupMenu popup_1,mode=1,value= V_getFilePurposeList("TRANSMISSION",0) 44 PopupMenu popup_2,pos={164,353},size={72.00,23.00},proc=V_TEmpBeamPopMenuProc,title="Open Beam" 45 // PopupMenu popup_2,mode=1,value= V_getFileIntentList("EMPTY BEAM",0) 46 PopupMenu popup_2,mode=1,value= V_getFileIntentList("OPEN BEAM",0) 47 Button button_0,pos={37,193},size={100.00,20.00},proc=V_CalcTransmButtonProc,title="Calculate" 48 // Button button_1,pos={23.00,491.00},size={100.00,20.00},proc=V_WriteTransmButtonProc,title="Write" 57 PopupMenu popup_0,pos={16.00,359.00},size={104.00,23.00},fstyle=1,fsize=12,proc=V_TSamFilePopMenuProc,title="Sample" 58 PopupMenu popup_0,mode=1,popvalue="_none_",value= #"root:Packages:NIST:VSANS:Globals:Transmission:gSamMatchList " 59 PopupMenu popup_1,pos={12.00,229.00},size={195.00,23.00},fstyle=1,fsize=12,proc=V_TTransmFilePopMenuProc,title="Transmission" 60 PopupMenu popup_1,mode=1,popvalue="sans3584.nxs.ngv",value= V_getFilePurposeList("TRANSMISSION",0) 61 PopupMenu popup_2,pos={17.00,79.00},size={188.00,23.00},fstyle=1,fsize=12,proc=V_TEmpBeamPopMenuProc,title="Open Beam" 62 PopupMenu popup_2,mode=1,popvalue="sans3584.nxs.ngv",value= V_getFileIntentList("OPEN BEAM",0) 63 Button button_0,pos={34.00,499.00},size={100.00,20.00},proc=V_CalcTransmButtonProc,title="Calculate" 49 64 Button button_2,pos={349.00,13.00},size={30.00,20.00},proc=V_HelpTransmButtonProc,title="?" 50 65 Button button_3,pos={410.00,13.00},size={50.00,20.00},proc=V_DoneTransmButtonProc,title="Done" 51 SetVariable setvar_0,pos={21.00,86.00},size={300.00,14.00},title="Label:" 52 SetVariable setvar_0,limits={-inf,inf,0},value= _STR:"file label" 53 SetVariable setvar_1,pos={21.00,113.00},size={300.00,14.00},title="Group ID:" 54 SetVariable setvar_1,limits={-inf,inf,0},value= VSANS_RED_VERSION 55 SetVariable setvar_2,pos={105,276.00},size={300.00,14.00},title="Label:" 56 SetVariable setvar_2,limits={-inf,inf,0},value= _STR:"file label" 57 SetVariable setvar_3,pos={104,302},size={300.00,14.00},title="Group ID:" 58 SetVariable setvar_3,limits={-inf,inf,0},value= VSANS_RED_VERSION 59 SetVariable setvar_4,pos={165,382},size={300.00,14.00},title="Label:" 60 SetVariable setvar_4,limits={-inf,inf,0},value= _STR:"file label" 61 SetVariable setvar_5,pos={165,406},size={300.00,14.00},title="XY Box:" 62 SetVariable setvar_5,limits={-inf,inf,0},value= _STR:"dummy" 63 SetVariable setvar_6,pos={165,431},size={300.00,14.00},title="Panel:" 64 SetVariable setvar_6,limits={-inf,inf,0},value= _STR:"dummy" 65 SetVariable setvar_7,pos={21,138},size={300.00,14.00},title="Transmission:" 66 SetVariable setvar_7,limits={-inf,inf,0},value= VSANS_RED_VERSION 67 SetVariable setvar_8,pos={21,163},size={300.00,14.00},title="Error:" 68 SetVariable setvar_8,limits={-inf,inf,0},value= VSANS_RED_VERSION 66 Button button_4,pos={164.00,500.00},size={150.00,20.00},proc=V_CalcTransmListButtonProc,title="Calculate All In Popup" 67 SetVariable setvar_0,pos={18.00,390.00},size={300.00,14.00},title="Label:" 68 SetVariable setvar_0,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gSamLabel 69 SetVariable setvar_1,pos={18.00,417.00},size={300.00,14.00},title="Group ID:" 70 SetVariable setvar_1,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gSamGrpID 71 SetVariable setvar_2,pos={15.00,257.00},size={300.00,14.00},title="Label:" 72 SetVariable setvar_2,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTransLabel 73 SetVariable setvar_3,pos={14.00,283.00},size={300.00,14.00},title="Group ID:" 74 SetVariable setvar_3,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTrnGrpID 75 SetVariable setvar_4,pos={18.00,108.00},size={300.00,14.00},title="Label:" 76 SetVariable setvar_4,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gEmptyLabel 77 SetVariable setvar_5,pos={18.00,132.00},size={300.00,14.00},title="XY Box:" 78 SetVariable setvar_5,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gEmptyBoxCoord 79 SetVariable setvar_6,pos={18.00,157.00},size={300.00,14.00},fstyle=1,fsize=12,title="Panel:" 80 SetVariable setvar_6,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gEmptyPanel 81 SetVariable setvar_7,pos={18.00,442.00},size={300.00,14.00},title="Transmission:" 82 SetVariable setvar_7,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTrans 83 SetVariable setvar_8,pos={18.00,467.00},size={300.00,14.00},title="Error:" 84 SetVariable setvar_8,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTransErr 69 85 EndMacro 86 87 88 //Window V_TransmissionPanel() : Panel 89 // PauseUpdate; Silent 1 // building window... 90 // NewPanel /W=(1286,328,1764,952) 91 // ModifyPanel cbRGB=(32896,16448,0,19621) 92 // DoWindow/C V_TransmissionPanel 93 // 94 //// ShowTools/A 95 // PopupMenu popup_0,pos={19.00,55.00},size={86.00,23.00},proc=V_TSamFilePopMenuProc,title="Sample" 96 //// PopupMenu popup_0,mode=1,value= V_getFilePurposeList("SCATTERING",0)//+V_getFileIntentList("EMPTY CELL",0) 97 // PopupMenu popup_0,mode=1,value=root:Packages:NIST:VSANS:Globals:Transmission:gSamMatchList 98 // PopupMenu popup_1,pos={102,248},size={72.00,23.00},proc=V_TTransmFilePopMenuProc,title="Transmission" 99 // PopupMenu popup_1,mode=1,value= V_getFilePurposeList("TRANSMISSION",0) 100 // PopupMenu popup_2,pos={164,353},size={72.00,23.00},proc=V_TEmpBeamPopMenuProc,title="Open Beam" 101 //// PopupMenu popup_2,mode=1,value= V_getFileIntentList("EMPTY BEAM",0) 102 // PopupMenu popup_2,mode=1,value= V_getFileIntentList("OPEN BEAM",0) 103 // Button button_0,pos={37,193},size={100.00,20.00},proc=V_CalcTransmButtonProc,title="Calculate" 104 //// Button button_1,pos={23.00,491.00},size={100.00,20.00},proc=V_WriteTransmButtonProc,title="Write" 105 // Button button_2,pos={349.00,13.00},size={30.00,20.00},proc=V_HelpTransmButtonProc,title="?" 106 // Button button_3,pos={410.00,13.00},size={50.00,20.00},proc=V_DoneTransmButtonProc,title="Done" 107 // SetVariable setvar_0,pos={21.00,86.00},size={300.00,14.00},title="Label:" 108 // SetVariable setvar_0,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gSamLabel 109 // SetVariable setvar_1,pos={21.00,113.00},size={300.00,14.00},title="Group ID:" 110 // SetVariable setvar_1,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gSamGrpID 111 // SetVariable setvar_2,pos={105,276.00},size={300.00,14.00},title="Label:" 112 // SetVariable setvar_2,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTransLabel 113 // SetVariable setvar_3,pos={104,302},size={300.00,14.00},title="Group ID:" 114 // SetVariable setvar_3,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTrnGrpID 115 // SetVariable setvar_4,pos={165,382},size={300.00,14.00},title="Label:" 116 // SetVariable setvar_4,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gEmptyLabel 117 // SetVariable setvar_5,pos={165,406},size={300.00,14.00},title="XY Box:" 118 // SetVariable setvar_5,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gEmptyBoxCoord 119 // SetVariable setvar_6,pos={165,431},size={300.00,14.00},title="Panel:" 120 // SetVariable setvar_6,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gEmptyPanel 121 // SetVariable setvar_7,pos={21,138},size={300.00,14.00},title="Transmission:" 122 // SetVariable setvar_7,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTrans 123 // SetVariable setvar_8,pos={21,163},size={300.00,14.00},title="Error:" 124 // SetVariable setvar_8,limits={-inf,inf,0},value= root:Packages:NIST:VSANS:Globals:Transmission:gTransErr 125 //EndMacro 70 126 71 127 // TODO … … 85 141 STRUCT WMPopupAction &pa 86 142 143 144 // **** TODO 145 // short-circuit the switch, and simply report the values 146 // -- the TransFile popup now drives the panel 147 SVAR gSamLabel = root:Packages:NIST:VSANS:Globals:Transmission:gSamLabel 148 gSamLabel = V_getSampleDescription(pa.popStr) 149 NVAR gSamGrpID = root:Packages:NIST:VSANS:Globals:Transmission:gSamGrpID 150 gSamGrpID = V_getSample_GroupID(pa.popStr) 151 NVAR gTrans = root:Packages:NIST:VSANS:Globals:Transmission:gTrans 152 gTrans = V_getSampleTransmission(pa.popStr) 153 NVAR gTransErr = root:Packages:NIST:VSANS:Globals:Transmission:gTransErr 154 gTransErr = V_getSampleTransError(pa.popStr) 155 156 return(0) 157 158 // switch( pa.eventCode ) 159 // case 2: // mouse up 160 // Variable popNum = pa.popNum 161 // String popStr = pa.popStr 162 // 163 // Variable ii,np 164 // 165 // WAVE/T fileNameW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames 166 // WAVE/T labelW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Labels 167 // WAVE groupIDW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Group_ID 168 // WAVE transmW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Transmission 169 // WAVE/T intentW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent 170 // 171 // // TODO 172 // // I don't have a wave for the transmission error value, so it's not displayed here 173 // // -- do I read it in, or just ignore it... 174 // np = numpnts(labelW) //fileNameW is LONGER - so don't use numpnts(fileWave) 175 // for(ii=0;ii<np;ii+=1) 176 // if(cmpstr(fileNameW[ii],popStr)==0) 177 // 178 // SetVariable setvar_0,value=labelW[ii] 179 // SetVariable setvar_1,value=groupIDW[ii] 180 // SetVariable setvar_7,value=transmW[ii] 181 // break //found, get out 182 // endif 183 // endfor 184 // 185 // // loop back through to find the transmission file with the matching group id 186 // // TODO x- set the popup string to the matching name on exit 187 // Variable targetID = groupIDW[ii] 188 //// String list = V_getFilePurposeList("TRANSMISSION",0) 189 // String list = V_getFileIntentPurposeList("SAMPLE","TRANSMISSION",0) 190 // 191 // WAVE/T purposeW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose 192 // for(ii=0;ii<np;ii+=1) 193 // if(cmpstr(purposeW[ii],"TRANSMISSION")==0 && cmpstr(intentW[ii],"SAMPLE")==0 && groupIDW[ii] == targetID) 194 // Print "transmission file match at ",filenameW[ii] 195 // SetVariable setvar_2,value=labelW[ii] 196 // SetVariable setvar_3,value=groupIDW[ii] 197 // PopupMenu popup_1,mode=WhichListItem(fileNameW[ii], list )+1,popValue=fileNameW[ii] 198 // break 199 // endif 200 // endfor 201 // 202 // // now loop back through to find the empty beam file 203 // // TODO 204 // // x- fill in the XY box 205 // // x- Detector Panel field is hard-wired for "B" 206 // // -- do I use "EMPTY BEAM", "OPEN BEAM" or both?? I think "OPEN BEAM" is what NICE will use in a drop-down menu 207 // // 208 //// list = V_getFileIntentList("EMPTY BEAM",0) 209 // list = V_getFileIntentList("OPEN BEAM",0) 210 // 211 // for(ii=0;ii<np;ii+=1) 212 // if(cmpstr(intentW[ii],"OPEN BEAM")==0) 213 // Print "Open beam match at ",filenameW[ii] 214 // SetVariable setvar_4,value=labelW[ii] 215 // PopupMenu popup_2,mode=WhichListItem(fileNameW[ii], list )+1,popValue=fileNameW[ii] 216 // 217 //// SetVariable setvar_6,value =_STR:"ML" 218 // 219 // WAVE boxCoord = V_getBoxCoordinates(filenameW[ii]) 220 // Print boxCoord 221 // SetVariable setvar_5,value=_STR:V_NumWave2List(boxCoord,";") 222 // 223 // 224 // break 225 // endif 226 // endfor 227 // 228 // break 229 // case -1: // control being killed 230 // break 231 // endswitch 232 233 return 0 234 End 235 236 // TODO 237 // 238 // Given the group ID of the sample, try to locate a (the) matching transmission file 239 // by locating a matching ID in the list of transmission (intent) files 240 // 241 // then pop the menu 242 // 243 // 244 Function V_TTransmFilePopMenuProc(pa) : PopupMenuControl 245 STRUCT WMPopupAction &pa 246 87 247 switch( pa.eventCode ) 88 248 case 2: // mouse up … … 90 250 String popStr = pa.popStr 91 251 92 Variable ii,np 93 94 WAVE/T fileNameW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames 95 WAVE/T labelW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Labels 96 WAVE groupIDW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Group_ID 97 WAVE transmW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Transmission 98 WAVE/T intentW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent 99 100 // TODO 101 // I don't have a wave for the transmission error value, so it's not displayed here 102 // -- do I read it in, or just ignore it... 103 np = numpnts(labelW) //fileNameW is LONGER - so don't use numpnts(fileWave) 104 for(ii=0;ii<np;ii+=1) 105 if(cmpstr(fileNameW[ii],popStr)==0) 106 107 SetVariable setvar_0,value=labelW[ii] 108 SetVariable setvar_1,value=groupIDW[ii] 109 SetVariable setvar_7,value=transmW[ii] 110 break //found, get out 111 endif 112 endfor 113 114 // loop back through to find the transmission file with the matching group id 115 // TODO x- set the popup string to the matching name on exit 116 Variable targetID = groupIDW[ii] 117 // String list = V_getFilePurposeList("TRANSMISSION",0) 118 String list = V_getFileIntentPurposeList("SAMPLE","TRANSMISSION",0) 119 120 WAVE/T purposeW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose 121 for(ii=0;ii<np;ii+=1) 122 if(cmpstr(purposeW[ii],"TRANSMISSION")==0 && cmpstr(intentW[ii],"SAMPLE")==0 && groupIDW[ii] == targetID) 123 Print "transmission file match at ",filenameW[ii] 124 SetVariable setvar_2,value=labelW[ii] 125 SetVariable setvar_3,value=groupIDW[ii] 126 PopupMenu popup_1,mode=WhichListItem(fileNameW[ii], list )+1,popValue=fileNameW[ii] 127 break 128 endif 129 endfor 130 131 // now loop back through to find the empty beam file 132 // TODO 133 // x- fill in the XY box 134 // x- Detector Panel field is hard-wired for "B" 135 // -- do I use "EMPTY BEAM", "OPEN BEAM" or both?? I think "OPEN BEAM" is what NICE will use in a drop-down menu 136 // 137 // list = V_getFileIntentList("EMPTY BEAM",0) 138 list = V_getFileIntentList("OPEN BEAM",0) 139 140 for(ii=0;ii<np;ii+=1) 141 if(cmpstr(intentW[ii],"OPEN BEAM")==0) 142 Print "Open beam match at ",filenameW[ii] 143 SetVariable setvar_4,value=labelW[ii] 144 PopupMenu popup_2,mode=WhichListItem(fileNameW[ii], list )+1,popValue=fileNameW[ii] 145 146 // SetVariable setvar_6,value =_STR:"ML" 147 148 WAVE boxCoord = V_getBoxCoordinates(filenameW[ii]) 149 Print boxCoord 150 SetVariable setvar_5,value=_STR:V_NumWave2List(boxCoord,";") 151 152 153 break 154 endif 155 endfor 156 252 SVAR gTransLabel = root:Packages:NIST:VSANS:Globals:Transmission:gTransLabel 253 gTransLabel = V_getSampleDescription(popStr) 254 NVAR gTrnGrpID = root:Packages:NIST:VSANS:Globals:Transmission:gTrnGrpID 255 gTrnGrpID = V_getSample_GroupID(popStr) 256 257 SVAR gSamMatchList = root:Packages:NIST:VSANS:Globals:Transmission:gSamMatchList 258 String quote = "\"" 259 gSamMatchList = quote + V_getFileIntentPurposeIDList("SAMPLE","SCATTERING",gTrnGrpID,0) + quote 260 // this resets a global string, since I can't pass a parameter (only constants) in value=fn() 261 PopupMenu popup_0,mode=1,value=#gSamMatchList 262 157 263 break 158 264 case -1: // control being killed … … 163 269 End 164 270 165 // TODO 166 // 167 // Given the group ID of the sample, try to locate a (the) matching transmission file 168 // by locating a matching ID in the list of transmission (intent) files 169 // 170 // then pop the menu 171 // 172 // 173 Function V_TTransmFilePopMenuProc(pa) : PopupMenuControl 271 272 Function V_TEmpBeamPopMenuProc(pa) : PopupMenuControl 174 273 STRUCT WMPopupAction &pa 175 274 … … 179 278 String popStr = pa.popStr 180 279 181 182 183 break184 case -1: // control being killed185 break186 endswitch187 188 return 0189 End190 191 192 Function V_TEmpBeamPopMenuProc(pa) : PopupMenuControl193 STRUCT WMPopupAction &pa194 195 switch( pa.eventCode )196 case 2: // mouse up197 Variable popNum = pa.popNum198 String popStr = pa.popStr199 200 280 Print "empty beam match at ",popStr 201 281 SetVariable setvar_4,value=_STR:V_getSampleDescription(popStr) … … 241 321 case 2: // mouse up 242 322 // click code here 243 244 Variable trans,trans_err 245 Variable emptyCts,empty_ct_err,samCts,sam_ct_err 246 String fileName,samFileName,emptyFileName 247 String detStr 248 249 250 // save preferences for file loading 251 Variable savDivPref,savSAPref 252 NVAR gDoDIVCor = root:Packages:NIST:VSANS:Globals:gDoDIVCor 253 savDivPref = gDoDIVCor 254 NVAR gDoSolidAngleCor = root:Packages:NIST:VSANS:Globals:gDoSolidAngleCor 255 savSAPref = gDoSolidAngleCor 256 257 // set local preferences 258 gDoDIVCor = 0 259 gDoSolidAngleCor = 0 260 261 // check for sample transmission + error 262 // if present -- exit 323 324 String SamFile,TransFile,EmptyFile 325 263 326 ControlInfo/W=V_TransmissionPanel popup_0 264 fileName = S_Value 265 trans = V_getSampleTransmission(fileName) 266 trans_err = V_getSampleTransError(fileName) 327 SamFile = S_Value 328 329 ControlInfo/W=V_TransmissionPanel popup_1 330 TransFile = S_Value 331 332 ControlInfo/W=V_TransmissionPanel popup_2 333 EmptyFile = S_Value 334 335 V_CalcOneTransmission(SamFile,TransFile,EmptyFile) 336 337 338 // done 339 break 340 case -1: // control being killed 341 break 342 endswitch 343 344 345 return 0 346 End 347 348 Function V_CalcTransmListButtonProc(ba) : ButtonControl 349 STRUCT WMButtonAction &ba 350 351 switch( ba.eventCode ) 352 case 2: // mouse up 353 // click code here 354 355 SVAR gSamMatchList = root:Packages:NIST:VSANS:Globals:Transmission:gSamMatchList 356 357 String SamFile,TransFile,EmptyFile 358 359 ControlInfo/W=V_TransmissionPanel popup_1 360 TransFile = S_Value 361 362 ControlInfo/W=V_TransmissionPanel popup_2 363 EmptyFile = S_Value 364 365 // gSamMatchStr has " at each end. remove these 366 String list 367 list = gSamMatchList 368 list = list[1,strlen(list)-1] 369 list = list[0,strlen(list)-2] 370 371 Variable num,ii 372 num = ItemsInList(list, ";") 373 for(ii=0;ii<num;ii+=1) 374 SamFile = StringFromList(ii, list, ";") 375 V_CalcOneTransmission(SamFile,TransFile,EmptyFile) 376 endfor 377 378 Print "Done Processing Transmission List" 379 380 // done 381 break 382 case -1: // control being killed 383 break 384 endswitch 385 386 387 return 0 388 End 389 390 391 392 Function V_CalcOneTransmission(SamFileName,TransFileName,EmptyFileName) 393 String SamFileName,TransFileName,EmptyFileName 394 395 Variable trans,trans_err 396 Variable emptyCts,empty_ct_err,samCts,sam_ct_err 397 String detStr 398 399 400 // save preferences for file loading 401 Variable savDivPref,savSAPref 402 NVAR gDoDIVCor = root:Packages:NIST:VSANS:Globals:gDoDIVCor 403 savDivPref = gDoDIVCor 404 NVAR gDoSolidAngleCor = root:Packages:NIST:VSANS:Globals:gDoSolidAngleCor 405 savSAPref = gDoSolidAngleCor 406 407 // set local preferences 408 gDoDIVCor = 0 409 gDoSolidAngleCor = 0 410 411 // check for sample transmission + error 412 // if present -- exit 413 414 trans = V_getSampleTransmission(samfileName) 415 trans_err = V_getSampleTransError(samfileName) 267 416 // // TODO 268 417 // // -- this criteria is rather crude. think it through better … … 272 421 // break 273 422 // endif 274 275 // for empty beam 276 277 ControlInfo/W=V_TransmissionPanel popup_2 278 emptyFileName = S_Value 279 280 emptyCts = V_getBoxCounts(emptyFileName) 281 empty_ct_err = V_getBoxCountsError(emptyFileName) 282 WAVE xyBoxW = V_getBoxCoordinates(emptyFileName) 423 424 // for empty beam 425 emptyCts = V_getBoxCounts(emptyFileName) 426 empty_ct_err = V_getBoxCountsError(emptyFileName) 427 WAVE xyBoxW = V_getBoxCoordinates(emptyFileName) 428 // TODO 429 // x- need to get the panel string for the sum. 430 // x- the detector string is currently hard-wired 431 SVAR gEmptyPanel = root:Packages:NIST:VSANS:Globals:Transmission:gEmptyPanel 432 detStr = gEmptyPanel 433 434 435 // check for box count + error values 436 // if present, proceed 437 // TODO 438 // -- this criteria is rather crude. think it through better 439 if(emptyCts > 1 && empty_ct_err != 0) 440 Printf "Empty beam box counts, error = %g +/- %g already exists, box counts not re-calculated\r",emptyCts,empty_ct_err 441 442 else 443 // else the counts have not been determined 444 // read in the data file 445 V_LoadAndPlotRAW_wName(emptyFileName) 446 // convert raw->SAM 447 V_Raw_to_work("SAM") 448 V_UpdateDisplayInformation("SAM") 449 450 // and determine box sum and error 451 // store these locally 452 emptyCts = V_SumCountsInBox(xyBoxW[0],xyBoxW[1],xyBoxW[2],xyBoxW[3],empty_ct_err,"SAM",detStr) 453 454 Print "empty counts = ",emptyCts 455 Print "empty err/counts = ",empty_ct_err/emptyCts 456 283 457 // TODO 284 // x- need to get the panel string for the sum. 285 // x- the detector string is currently hard-wired 286 ControlInfo setvar_6 287 detStr = S_Value //this was hard-wired to "B", but no read from the panel 288 289 // check for box count + error values 290 // if present, proceed 458 // write these back to the file 459 // (write locally?) 460 461 endif 462 463 // for Sample Transmission File 464 465 // check for box count + error values 466 samCts = V_getBoxCounts(TransFileName) 467 sam_ct_err = V_getBoxCountsError(TransFileName) 468 // if present, proceed 469 // TODO 470 // -- this criteria is rather crude. think it through better 471 if(samCts > 1 && sam_ct_err != 0) 472 Printf "Sam Trans box counts, error = %g +/- %g already exists, nothing calculated\r",samCts,sam_ct_err 473 474 else 475 // else 476 // read in the data file 477 V_LoadAndPlotRAW_wName(TransFileName) 478 // convert raw->SAM 479 V_Raw_to_work("SAM") 480 V_UpdateDisplayInformation("SAM") 481 482 // get the box coordinates 483 // and determine box sum and error 484 485 // store these locally 486 samCts = V_SumCountsInBox(xyBoxW[0],xyBoxW[1],xyBoxW[2],xyBoxW[3],sam_ct_err,"SAM",detStr) 487 488 Print "sam counts = ",samCts 489 Print "sam err/counts = ",sam_ct_err/samCts 490 291 491 // TODO 292 // -- this criteria is rather crude. think it through better 293 if(emptyCts > 1 && empty_ct_err != 0) 294 Printf "Empty beam box counts, error = %g +/- %g already exists, box counts not re-calculated\r",emptyCts,empty_ct_err 295 296 else 297 // else the counts have not been determined 298 // read in the data file 299 V_LoadAndPlotRAW_wName(emptyFileName) 300 // convert raw->SAM 301 V_Raw_to_work("SAM") 302 V_UpdateDisplayInformation("SAM") 303 304 // and determine box sum and error 305 // store these locally 306 emptyCts = V_SumCountsInBox(xyBoxW[0],xyBoxW[1],xyBoxW[2],xyBoxW[3],empty_ct_err,"SAM",detStr) 307 308 Print "empty counts = ",emptyCts 309 Print "empty err/counts = ",empty_ct_err/emptyCts 310 311 // TODO 312 // write these back to the file 313 // (write locally?) 314 315 endif 316 317 // for Sample Transmission File 318 319 ControlInfo/W=V_TransmissionPanel popup_1 320 samFileName = S_Value 321 // check for box count + error values 322 samCts = V_getBoxCounts(samFileName) 323 sam_ct_err = V_getBoxCountsError(samFileName) 324 // if present, proceed 325 // TODO 326 // -- this criteria is rather crude. think it through better 327 if(samCts > 1 && sam_ct_err != 0) 328 Printf "Sam Trans box counts, error = %g +/- %g already exists, nothing calculated\r",samCts,sam_ct_err 329 330 else 331 // else 332 // read in the data file 333 V_LoadAndPlotRAW_wName(samFileName) 334 // convert raw->SAM 335 V_Raw_to_work("SAM") 336 V_UpdateDisplayInformation("SAM") 337 338 // get the box coordinates 339 // and determine box sum and error 340 341 // store these locally 342 samCts = V_SumCountsInBox(xyBoxW[0],xyBoxW[1],xyBoxW[2],xyBoxW[3],sam_ct_err,"SAM",detStr) 343 344 Print "sam counts = ",samCts 345 Print "sam err/counts = ",sam_ct_err/samCts 346 347 // TODO 348 // write these back to the file 349 // (write locally?) 350 endif 351 352 //then calculate the transmission 353 Variable empAttenFactor,emp_atten_err,samAttenFactor,sam_atten_err,attenRatio 354 355 // get the attenuation factor for the empty beam 356 empAttenFactor = V_getAttenuator_transmission(emptyFileName) 357 emp_atten_err = V_getAttenuator_trans_err(emptyFileName) 358 // get the attenuation factor for the sample transmission 359 samAttenFactor = V_getAttenuator_transmission(samFileName) 360 sam_atten_err = V_getAttenuator_trans_err(samFileName) 361 AttenRatio = empAttenFactor/samAttenFactor 362 // calculate the transmission 363 // calculate the transmission error 364 trans = samCts/emptyCts * AttenRatio 365 366 // squared, relative error 367 if(AttenRatio == 1) 368 trans_err = (sam_ct_err/samCts)^2 + (empty_ct_err/emptyCts)^2 //same atten, att_err drops out 369 else 370 trans_err = (sam_ct_err/samCts)^2 + (empty_ct_err/emptyCts)^2 + (sam_atten_err/samAttenFactor)^2 + (emp_atten_err/empAttenFactor)^2 371 endif 372 trans_err = sqrt(trans_err) 373 trans_err *= trans // now, one std deviation 374 375 //write out counts and transmission to history window, showing the attenuator ratio, if it is not unity 376 If(attenRatio==1) 377 Printf "%s\t\tTrans Counts = %g\tTrans = %g +/- %g\r",fileName, samCts,trans,trans_err 378 else 379 Printf "%s\t\tTrans Counts = %g\tTrans = %g +/- %g\tAttenuatorRatio = %g\r",fileName, samCts,trans,trans_err,attenRatio 380 endif 381 382 // write both out to the sample *scattering* file on disk 383 V_writeSampleTransmission(fileName,trans) 384 V_writeSampleTransError(fileName,trans_err) 385 386 // TODO 387 // -- update the value displayed in the panel 388 // -- update the local value in the file catalog 389 // -- delete the file from RawVSANS to force a re-read? 390 // SetVariable setvar_7,value= trans 391 // SetVariable setvar_8,value= trans_err 392 // DoUpdate/W=V_TransmissionPanel 393 394 395 // done 396 break 397 case -1: // control being killed 398 break 399 endswitch 492 // write these back to the file 493 // (write locally?) 494 endif 495 496 //then calculate the transmission 497 Variable empAttenFactor,emp_atten_err,samAttenFactor,sam_atten_err,attenRatio 498 499 // get the attenuation factor for the empty beam 500 empAttenFactor = V_getAttenuator_transmission(emptyFileName) 501 emp_atten_err = V_getAttenuator_trans_err(emptyFileName) 502 // get the attenuation factor for the sample transmission 503 samAttenFactor = V_getAttenuator_transmission(TransFileName) 504 sam_atten_err = V_getAttenuator_trans_err(TransFileName) 505 AttenRatio = empAttenFactor/samAttenFactor 506 // calculate the transmission 507 // calculate the transmission error 508 trans = samCts/emptyCts * AttenRatio 509 510 // squared, relative error 511 if(AttenRatio == 1) 512 trans_err = (sam_ct_err/samCts)^2 + (empty_ct_err/emptyCts)^2 //same atten, att_err drops out 513 else 514 trans_err = (sam_ct_err/samCts)^2 + (empty_ct_err/emptyCts)^2 + (sam_atten_err/samAttenFactor)^2 + (emp_atten_err/empAttenFactor)^2 515 endif 516 trans_err = sqrt(trans_err) 517 trans_err *= trans // now, one std deviation 518 519 //write out counts and transmission to history window, showing the attenuator ratio, if it is not unity 520 If(attenRatio==1) 521 Printf "%s\t\tTrans Counts = %g\tTrans = %g +/- %g\r",SamFileName, samCts,trans,trans_err 522 else 523 Printf "%s\t\tTrans Counts = %g\tTrans = %g +/- %g\tAttenuatorRatio = %g\r",SamFileName, samCts,trans,trans_err,attenRatio 524 endif 525 526 // write both out to the sample *scattering* file on disk 527 V_writeSampleTransmission(SamFileName,trans) 528 V_writeSampleTransError(SamFileName,trans_err) 529 530 // (DONE) 531 // x- update the value displayed in the panel 532 // (NO) update the local value in the file catalog 533 // x- delete the file from RawVSANS to force a re-read? 534 NVAR gTrans = root:Packages:NIST:VSANS:Globals:Transmission:gTrans 535 gTrans = trans 536 NVAR gTransErr = root:Packages:NIST:VSANS:Globals:Transmission:gTransErr 537 gTransErr = trans_err 538 539 V_KillNamedDataFolder(V_RemoveDotExtension(samFileName)) 400 540 401 541 // restore preferences on exit … … 403 543 gDoSolidAngleCor = savSAPref 404 544 405 406 return 0 407 End 545 return(0) 546 547 End 548 549 550 551 552 553 408 554 409 555 Function V_WriteTransmButtonProc(ba) : ButtonControl -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Utilities_General.ipf
r1079 r1084 104 104 // really not used as intended anymore. 105 105 // 106 // *** this appears to be unused, in favor of V_CleanupData_w_Progress(0,1) **********107 106 // 108 107 Function V_KillNamedDataFolder(fname) … … 1425 1424 1426 1425 1427 1426 // match BOTH the intent and purpose 1427 // -- needed to identify the SAMPLE + SCATTERING data files. 1428 // 1429 // 1430 // method is the method to use to find the file (currently ignored, CAT is always used) 1431 // 0 = (default) is to use the file catalog (= fastest) 1432 // 1 = Grep (not terribly slow) 1433 // 2 = read every file (bad choice) 1434 // 1435 Function/S V_getFileIntentPurposeIDList(intent,purpose,targetID,method) 1436 String intent,purpose 1437 Variable targetID,method 1438 1439 Variable ii,num 1440 String list="",item="",fname,newList 1441 1442 // // read every file... 1443 // if(method == 2) 1444 // PathInfo catPathName 1445 // String path = S_path 1446 // newList = V_GetRawDataFileList() 1447 // num=ItemsInList(newList) 1448 // 1449 // for(ii=0;ii<num;ii+=1) 1450 // item=StringFromList(ii, newList , ";") 1451 // fname = path + item 1452 // purpose = V_getReduction_purpose(fname) 1453 // if(cmpstr(purpose,testStr) == 0) 1454 // list += item + ";" 1455 // endif 1456 // endfor 1457 // endif 1458 // 1459 // // use Grep 1460 // if(method == 1) 1461 // newList = V_GetRawDataFileList() 1462 // num=ItemsInList(newList) 1463 // for(ii=0;ii<num;ii+=1) 1464 // item=StringFromList(ii, newList , ";") 1465 // Grep/P=catPathName/Q/E=("(?i)"+testStr) item 1466 // if( V_value ) // at least one instance was found 1467 // // Print "found ", item,ii 1468 // list += item + ";" 1469 // endif 1470 // endfor 1471 // 1472 // else 1473 // get the list from the file catalog 1474 1475 WAVE/T fileNameW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames 1476 WAVE/T purposeW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose 1477 WAVE/T intentW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent 1478 WAVE groupIDW = root:Packages:NIST:VSANS:CatVSHeaderInfo:group_id 1479 1480 Variable np = numpnts(purposeW) //fileNameW is LONGER - so don't use numpnts(fileWave) 1481 for(ii=0;ii<np;ii+=1) 1482 if(cmpstr(purposeW[ii],purpose)==0 && cmpstr(intentW[ii],intent)==0 && groupIDW[ii]==targetID) //this is case-INSENSITIVE (necessary, since the case is unknown) 1483 list += fileNameW[ii] + ";" 1484 endif 1485 endfor 1486 1487 List = SortList(List,";",0) 1488 1489 return(list) 1490 end 1491 1492 1493 1494 1495
Note: See TracChangeset
for help on using the changeset viewer.