- Timestamp:
- Feb 9, 2018 3:47:28 PM (5 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_BeamCenter.ipf
r1064 r1083 838 838 839 839 End 840 841 842 843 844 ////////////////// 845 // 846 // Simple utility to calculate beam centers [cm] based on a single measurement 847 // and empirical relations between the panel zero positions 848 // 849 // Empirical relations are derived from beam center measurements using 6A data and WB data (9/10/17) 850 // only measurements on L, R, and x-coordinate of B were used. T panel cannot be translated down far enough 851 // to reach the direct beam. 852 // 853 // Start with the (default) case of a beam center measured on R (MR or FR) 854 // 855 // Empirical values are averaged as noted 856 // 857 858 Proc V_DeriveBeamCenters() 859 860 Make/O/T panelWave = {"FL","FR","FT","FB","ML","MR","MT","MB","B"} 861 Make/O/D/N=9 newXCtr_cm,newYCtr_cm 862 863 Edit panelWave,newXCtr_cm,newYCtr_cm 864 865 DoAlert 0, "enter the measured beam center for FR and MR panels" 866 V_fDeriveBeamCenters() 867 868 End 869 870 871 Proc V_fDeriveBeamCenters(xFR,yFR,xMR,yMR) 872 Variable xFR,yFR,xMR,yMR 873 874 // start with the front 875 // FR 876 newXCtr_cm[1] = xFR 877 newYCtr_cm[1] = yFR 878 // FL 879 newXCtr_cm[0] = xFR - (0.03 + 0.03)/2 880 newYCtr_cm[0] = yFR + (0.34 + 0.32)/2 881 // FB 882 newXCtr_cm[3] = xFR - (2.02 + 2.06)/2 883 newYCtr_cm[3] = yFR - (0.12 + 0.19)/2 884 // FT (duplicate FB) 885 newXCtr_cm[2] = newXCtr_cm[3] 886 newYCtr_cm[2] = newYCtr_cm[3] 887 888 // MR 889 newXCtr_cm[5] = xMR 890 newYCtr_cm[5] = yMR 891 // ML 892 newXCtr_cm[4] = xMR - (0.06 + 0.05)/2 893 newYCtr_cm[4] = yMR + (0.14 + 0.01)/2 894 // MB 895 newXCtr_cm[7] = xMR - (0.51 + 0.62)/2 896 newYCtr_cm[7] = yMR + (0.79 + 0.74)/2 897 // MT (duplicate MB) 898 newXCtr_cm[6] = newXCtr_cm[7] 899 newYCtr_cm[6] = newYCtr_cm[7] 900 901 902 // dummy value for B 903 newXCtr_cm[8] = 50 904 newYCtr_cm[8] = 50 905 906 907 return 908 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorCorrections.ipf
r1081 r1083 156 156 // kPanelTouchingGap is in mm 157 157 // the gap is split equally between the panel pairs 158 // TODO -- replace all of this with V_getDet_panel_gap(fname,detStr) once it is added to the file 159 // these hard-wired values were determined from 6A and WB beam centers. LR values were exactly the same for 160 // both beam conditions (+/- 0.0 mm). FTB was +/- 0.8 mm, MTB +/- 2 mm 161 if(cmpstr(detStr,"FL") == 0 || cmpstr(detStr,"FR") == 0) 162 gap = 3.5 //mm (measured, JB 1/4/18) 163 endif 164 if(cmpstr(detStr,"FT") == 0 || cmpstr(detStr,"FB") == 0) 165 gap = 3.3 //mm (measured, JB 2/1/18) 166 endif 167 if(cmpstr(detStr,"ML") == 0 || cmpstr(detStr,"MR") == 0) 168 gap = 5.9 //mm (measured, JB 1/4/18) 169 endif 170 if(cmpstr(detStr,"MT") == 0 || cmpstr(detStr,"MB") == 0) 171 gap = 18.3 //mm (measured, JB 2/1/18) 172 endif 173 // TODO: this is the line to keep, to replace the hard-wired values 174 // gap = V_getDet_panel_gap(fname,detStr) 158 // (DONE) -- replace all of this with V_getDet_panel_gap(fname,detStr) once it is added to the file 159 160 gap = V_getDet_panel_gap(fname,detStr) 161 162 // TODO: 163 // -- once the gap fields have been verified, this check can be removed 164 // -- it should only apply to data pre-2018 when the field did not exist in the file 165 // -- any VSANS data from 2018+ should read gap from the file. 166 167 if(gap < -100) //-999999 returned if field is missing from file 168 169 if(cmpstr(detStr,"FL") == 0 || cmpstr(detStr,"FR") == 0) 170 gap = 3.5 //mm (measured, JB 1/4/18) 171 endif 172 if(cmpstr(detStr,"FT") == 0 || cmpstr(detStr,"FB") == 0) 173 gap = 3.3 //mm (measured, JB 2/1/18) 174 endif 175 if(cmpstr(detStr,"ML") == 0 || cmpstr(detStr,"MR") == 0) 176 gap = 5.9 //mm (measured, JB 1/4/18) 177 endif 178 if(cmpstr(detStr,"MT") == 0 || cmpstr(detStr,"MB") == 0) 179 gap = 18.3 //mm (measured, JB 2/1/18) 180 endif 181 182 endif 183 175 184 176 185 if(cmpstr(orientation,"vertical")==0) … … 1355 1364 //check for DIV 1356 1365 // if the DIV workfile doesn't exist, let the user know,and abort 1357 1358 WAVE/Z div_data_err = V_getDetectorDataErrW("DIV",detStr) 1359 WAVE/Z div_data = V_getDetectorDataW("DIV",detStr) 1360 1366 // !! be sure to check first, before trying to access the wave 1367 1361 1368 // WAVE/Z div_data = $("root:Packages:NIST:VSANS:DIV:entry:instrument:detector_"+detStr+":data") 1362 if(WaveExists( div_data) == 0)1369 if(WaveExists($("root:Packages:NIST:VSANS:DIV:entry:instrument:detector_"+detStr+":data")) == 0) 1363 1370 Print "The DIV wave does not exist in V_DIVCorrection()" 1364 1371 Return(1) //error condition 1365 1372 Endif 1366 if(WaveExists( div_data_err) == 0)1373 if(WaveExists($("root:Packages:NIST:VSANS:DIV:entry:instrument:detector_"+detStr+":linear_data_error")) == 0) 1367 1374 Print "The DIV error wave does not exist in V_DIVCorrection()" 1368 1375 Return(1) //error condition … … 1370 1377 //files exist, proceed 1371 1378 1379 WAVE/Z div_data_err = V_getDetectorDataErrW("DIV",detStr) 1380 WAVE/Z div_data = V_getDetectorDataW("DIV",detStr) 1381 1382 1383 1372 1384 // do the error propagation first, since data is changed by the correction 1373 1385 data_err = sqrt(data_err^2/div_data^2 + div_data_err^2 * data^2/div_data^4 ) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Write.ipf
r1072 r1083 4425 4425 String groupName = "/entry/instrument/detector_"+detStr 4426 4426 String varName = "setback" 4427 wTmpWrite[0] = val 4428 4429 variable err 4430 err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 4431 if(err) 4432 Print "HDF write err = ",err 4433 endif 4434 // now be sure to kill the data folder to force a re-read of the data next time this file is read in 4435 // err = V_KillNamedDataFolder(fname) 4436 // if(err) 4437 // Print "DataFolder kill err = ",err 4438 // endif 4439 return(err) 4440 End 4441 4442 // gap when panels are "touching" 4443 // units are mm 4444 // writes panel gap for detector panel specified 4445 // does not write anything if "B" is passed (no such field for this detector) 4446 // 4447 Function V_writeDet_panel_gap(fname,detStr,val) 4448 String fname,detStr 4449 Variable val 4450 4451 if(cmpstr(detStr,"B") == 0) 4452 return(0) 4453 endif 4454 4455 // String path = "entry:instrument:detector_"+detStr+":panel_gap" 4456 4457 Make/O/D/N=1 wTmpWrite 4458 // Make/O/R/N=1 wTmpWrite 4459 String groupName = "/entry/instrument/detector_"+detStr 4460 String varName = "panel_gap" 4427 4461 wTmpWrite[0] = val 4428 4462 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Menu.ipf
r1081 r1083 28 28 "Annular Binning",Annular_Binning() 29 29 "Write Annular Data",V_Write1DAnnular() 30 "-" 31 "Derive Beam Centers",V_DeriveBeamCenters() 30 32 End 31 33 Submenu "Work Files" … … 50 52 "Patch Purpose using CatTable",V_Patch_Purpose_catTable() 51 53 "Patch Intent using CatTable",V_Patch_Intent_catTable() 54 "Patch Detector Panel Gap",V_PatchDet_Gap() 55 "Read Detetcor Panel Gap",V_ReadDet_Gap() 56 "Patch Detector Distance",V_PatchDet_Distance() 52 57 "-" 53 58 "Setup_VSANS_DIV_Struct" -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_PatchFiles.ipf
r1079 r1083 2354 2354 end 2355 2355 2356 2356 Proc V_PatchDet_Gap(lo,hi) 2357 Variable lo,hi 2358 2359 V_fPatchDet_Gap(lo,hi) 2360 End 2361 2362 Proc V_ReadDet_Gap(lo,hi) 2363 Variable lo,hi 2364 2365 V_fReadDet_Gap(lo,hi) 2366 2367 Proc V_PatchDet_Distance(lo,hi,dist_f,dist_m,dist_b) 2368 Variable lo,hi,dist_f=400,dist_m=1900,dist_b=2200 2369 2370 V_fPatchDet_distance(lo,hi,dist_f,dist_m,dist_b) 2371 End 2357 2372 // simple utility to patch the offset values in the file headers 2358 2373 // … … 2498 2513 return(0) 2499 2514 End 2515 2516 2517 2518 // simple utility to patch the detector gap values in the file headers 2519 // 2520 // values are measured values in [mm], not estimated 2521 // 2522 // lo is the first file number 2523 // hi is the last file number (inclusive) 2524 // 2525 Function V_fPatchDet_Gap(lo,hi) 2526 Variable lo,hi 2527 2528 2529 Variable ii,jj 2530 String fname,detStr 2531 2532 //loop over all files 2533 for(jj=lo;jj<=hi;jj+=1) 2534 fname = V_FindFileFromRunNumber(jj) 2535 if(strlen(fname) != 0) 2536 2537 // write gap values 2538 V_writeDet_panel_gap(fname,"FL",3.5) 2539 V_writeDet_panel_gap(fname,"FR",3.5) 2540 2541 V_writeDet_panel_gap(fname,"FT",3.3) 2542 V_writeDet_panel_gap(fname,"FB",3.3) 2543 2544 V_writeDet_panel_gap(fname,"ML",5.9) 2545 V_writeDet_panel_gap(fname,"MR",5.9) 2546 2547 V_writeDet_panel_gap(fname,"MT",18.3) 2548 V_writeDet_panel_gap(fname,"MB",18.3) 2549 2550 else 2551 printf "run number %d not found\r",jj 2552 endif 2553 endfor 2554 2555 return(0) 2556 End 2557 2558 // simple utility to read the detector gap values stored in the file header 2559 Function V_fReadDet_Gap(lo,hi) 2560 Variable lo,hi 2561 2562 String fname,detStr 2563 Variable jj 2564 Variable gap_FL,gap_FR,gap_FT,gap_FB,gap_ML,gap_MR,gap_MT,gap_MB 2565 2566 for(jj=lo;jj<=hi;jj+=1) 2567 fname = V_FindFileFromRunNumber(jj) 2568 if(strlen(fname) != 0) 2569 2570 gap_FL = V_getDet_panel_gap(fname,"FL") 2571 gap_FR = V_getDet_panel_gap(fname,"FR") 2572 gap_FT = V_getDet_panel_gap(fname,"FT") 2573 gap_FB = V_getDet_panel_gap(fname,"FB") 2574 2575 gap_ML = V_getDet_panel_gap(fname,"ML") 2576 gap_MR = V_getDet_panel_gap(fname,"MR") 2577 gap_MT = V_getDet_panel_gap(fname,"MT") 2578 gap_MB = V_getDet_panel_gap(fname,"MB") 2579 2580 print fname 2581 Print "FL, FR, FT, FB = ",gap_FL,gap_FR,gap_FT,gap_FB 2582 Print "ML, MR, MT, MB = ",gap_ML,gap_MR,gap_MT,gap_MB 2583 2584 2585 else 2586 printf "run number %d not found\r",jj 2587 endif 2588 2589 endfor 2590 2591 2592 return(0) 2593 End 2594 2595 2596 // simple utility to patch the detector distance values in the file headers 2597 // 2598 // values are in [cm] 2599 // 2600 // lo is the first file number 2601 // hi is the last file number (inclusive) 2602 // 2603 Function V_fPatchDet_distance(lo,hi,d_f,d_m,d_b) 2604 Variable lo,hi,d_f,d_m,d_b 2605 2606 2607 Variable ii,jj 2608 String fname,detStr 2609 2610 //loop over all files 2611 for(jj=lo;jj<=hi;jj+=1) 2612 fname = V_FindFileFromRunNumber(jj) 2613 if(strlen(fname) != 0) 2614 2615 // write gap values 2616 V_writeDet_distance(fname,"FL",d_f) 2617 V_writeDet_distance(fname,"FR",d_f) 2618 V_writeDet_distance(fname,"FT",d_f) 2619 V_writeDet_distance(fname,"FB",d_f) 2620 2621 V_writeDet_distance(fname,"ML",d_m) 2622 V_writeDet_distance(fname,"MR",d_m) 2623 V_writeDet_distance(fname,"MT",d_m) 2624 V_writeDet_distance(fname,"MB",d_m) 2625 2626 V_writeDet_distance(fname,"B",d_b) 2627 2628 else 2629 printf "run number %d not found\r",jj 2630 endif 2631 endfor 2632 2633 return(0) 2634 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_RAW_Data_Panel.ipf
r1079 r1083 219 219 220 220 Make/O/D tmp_asdf 221 // for back panels (in pixels ?)221 // for back panels (in pixels) 222 222 // Display/W=(50,185,545,620)/HOST=# tmp_asdf 223 223 Display/W=(50,185,517,620)/HOST=# tmp_asdf … … 227 227 ModifyGraph rgb=(0,0,0) 228 228 ModifyGraph tick=2,mirror=1 229 Label left "pixels" 230 Label bottom "pixels" 229 // Label left "pixels" //don't bother labeling pixels here - it will get redrawn, do it 230 // Label bottom "pixels" // when the selected tab is resized to be the focus 231 231 SetActiveSubwindow ## 232 232 … … 238 238 ModifyGraph rgb=(0,0,0) 239 239 ModifyGraph tick=2,mirror=1 240 Label left "pixels"241 Label bottom "pixels"240 // Label left "pixels" 241 // Label bottom "pixels" 242 242 SetActiveSubwindow ## 243 243 … … 249 249 ModifyGraph rgb=(0,0,0) 250 250 ModifyGraph tick=2,mirror=1 251 Label left "pixels"252 Label bottom "pixels"251 // Label left "pixels" 252 // Label bottom "pixels" 253 253 SetActiveSubwindow ## 254 254 … … 552 552 553 553 SetActiveSubWindow VSANS_Data#det_panelsB 554 Label left "pixels" 555 Label bottom "pixels" 554 556 SetDataFolder root: 555 557 endif … … 608 610 609 611 SetActiveSubWindow VSANS_Data#det_panelsM 612 Label left "pixels" 613 Label bottom "pixels" 610 614 SetDataFolder root: 611 615 endif … … 664 668 665 669 SetActiveSubWindow VSANS_Data#det_panelsF 670 Label left "pixels" 671 Label bottom "pixels" 666 672 SetDataFolder root: 667 673 endif -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Transmission.ipf
r1072 r1083 10 10 // ?? redesign the panel based on the CATALOG? 11 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. 12 20 // 13 21 … … 34 42 PopupMenu popup_1,pos={102,248},size={72.00,23.00},proc=V_TTransmFilePopMenuProc,title="Transmission" 35 43 PopupMenu popup_1,mode=1,value= V_getFilePurposeList("TRANSMISSION",0) 36 PopupMenu popup_2,pos={164,353},size={72.00,23.00},proc=V_TEmpBeamPopMenuProc,title="Empty Beam" 37 PopupMenu popup_2,mode=1,value= V_getFileIntentList("EMPTY BEAM",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) 38 47 Button button_0,pos={37,193},size={100.00,20.00},proc=V_CalcTransmButtonProc,title="Calculate" 39 48 // Button button_1,pos={23.00,491.00},size={100.00,20.00},proc=V_WriteTransmButtonProc,title="Write" … … 124 133 // x- fill in the XY box 125 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 126 136 // 127 list = V_getFileIntentList("EMPTY BEAM",0) 137 // list = V_getFileIntentList("EMPTY BEAM",0) 138 list = V_getFileIntentList("OPEN BEAM",0) 128 139 129 140 for(ii=0;ii<np;ii+=1) 130 if(cmpstr(intentW[ii]," EMPTYBEAM")==0)131 Print " emptybeam match at ",filenameW[ii]141 if(cmpstr(intentW[ii],"OPEN BEAM")==0) 142 Print "Open beam match at ",filenameW[ii] 132 143 SetVariable setvar_4,value=labelW[ii] 133 144 PopupMenu popup_2,mode=WhichListItem(fileNameW[ii], list )+1,popValue=fileNameW[ii]
Note: See TracChangeset
for help on using the changeset viewer.