Changeset 1075 for sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Timestamp:
- Dec 1, 2017 2:53:00 PM (5 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_DetectorBinning_Utils.ipf
r1070 r1075 811 811 812 812 strswitch(type) // string switch 813 case "FL": // execute if case matches expression 813 // case "FL": // execute if case matches expression 814 // case "FR": 815 // detStr = type 816 // if(isVCALC) 817 // WAVE inten = $(folderPath+instPath+detStr+":det_"+detStr) 818 // WAVE/Z iErr = $("iErr_"+detStr) // 2D errors -- may not exist, especially for simulation 819 // else 820 // Wave inten = V_getDetectorDataW(folderStr,detStr) 821 // Wave iErr = V_getDetectorDataErrW(folderStr,detStr) 822 // Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 823 // if(WaveExists(mask) == 1) 824 // maskMissing = 0 825 // endif 826 // 827 // endif 828 // NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_"+detStr) 829 // Wave qTotal = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values 830 // nSets = 1 831 // break 832 833 // case "FT": 834 // case "FB": 835 // detStr = type 836 // if(isVCALC) 837 // WAVE inten = $(folderPath+instPath+detStr+":det_"+detStr) 838 // WAVE/Z iErr = $("iErr_"+detStr) // 2D errors -- may not exist, especially for simulation 839 // else 840 // Wave inten = V_getDetectorDataW(folderStr,detStr) 841 // Wave iErr = V_getDetectorDataErrW(folderStr,detStr) 842 // Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 843 // if(WaveExists(mask) == 1) 844 // maskMissing = 0 845 // endif 846 // endif 847 // NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_"+detStr) 848 // Wave qTotal = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values 849 // nSets = 1 850 // break 851 852 // case "ML": 853 // case "MR": 854 // detStr = type 855 // if(isVCALC) 856 // WAVE inten = $(folderPath+instPath+detStr+":det_"+detStr) 857 // WAVE/Z iErr = $("iErr_"+detStr) // 2D errors -- may not exist, especially for simulation 858 // else 859 // Wave inten = V_getDetectorDataW(folderStr,detStr) 860 // Wave iErr = V_getDetectorDataErrW(folderStr,detStr) 861 // Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 862 // if(WaveExists(mask) == 1) 863 // maskMissing = 0 864 // endif 865 // endif 866 // //TODO: 867 // // -- decide on the proper deltaQ for binning. either nominal value for LR, or one 868 // // determined specifically for that panel (currently using one tube width as deltaQ) 869 // // -- this is repeated multiple times in this switch 870 // NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_"+detStr) 871 // Wave qTotal = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values 872 // nSets = 1 873 // break 874 875 // case "MT": 876 // case "MB": 877 // detStr = type 878 // if(isVCALC) 879 // WAVE inten = $(folderPath+instPath+detStr+":det_"+detStr) 880 // WAVE/Z iErr = $("iErr_"+detStr) // 2D errors -- may not exist, especially for simulation 881 // else 882 // Wave inten = V_getDetectorDataW(folderStr,detStr) 883 // Wave iErr = V_getDetectorDataErrW(folderStr,detStr) 884 // Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 885 // if(WaveExists(mask) == 1) 886 // maskMissing = 0 887 // endif 888 // endif 889 // NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_"+detStr) 890 // Wave qTotal = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values 891 // nSets = 1 892 // break 893 894 // only one panel, simply pick that panel and move on out of the switch 895 case "FL": 814 896 case "FR": 815 detStr = type 816 if(isVCALC) 817 WAVE inten = $(folderPath+instPath+detStr+":det_"+detStr) 818 WAVE/Z iErr = $("iErr_"+detStr) // 2D errors -- may not exist, especially for simulation 819 else 820 Wave inten = V_getDetectorDataW(folderStr,detStr) 821 Wave iErr = V_getDetectorDataErrW(folderStr,detStr) 822 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 823 if(WaveExists(mask) == 1) 824 maskMissing = 0 825 endif 826 827 endif 828 NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_"+detStr) 829 Wave qTotal = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values 830 nSets = 1 831 break 832 833 case "FT": 897 case "FT": 834 898 case "FB": 835 detStr = type 836 if(isVCALC) 837 WAVE inten = $(folderPath+instPath+detStr+":det_"+detStr) 838 WAVE/Z iErr = $("iErr_"+detStr) // 2D errors -- may not exist, especially for simulation 839 else 840 Wave inten = V_getDetectorDataW(folderStr,detStr) 841 Wave iErr = V_getDetectorDataErrW(folderStr,detStr) 842 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 843 if(WaveExists(mask) == 1) 844 maskMissing = 0 845 endif 846 endif 847 NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_"+detStr) 848 Wave qTotal = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values 849 nSets = 1 850 break 851 852 case "ML": 899 case "ML": 853 900 case "MR": 854 detStr = type 855 if(isVCALC) 856 WAVE inten = $(folderPath+instPath+detStr+":det_"+detStr) 857 WAVE/Z iErr = $("iErr_"+detStr) // 2D errors -- may not exist, especially for simulation 858 else 859 Wave inten = V_getDetectorDataW(folderStr,detStr) 860 Wave iErr = V_getDetectorDataErrW(folderStr,detStr) 861 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 862 if(WaveExists(mask) == 1) 863 maskMissing = 0 864 endif 865 endif 866 //TODO: 867 // -- decide on the proper deltaQ for binning. either nominal value for LR, or one 868 // determined specifically for that panel (currently using one tube width as deltaQ) 869 // -- this is repeated multiple times in this switch 870 NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_"+detStr) 871 // NVAR delQ = $(folderPath+instPath+"ML"+":gDelQ_ML") 872 Wave qTotal = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values 873 nSets = 1 874 break 875 876 case "MT": 877 case "MB": 878 detStr = type 879 if(isVCALC) 880 WAVE inten = $(folderPath+instPath+detStr+":det_"+detStr) 881 WAVE/Z iErr = $("iErr_"+detStr) // 2D errors -- may not exist, especially for simulation 882 else 883 Wave inten = V_getDetectorDataW(folderStr,detStr) 884 Wave iErr = V_getDetectorDataErrW(folderStr,detStr) 885 Wave/Z mask = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 886 if(WaveExists(mask) == 1) 887 maskMissing = 0 888 endif 889 endif 890 NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_"+detStr) 891 Wave qTotal = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values 892 nSets = 1 893 break 894 901 case "MT": 902 case "MB": 895 903 case "B": 896 904 detStr = type … … 906 914 endif 907 915 endif 908 NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_ B")916 NVAR delQ = $(folderPath+instPath+detStr+":gDelQ_"+detStr) 909 917 Wave qTotal = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values 910 918 nSets = 1 … … 1089 1097 1090 1098 default: 1091 nSets = 0 // optional default expression executed1099 nSets = 0 1092 1100 Print "ERROR ---- type is not recognized " 1093 1101 endswitch … … 1101 1109 1102 1110 1103 //TODO: properly define the 2D errors here - I'll have this if I do the simulation 1104 // -- need to propagate the 2D errors up to this point 1105 // 1111 // RAW data is currently read in and the 2D error wave is correctly generated 1112 // 2D error is propagated through all reduction steps, but I have not 1113 // verified that it is an exact duplication of the 1D error 1114 // 1115 // 1116 // 1117 // IF ther is no 2D error wave present for some reason, make a fake one 1106 1118 if(WaveExists(iErr)==0 && WaveExists(inten) != 0) 1107 1119 Duplicate/O inten,iErr … … 1177 1189 // TODO: 1178 1190 // -- the iErr (=2D) wave and accumulation of error is NOT CALCULATED CORRECTLY YET 1191 // -- verify the 2D error propagation by reducing it to 1D error 1192 // 1179 1193 // 1180 1194 // The 1D error does not use iErr, and IS CALCULATED CORRECTLY … … 1302 1316 // just like in CircSectAve.ipf 1303 1317 // TODO: 1304 // -- 2D Errors were NOT properly acculumated through reduction, so this loop of calculations is NOT MEANINGFUL(yet)1318 // -- 2D Errors were (maybe) properly acculumated through reduction, so this loop of calculations is NOT VERIFIED (yet) 1305 1319 // x- the error on the 1D intensity, is correctly calculated as the standard error of the mean. 1306 1320 for(ii=0;ii<nq;ii+=1) … … 1425 1439 usingLenses = 0 1426 1440 1427 1428 Print "Resolution lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses" 1429 Print lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses 1441 if(cmpstr(detStr,"FL")==0) 1442 Print "(FL) Resolution lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses" 1443 Print lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses 1444 endif 1430 1445 1431 1446 ii=0 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DIVUtils.ipf
r1071 r1075 25 25 // the high angle issues. 26 26 // 27 // -- what about the T/B panels? Since a large chunk of these detectors may be obscured,27 // x- what about the T/B panels? Since a large chunk of these detectors may be obscured, 28 28 // the normalization will be way off -- and the "active" area will end up much larger 29 29 // than it should be - since the wings of the detector are mostly zero... … … 34 34 35 35 /// TODO: 36 // -- this is the basic renormalization that is done in PRODIV. see that file for all of the 36 // -- need a way to view the DIV data (each panel) and see the stats on the values 37 // (maybe a simple panel viewer, one-at-a-time, or all 4 as individuals, not on the same scale) 38 39 // x- this is the basic renormalization that is done in PRODIV. see that file for all of the 37 40 // details of how it's used 38 // -- update to VSANS file locations and data reads39 // -- expand this to do a basic renormalization of all 9 panels, and move the data into the41 // x- update to VSANS file locations and data reads 42 // x- expand this to do a basic renormalization of all 9 panels, and move the data into the 40 43 // appropriate locations for saving as a DIV file. 41 44 // x- (YES, done) what about error propogation? Can I store the error in the data file? 42 45 // Makes a difference if the DIV is not collected for long "enough". 43 46 // x- then I need to be able to read the error in (done) 44 // 47 45 48 46 49 47 50 // Basic function: 48 // -- first, reduce the data (to the COR level?)49 // -- next, V_NormalizeDIV()50 // -- then Setup_VSANS_DIV_Struct()51 // -- Setup_VSANS_DIV_Struct() 52 // -- then, reduce the data (to the COR level?) 53 // -- next, V_NormalizeDIV() (one panel at a time, using the mask) 51 54 // -- next, V_CopyDIVToSave() -or- V_CopyDIVToSave_OnePanel() 52 55 // -- last, Save_VSANS_DIV_Nexus() 53 56 // 54 57 58 59 60 61 62 63 64 Proc V_NormalizeDIV_proc(type,detStr) 65 String type,detStr 66 V_NormalizeDIV_onePanel(type,detStr) 67 end 68 69 // Normalizes a single panel 70 // then copies that panel over to the DIV_Struct for later saving 71 // 72 // type is the work folder where the (? corrected) data is currently 73 // 74 // TODO 75 // x- data should be copied to some alternate work folder before this step 76 // x- for T/B detectors, this may not work as intended if the whole detector is not illuminated. 77 // How to handle? A mask? 78 // x- is this the correct calculation of the error? (YES) It should be correct up to this point since the 79 // standard reduction has been used, but now the normalization step is a multiplication 80 // by a constant (w/no error). Be sure this error transformation is correct. (YES - this is correct, and is 81 // what is done in SANS) 82 // 83 Function V_NormalizeDIV_onePanel(type,detStr) 84 String type,detStr 85 86 Variable ii,totCts,pixelX,pixelY 87 88 89 Wave w = V_getDetectorDataW(type,detStr) 90 Wave w_err = V_getDetectorDataErrW(type,detStr) 91 // pixelX = V_getDet_pixel_num_x(type,detStr) 92 // pixelY = V_getDet_pixel_num_y(type,detStr) 93 94 // get the mask data 95 // 1== mask, 0 == no mask 96 Wave maskW = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") 97 98 // work on a copy of the data and error 99 Duplicate/O w w_copy 100 Duplicate/O w_err w_err_copy 101 102 w_copy = (maskW == 1) ? NaN : w_copy 103 WaveStats/Q/M=1 w_copy 104 totCts = V_npnts*V_avg // does not count the NaN values 105 106 107 w_copy /= totCts 108 w_copy *= V_npnts 109 110 w_err_copy /= totCts 111 w_err_copy *= V_npnts 112 113 // TODO: 114 // -- do I want to replace the NaN values with 1 for the DIV (the user will mask the data as 115 // needed, and the NaN values may be an issue later... 116 w_copy = (numtype(w_copy) == 2) ? 1 : w_copy //turns 2==NaN into 1 117 118 119 // copy the normalized data to the folder to save 120 Wave w_norm = $("root:VSANS_DIV_file:entry:instrument:detector_"+detStr+":data") 121 Wave w_norm_err = $("root:VSANS_DIV_file:entry:instrument:detector_"+detStr+":linear_data_error") 122 123 w_norm = w_copy 124 w_norm_err = w_err_copy 125 126 127 KillWaves/Z w_copy,w_err_copy 128 129 return(0) 130 End 55 131 56 132 … … 211 287 Make/O/T/N=1 name = "NG3_VSANS" 212 288 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_B 213 Make/O/D/N=(150,150) data = 1 //+ (enoise(0.1))214 Make/O/D/N=(150,150) linear_data_error = 0.01 *abs(gnoise(1))289 Make/O/D/N=(150,150) data = 1 290 Make/O/D/N=(150,150) linear_data_error = 0.01 215 291 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MR 216 292 Make/O/D/N=(48,128) data = 1 217 // data[][0] = 1+enoise(0.1) 218 // data[][] = data[p][0] 219 Make/O/D/N=(48,128) linear_data_error = 0.01*abs(gnoise(1)) 293 Make/O/D/N=(48,128) linear_data_error = 0.01 220 294 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_ML 221 295 Make/O/D/N=(48,128) data = 1 222 // data[][0] = 1+enoise(0.1) 223 // data[][] = data[p][0] 224 Make/O/D/N=(48,128) linear_data_error = 0.01*abs(gnoise(1)) 296 Make/O/D/N=(48,128) linear_data_error = 0.01 225 297 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MT 226 Make/O/D/N=(128,48) data = 1 // + (enoise(0.1))227 Make/O/D/N=(128,48) linear_data_error = 0.01 *abs(gnoise(1))298 Make/O/D/N=(128,48) data = 1 299 Make/O/D/N=(128,48) linear_data_error = 0.01 228 300 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MB 229 Make/O/D/N=(128,48) data = 1 //+ (enoise(0.1))230 Make/O/D/N=(128,48) linear_data_error = 0.01 *abs(gnoise(1))301 Make/O/D/N=(128,48) data = 1 302 Make/O/D/N=(128,48) linear_data_error = 0.01 231 303 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FR 232 304 Make/O/D/N=(48,128) data = 1 233 // data[][0] = 1+enoise(0.1) 234 // data[][] = data[p][0] 235 Make/O/D/N=(48,128) linear_data_error = 0.01*abs(gnoise(1)) 305 Make/O/D/N=(48,128) linear_data_error = 0.01 236 306 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FL 237 307 Make/O/D/N=(48,128) data = 1 238 // data[][0] = 1+enoise(0.1) 239 // data[][] = data[p][0] 240 Make/O/D/N=(48,128) linear_data_error = 0.01*abs(gnoise(1)) 308 Make/O/D/N=(48,128) linear_data_error = 0.01 241 309 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FT 242 Make/O/D/N=(128,48) data = 1 //+ (enoise(0.1))243 Make/O/D/N=(128,48) linear_data_error = 0.01 *abs(gnoise(1))310 Make/O/D/N=(128,48) data = 1 311 Make/O/D/N=(128,48) linear_data_error = 0.01 244 312 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FB 245 Make/O/D/N=(128,48) data = 1 //+ (enoise(0.1))246 Make/O/D/N=(128,48) linear_data_error = 0.01 *abs(gnoise(1))313 Make/O/D/N=(128,48) data = 1 314 Make/O/D/N=(128,48) linear_data_error = 0.01 247 315 248 316 // … … 302 370 303 371 End 372 373 374 375 // 376 // simple panel to display the 4 detector panels 377 // 378 // TODO: 379 // -- label panels, axes 380 // x- any manipulations, stats ? 381 // x- add an "update" button (to update the status of the data - this may be automatic with an operation) 382 // -- add a "load DIV" button 383 // -- add a "copy" button 384 // x- add a "ratio" button 385 // x- add a "difference" button 386 // -- propagate the error in the arithmetic (see WorkFileMath) 387 // -- un hard-wire the Front carriage from the panel proc 388 389 Proc V_Display_DIV_Panels() 390 PauseUpdate; Silent 1 // building window... 391 NewPanel /W=(720,45,1530,570)/N=VSANS_DIVPanels/K=1 392 DoWindow/C VSANS_DIVPanels 393 // ModifyPanel fixedSize=1,noEdit =1 394 395 396 PopupMenu popup0,pos={17.00,10.00},size={77.00,23.00},proc=V_DispCarriagePopMenuProc,title="Carriage" 397 PopupMenu popup0,mode=1,value= #"\"F;M;\"" 398 PopupMenu popup1,pos={134.00,10.00},size={68.00,23.00},proc=V_DispFolderPopMenuProc,title="Folder" 399 PopupMenu popup1,mode=1,popvalue="RAW",value= #"\"SAM;EMP;BGD;DIV;COR;CAL;RAW;ABS;STO;SUB;DRK;MSK;ADJ;\"" 400 PopupMenu popup2,pos={246.00,10.00},size={83.00,23.00},proc=V_DispOperationPopMenuProc,title="Operation" 401 PopupMenu popup2,mode=1,value= #"\"none;ADJ=STO-SUB;ADJ=STO/SUB;\"" 402 Button button0,pos={440.00,10.00},size={70.00,20.00},proc=V_DispUpdateButtonProc,title="Update" 403 404 405 // Display/W=(745,45,945,425)/HOST=# 406 Display/W=(10,45,210,425)/HOST=# 407 AppendImage/T/G=1 :Packages:NIST:VSANS:RAW:entry:instrument:detector_FL:data // /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly 408 ModifyImage data ctab= {*,*,ColdWarm,0} 409 ModifyImage data ctabAutoscale=3 410 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 411 ModifyGraph mirror=2 412 ModifyGraph nticks=4 413 ModifyGraph minor=1 414 ModifyGraph fSize=9 415 ModifyGraph standoff=0 416 ModifyGraph tkLblRot(left)=90 417 ModifyGraph btLen=3 418 ModifyGraph tlOffset=-2 419 RenameWindow #,Panel_L 420 SetActiveSubwindow ## 421 422 // Display/W=(1300,45,1500,425)/HOST=# 423 Display/W=(565,45,765,425)/HOST=# 424 AppendImage/T/G=1 :Packages:NIST:VSANS:RAW:entry:instrument:detector_FR:data // /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly 425 ModifyImage data ctab= {*,*,ColdWarm,0} 426 ModifyImage data ctabAutoscale=3 427 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 428 ModifyGraph mirror=2 429 ModifyGraph nticks=4 430 ModifyGraph minor=1 431 ModifyGraph fSize=9 432 ModifyGraph standoff=0 433 ModifyGraph tkLblRot(left)=90 434 ModifyGraph btLen=3 435 ModifyGraph tlOffset=-2 436 RenameWindow #,Panel_R 437 SetActiveSubwindow ## 438 439 // Display/W=(945,45,1300,235)/HOST=# 440 Display/W=(210,45,565,235)/HOST=# 441 AppendImage/T/G=1 :Packages:NIST:VSANS:RAW:entry:instrument:detector_FT:data // /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly 442 ModifyImage data ctab= {*,*,ColdWarm,0} 443 ModifyImage data ctabAutoscale=3 444 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 445 ModifyGraph mirror=2 446 ModifyGraph nticks=4 447 ModifyGraph minor=1 448 ModifyGraph fSize=9 449 ModifyGraph standoff=0 450 ModifyGraph tkLblRot(left)=90 451 ModifyGraph btLen=3 452 ModifyGraph tlOffset=-2 453 RenameWindow #,Panel_T 454 SetActiveSubwindow ## 455 456 // Display/W=(945,235,1300,425)/HOST=# 457 Display/W=(210,235,565,425)/HOST=# 458 AppendImage/T/G=1 :Packages:NIST:VSANS:RAW:entry:instrument:detector_FB:data // /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly 459 ModifyImage data ctab= {*,*,ColdWarm,0} 460 ModifyImage data ctabAutoscale=3 461 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 462 ModifyGraph mirror=2 463 ModifyGraph nticks=4 464 ModifyGraph minor=1 465 ModifyGraph fSize=9 466 ModifyGraph standoff=0 467 ModifyGraph tkLblRot(left)=90 468 ModifyGraph btLen=3 469 ModifyGraph tlOffset=-2 470 RenameWindow #,Panel_B 471 SetActiveSubwindow ## 472 // 473 474 String/G root:Packages:NIST:VSANS:Globals:gDIVstr0 = "this is the title box0\rwith two lines" 475 String/G root:Packages:NIST:VSANS:Globals:gDIVstr1 = "this is the title box1\rwith two lines" 476 String/G root:Packages:NIST:VSANS:Globals:gDIVstr2 = "this is the title box2\rwith two lines" 477 String/G root:Packages:NIST:VSANS:Globals:gDIVstr3 = "this is the title box3\rwith two lines" 478 479 480 TitleBox title0 pos={15,450},size={112,36},title=root:Packages:NIST:VSANS:Globals:gDIVstr0,fSize=11 481 TitleBox title1 pos={300,433},size={112,36},title=root:Packages:NIST:VSANS:Globals:gDIVstr1,fSize=11 482 TitleBox title2 pos={300,482},size={112,36},title=root:Packages:NIST:VSANS:Globals:gDIVstr2,fSize=11 483 TitleBox title3 pos={580,450},size={112,36},title=root:Packages:NIST:VSANS:Globals:gDIVstr3,fSize=11 484 485 486 V_UpdateDIVStrings() 487 End 488 489 490 // called by the "update" button 491 Proc V_UpdatePanelDisp() 492 493 ControlInfo popup0 494 String carrStr = S_value 495 496 ControlInfo popup1 497 String folder = S_Value 498 499 // remove the image 500 // append the new image 501 RemoveImage/Z/W=VSANS_DIVPanels#Panel_L data 502 AppendImage/T/G=1/W=VSANS_DIVPanels#Panel_L $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"L:data") 503 SetActiveSubwindow VSANS_DIVPanels#Panel_L 504 ModifyImage data ctab= {*,*,ColdWarm,0} 505 ModifyImage data ctabAutoscale=3 506 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 507 ModifyGraph mirror=2 508 ModifyGraph nticks=4 509 ModifyGraph minor=1 510 ModifyGraph fSize=9 511 ModifyGraph standoff=0 512 ModifyGraph tkLblRot(left)=90 513 ModifyGraph btLen=3 514 ModifyGraph tlOffset=-2 515 SetActiveSubwindow ## 516 517 518 RemoveImage/Z/W=VSANS_DIVPanels#Panel_T data 519 AppendImage/T/G=1/W=VSANS_DIVPanels#Panel_T $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"T:data") 520 SetActiveSubwindow VSANS_DIVPanels#Panel_T 521 ModifyImage data ctab= {*,*,ColdWarm,0} 522 ModifyImage data ctabAutoscale=3 523 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 524 ModifyGraph mirror=2 525 ModifyGraph nticks=4 526 ModifyGraph minor=1 527 ModifyGraph fSize=9 528 ModifyGraph standoff=0 529 ModifyGraph tkLblRot(left)=90 530 ModifyGraph btLen=3 531 ModifyGraph tlOffset=-2 532 SetActiveSubwindow ## 533 534 RemoveImage/Z/W=VSANS_DIVPanels#Panel_B data 535 AppendImage/T/G=1/W=VSANS_DIVPanels#Panel_B $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"B:data") 536 SetActiveSubwindow VSANS_DIVPanels#Panel_B 537 ModifyImage data ctab= {*,*,ColdWarm,0} 538 ModifyImage data ctabAutoscale=3 539 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 540 ModifyGraph mirror=2 541 ModifyGraph nticks=4 542 ModifyGraph minor=1 543 ModifyGraph fSize=9 544 ModifyGraph standoff=0 545 ModifyGraph tkLblRot(left)=90 546 ModifyGraph btLen=3 547 ModifyGraph tlOffset=-2 548 SetActiveSubwindow ## 549 550 RemoveImage/Z/W=VSANS_DIVPanels#Panel_R data 551 AppendImage/T/G=1/W=VSANS_DIVPanels#Panel_R $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"R:data") 552 SetActiveSubwindow VSANS_DIVPanels#Panel_R 553 ModifyImage data ctab= {*,*,ColdWarm,0} 554 ModifyImage data ctabAutoscale=3 555 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 556 ModifyGraph mirror=2 557 ModifyGraph nticks=4 558 ModifyGraph minor=1 559 ModifyGraph fSize=9 560 ModifyGraph standoff=0 561 ModifyGraph tkLblRot(left)=90 562 ModifyGraph btLen=3 563 ModifyGraph tlOffset=-2 564 SetActiveSubwindow ## 565 566 End 567 568 569 570 571 Function V_DispFolderPopMenuProc(pa) : PopupMenuControl 572 STRUCT WMPopupAction &pa 573 574 switch( pa.eventCode ) 575 case 2: // mouse up 576 Variable popNum = pa.popNum 577 String popStr = pa.popStr 578 break 579 case -1: // control being killed 580 break 581 endswitch 582 583 return 0 584 End 585 586 Function V_DispCarriagePopMenuProc(pa) : PopupMenuControl 587 STRUCT WMPopupAction &pa 588 589 switch( pa.eventCode ) 590 case 2: // mouse up 591 Variable popNum = pa.popNum 592 String popStr = pa.popStr 593 break 594 case -1: // control being killed 595 break 596 endswitch 597 598 return 0 599 End 600 601 Function V_DispOperationPopMenuProc(pa) : PopupMenuControl 602 STRUCT WMPopupAction &pa 603 604 switch( pa.eventCode ) 605 case 2: // mouse up 606 Variable popNum = pa.popNum 607 String popStr = pa.popStr 608 break 609 case -1: // control being killed 610 break 611 endswitch 612 613 return 0 614 End 615 616 Function V_DispUpdateButtonProc(ba) : ButtonControl 617 STRUCT WMButtonAction &ba 618 619 switch( ba.eventCode ) 620 case 2: // mouse up 621 // click code here 622 623 // if there is an operation, do it 624 V_DoDIVOperation() 625 626 // update the data that is displayed 627 Execute "V_UpdatePanelDisp()" 628 629 630 // update the global strings 631 V_UpdateDIVStrings() 632 633 634 break 635 case -1: // control being killed 636 break 637 endswitch 638 639 return 0 640 End 641 642 Function V_UpdateDIVStrings() 643 644 SVAR gDIVstr0 = root:Packages:NIST:VSANS:Globals:gDIVstr0 645 SVAR gDIVstr1 = root:Packages:NIST:VSANS:Globals:gDIVstr1 646 SVAR gDIVstr2 = root:Packages:NIST:VSANS:Globals:gDIVstr2 647 SVAR gDIVstr3 = root:Packages:NIST:VSANS:Globals:gDIVstr3 648 649 ControlInfo popup0 650 String carrStr = S_value 651 652 ControlInfo popup1 653 String folder = S_Value 654 655 String formatStr="Avg = %g +/- %g\rMin = %g, Max = %g" 656 657 WaveStats/Q $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"L:data") 658 sprintf gDIVstr0,formatStr,V_avg,V_sdev,V_min,V_max 659 660 WaveStats/Q $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"T:data") 661 sprintf gDIVstr1,formatStr,V_avg,V_sdev,V_min,V_max 662 663 WaveStats/Q $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"B:data") 664 sprintf gDIVstr2,formatStr,V_avg,V_sdev,V_min,V_max 665 666 WaveStats/Q $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"R:data") 667 sprintf gDIVstr3,formatStr,V_avg,V_sdev,V_min,V_max 668 669 TitleBox title0 title=gDIVstr0 670 TitleBox title1 title=gDIVstr1 671 TitleBox title2 title=gDIVstr2 672 TitleBox title3 title=gDIVstr3 673 674 return(0) 675 end 676 677 // if there is a simple operation called, do it 678 Function V_DoDIVOperation() 679 680 ControlInfo popup2 681 String opStr = S_value 682 683 if(cmpstr(opStr,"none")==0) 684 return(0) 685 endif 686 687 ControlInfo popup0 688 String carrStr = S_value 689 // an operation is desired 690 // hard-wired use of STO and SUB, copy results to ADJ 691 692 // make sure that something is in ADJ 693 // TODO -- reset the values of the data in ADJ, or it will look like the wrong calculation was done 694 //V_CopyWorkFolder("STO","ADJ") // this is a macro, use the function instead 695 V_CopyHDFToWorkFolder("STO","ADJ") 696 697 WAVE w_sto_L = $("root:Packages:NIST:VSANS:STO:entry:instrument:detector_"+carrStr+"L:data") 698 WAVE w_sub_L = $("root:Packages:NIST:VSANS:SUB:entry:instrument:detector_"+carrStr+"L:data") 699 Duplicate/O w_sto_L $("root:Packages:NIST:VSANS:ADJ:entry:instrument:detector_"+carrStr+"L:data") 700 WAVE w_adj_L = $("root:Packages:NIST:VSANS:ADJ:entry:instrument:detector_"+carrStr+"L:data") 701 702 WAVE w_sto_R = $("root:Packages:NIST:VSANS:STO:entry:instrument:detector_"+carrStr+"R:data") 703 WAVE w_sub_R = $("root:Packages:NIST:VSANS:SUB:entry:instrument:detector_"+carrStr+"R:data") 704 Duplicate/O w_sto_R $("root:Packages:NIST:VSANS:ADJ:entry:instrument:detector_"+carrStr+"R:data") 705 WAVE w_adj_R = $("root:Packages:NIST:VSANS:ADJ:entry:instrument:detector_"+carrStr+"R:data") 706 707 WAVE w_sto_T = $("root:Packages:NIST:VSANS:STO:entry:instrument:detector_"+carrStr+"T:data") 708 WAVE w_sub_T = $("root:Packages:NIST:VSANS:SUB:entry:instrument:detector_"+carrStr+"T:data") 709 Duplicate/O w_sto_T $("root:Packages:NIST:VSANS:ADJ:entry:instrument:detector_"+carrStr+"T:data") 710 WAVE w_adj_T = $("root:Packages:NIST:VSANS:ADJ:entry:instrument:detector_"+carrStr+"T:data") 711 712 WAVE w_sto_B = $("root:Packages:NIST:VSANS:STO:entry:instrument:detector_"+carrStr+"B:data") 713 WAVE w_sub_B = $("root:Packages:NIST:VSANS:SUB:entry:instrument:detector_"+carrStr+"B:data") 714 Duplicate/O w_sto_B $("root:Packages:NIST:VSANS:ADJ:entry:instrument:detector_"+carrStr+"B:data") 715 WAVE w_adj_B = $("root:Packages:NIST:VSANS:ADJ:entry:instrument:detector_"+carrStr+"B:data") 716 717 718 if(cmpstr(opStr,"ADJ=STO/SUB")==0) 719 w_adj_L = w_sto_L/w_sub_L 720 w_adj_R = w_sto_R/w_sub_R 721 w_adj_T = w_sto_T/w_sub_T 722 w_adj_B = w_sto_B/w_sub_B 723 else 724 w_adj_L = w_sto_L - w_sub_L 725 w_adj_R = w_sto_R - w_sub_R 726 w_adj_T = w_sto_T - w_sub_T 727 w_adj_B = w_sto_B - w_sub_B 728 endif 729 730 return(0) 731 end 732 733 734 // 735 // Simple panel to walk through the steps of generating a DIV file 736 // 737 738 739 740 741 Proc DIV_Setup_Panel() : Panel 742 PauseUpdate; Silent 1 // building window... 743 NewPanel /W=(1207,593,1444,953)/N=DIV_Setup_Panel/K=1 744 DoWindow/C DIV_Setup_Panel 745 Button button0,pos={54.00,10.00},size={120.00,20.00},proc=V_DIVSetupButtonProc,title="Setup Folder" 746 Button button1,pos={54.00,100.00},size={120.00,20.00},proc=V_DIVNormalizeButtonProc,title="Normalize" 747 Button button2,pos={54.00,200.00},size={120.00,20.00},proc=V_DIVSaveButtonProc,title="Save DIV" 748 EndMacro 749 750 // set up the folder structure for the DIV file to fill in 751 Function V_DIVSetupButtonProc(ba) : ButtonControl 752 STRUCT WMButtonAction &ba 753 754 switch( ba.eventCode ) 755 case 2: // mouse up 756 // click code here 757 Execute "Setup_VSANS_DIV_Struct()" 758 break 759 case -1: // control being killed 760 break 761 endswitch 762 763 return 0 764 End 765 766 767 Function V_DIVNormalizeButtonProc(ba) : ButtonControl 768 STRUCT WMButtonAction &ba 769 770 switch( ba.eventCode ) 771 case 2: // mouse up 772 // click code here 773 Execute "V_NormalizeDIV_proc()" 774 break 775 case -1: // control being killed 776 break 777 endswitch 778 779 return 0 780 End 781 782 Function V_DIVSaveButtonProc(ba) : ButtonControl 783 STRUCT WMButtonAction &ba 784 785 switch( ba.eventCode ) 786 case 2: // mouse up 787 // click code here 788 Execute "Save_VSANS_DIV_Nexus()" 789 break 790 case -1: // control being killed 791 break 792 endswitch 793 794 return 0 795 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorCorrections.ipf
r1074 r1075 11 11 // "adjusted" or corrected data sets 12 12 // 13 // may be relocated in the future 14 // 13 15 14 16 15 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_RW_Utils.ipf
r1058 r1075 194 194 detStr = StringFromList(ii, ksDetectorListAll, ";") 195 195 Wave w = V_getDetectorDataW(fname,detStr) 196 // Wave w_err = V_getDetectorDataErrW(fname,detStr) //not here, done above w/V_MakeDataError()196 // Wave w_err = V_getDetectorDataErrW(fname,detStr) //not here, done in V_MakeDataError() by duplicating dataW 197 197 Redimension/D w 198 198 // Redimension/D w_err -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MainPanel.ipf
r1073 r1075 268 268 String ctrlName 269 269 270 //new, May 2009. show a full panel for input 271 BuildDIVPanel() 272 // MakeDIVFile("","") 270 DIV_Setup_Panel() 271 V_Display_DIV_Panels() 273 272 End 274 273 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MaskUtils.ipf
r1073 r1075 571 571 SetScale/P y 0,1, curDispPanel 572 572 573 Wave LookupWave = root:Packages:NIST:VSANS:Globals:logLookupWave 573 NVAR defaultLogScaling = root:Packages:NIST:VSANS:Globals:gLogScalingAsDefault 574 if(defaultLogScaling) 575 Wave LookupWave = root:Packages:NIST:VSANS:Globals:logLookupWave 576 else 577 Wave LookupWave = root:Packages:NIST:VSANS:Globals:linearLookupWave 578 endif 574 579 575 580 //draw the detector panel … … 649 654 AppendImage/W=MaskEditPanel#DetData overlay 650 655 AppendImage/W=MaskEditPanel#DetData currentTube 651 ModifyImage/W=MaskEditPanel#DetData overlay ctab= {0.9,1,BlueRedGreen,0} ,minRGB=NaN,maxRGB=0 656 // ModifyImage/W=MaskEditPanel#DetData overlay ctab= {0.9,1,BlueRedGreen,0} ,minRGB=NaN,maxRGB=0 657 ModifyImage/W=MaskEditPanel#DetData overlay ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,40000) 652 658 ModifyImage/W=MaskEditPanel#DetData currentTube ctab= {0.9,1,CyanMagenta,0} ,minRGB=NaN,maxRGB=0 653 659 // ModifyImage/W=MaskEditPanel#DetData overlay ctab= {0,*,BlueRedGreen,0} -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_RAW_Data_Panel.ipf
r1074 r1075 329 329 xaxval= AxisValFromPixel("","bottom",s.mouseLoc.h) 330 330 yaxval= AxisValFromPixel("","left",s.mouseLoc.v) 331 xloc = round(xaxval) 332 yloc = round(yaxval) 331 // xloc = round(xaxval) 332 // yloc = round(yaxval) 333 xloc = xaxval 334 yloc = yaxval 333 335 334 336 // which tab is selected? -this is the main graph panel (subwindow may not be the active one!) … … 373 375 374 376 // count value to the global 375 gNCounts = w[testX][testY] 377 gNCounts = w[testX][testY] //wrong for T/B panels 378 376 379 377 380 // deduce the detector panel … … 411 414 // pixSizeY = V_getDet_y_pixel_size(gCurDispType,detStr) // written mm? need mm 412 415 // 413 // TODO: these q-values ignore the non-linear corrections!!! 414 // -- What can I do about this? 416 415 417 String destPath = "root:Packages:NIST:VSANS:"+gCurDispType 416 418 Wave data_realDistX = $(destPath + ":entry:instrument:detector_"+detStr+":data_realDistX") … … 428 430 429 431 // TODO 430 // -- removethis - it sets the globals to display to the pixel values, unscaled431 //xloc = testX432 //yloc = testY432 // this - it sets the globals to display to the pixel values, unscaled 433 xloc = testX 434 yloc = testY 433 435 434 436 endif //end if(mouse is over a detector panel) 437 438 435 439 endfor // end loop over list of displayed images 436 440 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_VSANS_Preferences.ipf
r1073 r1075 95 95 Variable/G root:Packages:NIST:VSANS:Globals:gIgnoreDetB = 1 96 96 97 DoAlert 0,"The Back detector will be ignored. Change thisin the Preferences Panel"97 DoAlert 0,"The Back detector will be ignored. This can be changed in the Preferences Panel" 98 98 99 99 // flag to allow adding raw data files with different attenuation (normally not done) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_WorkFolderUtils.ipf
r1073 r1075 383 383 // 384 384 // given the folder, duplicate the data -> linear_data and generate the error 385 // TODO386 // -- do I want to use different names here? If it turns out that I don't need to drag a copy of385 // 386 // x- do I want to use different names here? If it turns out that I don't need to drag a copy of 387 387 // the data around as "linear_data", then I can eliminate that, and rename the error wave 388 // -- be sure the data is either properly written as 2D in the file, or converted to 2D before388 // x- be sure the data is either properly written as 2D in the file, or converted to 2D before 389 389 // duplicating here 390 // -- ? do I recast to DP here. Probably necessary since I'm doing a DP calculation, but Redimension391 // is done in the Raw_to_Work step too. very confusing.390 // x- ? do I recast to DP here? No- V_MakeDataWaves_DP() is called directly prior to this call, so data 391 // coming in is already DP 392 392 Function V_MakeDataError(folderStr) 393 393 String folderStr
Note: See TracChangeset
for help on using the changeset viewer.