- Timestamp:
- Oct 18, 2018 12:09:16 PM (4 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_DetectorBinning_Utils.ipf
r1108 r1117 54 54 Variable addEmpBgd=0 55 55 56 56 // TODOHIGHRES 57 // this is a slow step - try to figure out how to multithread this efficiently. simply adding the 58 // keyword has little effect. maybe only do this for "B", maybe rewrite the calculation to not use pq indexing 59 // 57 60 String funcStr = VCALC_getModelFunctionStr() 58 61 strswitch(funcStr) … … 64 67 break 65 68 case "Debye": 66 tmpInten = VC_Debye(10,300,0.0001,qTot[p][q])69 MultiThread tmpInten = VC_Debye(10,300,0.0001,qTot[p][q]) 67 70 break 68 71 case "Sphere": … … 278 281 V_NonLinearCorrection_B("VCALC",data,tmpCalibX,tmpCalibY,detStr,destPath) 279 282 // beam center is in pixels, so use the old routine 280 V_ConvertBeamCtr _to_mmB("VCALC","B",destPath)283 V_ConvertBeamCtrPix_to_mmB("VCALC","B",destPath) 281 284 else 282 285 V_NonLinearCorrection("VCALC",data,tmpCalib,tube_width,detStr,destPath) … … 565 568 End 566 569 567 Function VC_Debye(scale,rg,bkg,x)570 ThreadSafe Function VC_Debye(scale,rg,bkg,x) 568 571 Variable scale,rg,bkg 569 572 Variable x … … 701 704 else 702 705 delQ = abs(qy[0][1] - qy[0][0])/2 706 endif 707 708 // TODOHIGHRES 709 // -- is this how I want to handle the too-fine resolution of 1x1 binning? 710 NVAR gHighResBinning = root:Packages:NIST:VSANS:Globals:gHighResBinning 711 712 if(cmpstr(detStr,"B") == 0 && gHighResBinning == 1) 713 delQ = 4*delQ 714 Print "Reset delta Q for binning the back detector to 4x pix = ",delQ 703 715 endif 704 716 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_VCALCPanel_MockUp.ipf
r1109 r1117 1014 1014 Variable/G gBack_h = 50.4 1015 1015 1016 Make/O/D/N=1 :entry:instrument:detector_B:x_pixel_size = 0.034 // 340 micron resolution (units of [cm] here) 1017 Make/O/D/N=1 :entry:instrument:detector_B:y_pixel_size = 0.034 1018 1019 1020 Make/O/D/N=1 :entry:instrument:detector_B:pixel_num_x = 680 // detector pixels in x-direction 1021 Make/O/D/N=1 :entry:instrument:detector_B:pixel_num_y = 1656 1022 1023 1024 // pixel beam center - HDF style 1025 Make/O/D/N=1 :entry:instrument:detector_B:beam_center_x = 340.1 // == x beam center, in pixels +0.1 so I know it's from here 1026 Make/O/D/N=1 :entry:instrument:detector_B:beam_center_y = 828.1 // == y beam center, in pixels 1016 1017 // TODOHIRES -- be sure that all of this is correct, since it is hard-wired values 1018 // -- can't use a switch so I'm using an if(), where the default is 4x4 binning 1019 if(root:Packages:NIST:VSANS:Globals:gHighResBinning == 1) 1020 Make/O/D/N=1 :entry:instrument:detector_B:x_pixel_size = 0.00845 // 340 micron resolution (units of [cm] here) 1021 Make/O/D/N=1 :entry:instrument:detector_B:y_pixel_size = 0.00845 1022 1023 Make/O/D/N=1 :entry:instrument:detector_B:pixel_num_x = 2720 // detector pixels in x-direction 1024 Make/O/D/N=1 :entry:instrument:detector_B:pixel_num_y = 6624 1025 1026 // pixel beam center - HDF style 1027 Make/O/D/N=1 :entry:instrument:detector_B:beam_center_x = 1360.1 // == x beam center, in pixels +0.1 so I know it's from here 1028 Make/O/D/N=1 :entry:instrument:detector_B:beam_center_y = 3312.1 // == y beam center, in pixels 1029 else 1030 Make/O/D/N=1 :entry:instrument:detector_B:x_pixel_size = 0.034 // 340 micron resolution (units of [cm] here) 1031 Make/O/D/N=1 :entry:instrument:detector_B:y_pixel_size = 0.034 1032 1033 Make/O/D/N=1 :entry:instrument:detector_B:pixel_num_x = 680 // detector pixels in x-direction 1034 Make/O/D/N=1 :entry:instrument:detector_B:pixel_num_y = 1656 1035 1036 // pixel beam center - HDF style 1037 Make/O/D/N=1 :entry:instrument:detector_B:beam_center_x = 340.1 // == x beam center, in pixels +0.1 so I know it's from here 1038 Make/O/D/N=1 :entry:instrument:detector_B:beam_center_y = 828.1 // == y beam center, in pixels 1039 endif 1027 1040 1028 1041 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_BeamCenter.ipf
r1103 r1117 54 54 Button button_1,pos={615,20},size={80,20},proc=V_DetFitButtonProc,title="Do Fit" 55 55 Button button_2,pos={744,20},size={80,20},proc=V_DetFitHelpButtonProc,title="Help" 56 Button button_3,pos={730,400},size={110,20},proc=V_CopyCtrButtonProc,title="Copy Centers" 56 Button button_3,pos={730,400},size={110,20},proc=V_CopyCtrButtonProc,title="Copy Centers",disable=2 57 57 Button button_4,pos={615,400},size={110,20},proc=V_CtrTableButtonProc,title="Ctr table" 58 Button button_5,pos={730,440},size={110,20},proc=V_WriteCtrTableButtonProc,title="Write table" 58 Button button_5,pos={730,440},size={110,20},proc=V_WriteCtrTableButtonProc,title="Write table",disable=2 59 59 60 60 … … 211 211 Variable VC_pixSize_X = VCALC_getPixSizeX(str) 212 212 Variable VC_pixSize_Y = VCALC_getPixSizeY(str) 213 // strswitch(str) 214 // case "FL": 215 // NVAR VC_nPix_X = root:Packages:NIST:VSANS:VCALC:gFront_L_nPix_X 216 // NVAR VC_nPix_Y = root:Packages:NIST:VSANS:VCALC:gFront_L_nPix_Y 217 // NVAR VC_pixSize_X = root:Packages:NIST:VSANS:VCALC:gFront_L_pixelX 218 // NVAR VC_pixSize_Y = root:Packages:NIST:VSANS:VCALC:gFront_L_pixelY 219 // // wave newW = $("root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_"+str+":det_"+str) 220 // break 221 // case "FR": 222 // NVAR VC_nPix_X = root:Packages:NIST:VSANS:VCALC:gFront_R_nPix_X 223 // NVAR VC_nPix_Y = root:Packages:NIST:VSANS:VCALC:gFront_R_nPix_Y 224 // NVAR VC_pixSize_X = root:Packages:NIST:VSANS:VCALC:gFront_R_pixelX 225 // NVAR VC_pixSize_Y = root:Packages:NIST:VSANS:VCALC:gFront_R_pixelY 226 // // wave newW = $("root:Packages:NIST:VSANS:VCALC:Front:det_"+str) 227 // break 228 // case "ML": 229 // NVAR VC_nPix_X = root:Packages:NIST:VSANS:VCALC:gMiddle_L_nPix_X 230 // NVAR VC_nPix_Y = root:Packages:NIST:VSANS:VCALC:gMiddle_L_nPix_Y 231 // NVAR VC_pixSize_X = root:Packages:NIST:VSANS:VCALC:gMiddle_L_pixelX 232 // NVAR VC_pixSize_Y = root:Packages:NIST:VSANS:VCALC:gMiddle_L_pixelY 233 // // wave newW = $("root:Packages:NIST:VSANS:VCALC:Middle:det_"+str) 234 // break 235 // case "MR": 236 // NVAR VC_nPix_X = root:Packages:NIST:VSANS:VCALC:gMiddle_R_nPix_X 237 // NVAR VC_nPix_Y = root:Packages:NIST:VSANS:VCALC:gMiddle_R_nPix_Y 238 // NVAR VC_pixSize_X = root:Packages:NIST:VSANS:VCALC:gMiddle_R_pixelX 239 // NVAR VC_pixSize_Y = root:Packages:NIST:VSANS:VCALC:gMiddle_R_pixelY 240 // // wave newW = $("root:Packages:NIST:VSANS:VCALC:Middle:det_"+str) 241 // break 242 // 243 // case "FT": 244 // NVAR VC_nPix_X = root:Packages:NIST:VSANS:VCALC:gFront_T_nPix_X 245 // NVAR VC_nPix_Y = root:Packages:NIST:VSANS:VCALC:gFront_T_nPix_Y 246 // NVAR VC_pixSize_X = root:Packages:NIST:VSANS:VCALC:gFront_T_pixelX 247 // NVAR VC_pixSize_Y = root:Packages:NIST:VSANS:VCALC:gFront_T_pixelY 248 // // wave newW = $("root:Packages:NIST:VSANS:VCALC:Front:det_"+str) 249 // break 250 // case "FB": 251 // NVAR VC_nPix_X = root:Packages:NIST:VSANS:VCALC:gFront_B_nPix_X 252 // NVAR VC_nPix_Y = root:Packages:NIST:VSANS:VCALC:gFront_B_nPix_Y 253 // NVAR VC_pixSize_X = root:Packages:NIST:VSANS:VCALC:gFront_B_pixelX 254 // NVAR VC_pixSize_Y = root:Packages:NIST:VSANS:VCALC:gFront_B_pixelY 255 // // wave newW = $("root:Packages:NIST:VSANS:VCALC:Front:det_"+str) 256 // break 257 // case "MT": 258 // NVAR VC_nPix_X = root:Packages:NIST:VSANS:VCALC:gMiddle_T_nPix_X 259 // NVAR VC_nPix_Y = root:Packages:NIST:VSANS:VCALC:gMiddle_T_nPix_Y 260 // NVAR VC_pixSize_X = root:Packages:NIST:VSANS:VCALC:gMiddle_T_pixelX 261 // NVAR VC_pixSize_Y = root:Packages:NIST:VSANS:VCALC:gMiddle_T_pixelY 262 // // wave newW = $("root:Packages:NIST:VSANS:VCALC:Middle:det_"+str) 263 // break 264 // case "MB": 265 // NVAR VC_nPix_X = root:Packages:NIST:VSANS:VCALC:gMiddle_B_nPix_X 266 // NVAR VC_nPix_Y = root:Packages:NIST:VSANS:VCALC:gMiddle_B_nPix_Y 267 // NVAR VC_pixSize_X = root:Packages:NIST:VSANS:VCALC:gMiddle_B_pixelX 268 // NVAR VC_pixSize_Y = root:Packages:NIST:VSANS:VCALC:gMiddle_B_pixelY 269 // // wave newW = $("root:Packages:NIST:VSANS:VCALC:Middle:det_"+str) 270 // break 271 // 272 // case "B": 273 // return(0) //just exit 274 // break 275 // default: 276 // return(0) //just exit 277 // endswitch 213 278 214 279 215 // if VCALC declare this way … … 427 363 428 364 WaveStats/Q dispW 429 coefW[2] = V_max 430 coefW[0] = 1 365 coefW[2] = V_max //approx peak height 366 coefW[6] = V_avg //approx background 367 coefW[0] = 0 // remove the porod scale 368 coefW[3] = 0.9 //peak width, first guess 431 369 432 370 break … … 773 711 //FT;FB;FL;FR;MT;MB;ML;MR;B; 774 712 Make/O/T/N=9 panelW 775 Make/O/D/N=9 xCtr_pix,yCtr_pix,xCtr_ mm,yCtr_mm713 Make/O/D/N=9 xCtr_pix,yCtr_pix,xCtr_cm,yCtr_cm 776 714 DoWindow/F BCtrTable 777 715 if(V_flag == 0) 778 Edit/W=(547,621,1076,943)/N=BCtrTable panelW,xCtr_pix,yCtr_pix,xCtr_ mm,yCtr_mm716 Edit/W=(547,621,1076,943)/N=BCtrTable panelW,xCtr_pix,yCtr_pix,xCtr_cm,yCtr_cm 779 717 endif 780 718 … … 786 724 detStr = StringFromList(ii, ksDetectorListAll, ";") 787 725 panelW[ii] = detStr 788 xCtr_pix[ii] = V_getDet_beam_center_x_pix(fname,detStr) 789 yCtr_pix[ii] = V_getDet_beam_center_y_pix(fname,detStr) 790 // TODO 791 // and now the mm values 792 xCtr_mm[ii] = V_getDet_beam_center_x_mm(fname,detStr) 793 yCtr_mm[ii] = V_getDet_beam_center_y_mm(fname,detStr) 794 726 795 727 endfor 728 729 // xCtr_pix[ii] = V_getDet_beam_center_x_pix(fname,detStr) 730 // yCtr_pix[ii] = V_getDet_beam_center_y_pix(fname,detStr) 731 // // TODO 732 // // and now the mm values 733 // xCtr_mm[ii] = V_getDet_beam_center_x_mm(fname,detStr) 734 // yCtr_mm[ii] = V_getDet_beam_center_y_mm(fname,detStr) 796 735 return(0) 797 736 End … … 868 807 End 869 808 870 809 // TODO: 810 // if I change any of these values, I need to also change them in the V_FindCentroid function 811 // in V_Marquee_Operation.ipf 871 812 Proc V_fDeriveBeamCenters(x_FrontReference,y_FrontReference,x_MiddleReference,y_MiddleReference) 872 813 Variable x_FrontReference,y_FrontReference,x_MiddleReference,y_MiddleReference -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorCorrections.ipf
r1116 r1117 321 321 // 322 322 // 323 Function V_ConvertBeamCtr _to_mm(folder,detStr,destPath)323 Function V_ConvertBeamCtrPix_to_mm(folder,detStr,destPath) 324 324 String folder,detStr,destPath 325 325 … … 413 413 // these hard-wired values were determined from 6A and WB beam centers. LR values were exactly the same for 414 414 // both beam considitions (+/- 0.0 mm). FTB was +/- 0.8 mm, MTB +/- 2 mm 415 if(cmpstr(detStr,"FL") == 0 || cmpstr(detStr,"FR") == 0) 416 gap = 3.8 //mm 417 endif 418 if(cmpstr(detStr,"FT") == 0 || cmpstr(detStr,"FB") == 0) 419 gap = 5 //mm 420 endif 421 if(cmpstr(detStr,"ML") == 0 || cmpstr(detStr,"MR") == 0) 422 gap = 5.9 //mm 423 endif 424 if(cmpstr(detStr,"MT") == 0 || cmpstr(detStr,"MB") == 0) 425 gap = 5 //mm 426 endif 427 // TODO: this is the line to keep, to replace the hard-wired values 428 // gap = V_getDet_panel_gap(fname,detStr) 429 415 416 gap = V_getDet_panel_gap(folder,detStr) 417 418 // TODO: 419 // -- once the gap fields have been verified, this check can be removed 420 // -- it should only apply to data pre-2018 when the field did not exist in the file 421 // -- any VSANS data from 2018+ should read gap from the file. 422 423 if(gap < -100) //-999999 returned if field is missing from file 424 if(cmpstr(detStr,"FL") == 0 || cmpstr(detStr,"FR") == 0) 425 gap = 3.5 //mm (measured, JB 1/4/18) 426 endif 427 if(cmpstr(detStr,"FT") == 0 || cmpstr(detStr,"FB") == 0) 428 gap = 3.3 //mm (measured, JB 2/1/18) 429 endif 430 if(cmpstr(detStr,"ML") == 0 || cmpstr(detStr,"MR") == 0) 431 gap = 5.9 //mm (measured, JB 1/4/18) 432 endif 433 if(cmpstr(detStr,"MT") == 0 || cmpstr(detStr,"MB") == 0) 434 gap = 18.3 //mm (measured, JB 2/1/18) 435 endif 436 endif 437 430 438 // 431 439 if(cmpstr(orientation,"vertical")==0) … … 547 555 // 548 556 // 549 Function V_ConvertBeamCtr _to_mmB(folder,detStr,destPath)557 Function V_ConvertBeamCtrPix_to_mmB(folder,detStr,destPath) 550 558 String folder,detStr,destPath 551 559 552 560 553 // DoAlert 0,"Error - Beam center is being interpreted as pixels, but needs to be in cm. V_ConvertBeamCtr _to_mmB()"561 // DoAlert 0,"Error - Beam center is being interpreted as pixels, but needs to be in cm. V_ConvertBeamCtrPix_to_mmB()" 554 562 555 563 Wave data_realDistX = $(destPath + ":entry:instrument:detector_"+detStr+":data_realDistX") … … 1391 1399 Wave w,adjW 1392 1400 1401 NVAR gHighResBinning = root:Packages:NIST:VSANS:Globals:gHighResBinning 1402 1393 1403 // this is necessary for some old data with the 150x150 back (dummy) panel 1394 1404 NVAR gIgnoreDetB = root:Packages:NIST:VSANS:Globals:gIgnoreDetB … … 1399 1409 1400 1410 adjW=0 1401 1402 // Variable topX,bottomX 1403 // Variable topY,bottomY 1411 1412 Variable topX,bottomX 1413 Variable topY,bottomY 1414 Variable totalY,ccdX,ccdY 1404 1415 1405 1416 // topX = 7 … … 1408 1419 // bottomX = 5 1409 1420 // bottomY = 35 1410 1411 // middle 1412 adjW[][552,552+552] = w[p][q] 1413 1414 //top 1415 adjW[0+kShift_topX,679][552+552,1655-kShift_topY] = w[p-kShift_topX][q+kShift_topY] 1416 1417 //bottom 1418 adjW[0+kShift_bottomX,679][0+kShift_bottomY,551] = w[p-kShift_bottomX][q-kShift_bottomY] 1421 1422 // TODOHIGHRES 1423 // the detector pix dimensions are hard-wired, be sure the are correct 1424 switch(gHighResBinning) 1425 case 1: 1426 topX = kShift_topX_bin1 1427 topY = kShift_topY_bin1 1428 bottomX = kShift_bottomX_bin1 1429 bottomY = kShift_bottomY_bin1 1430 1431 totalY = 6624 // total YDim 1432 ccdY = 2208 // = YDim/3 1433 ccdX = 2720 // = xDim 1434 break 1435 case 4: 1436 topX = kShift_topX_bin4 1437 topY = kShift_topY_bin4 1438 bottomX = kShift_bottomX_bin4 1439 bottomY = kShift_bottomY_bin4 1440 1441 totalY = 1656 // total YDim 1442 ccdY = 552 // = YDim/3 1443 ccdX = 680 // = xDim 1444 1445 1446 break 1447 default: 1448 Abort "No binning case matches in V_ShiftBackDetImage" 1449 1450 endswitch 1451 1452 // middle 1453 adjW[][ccdY,ccdY+ccdY] = w[p][q] 1454 1455 //top 1456 adjW[0+topX,ccdX-1][ccdY+ccdY,totalY-1-topY] = w[p-topX][q+topY] 1457 1458 //bottom 1459 adjW[0+bottomX,ccdX-1][0+bottomY,ccdY-1] = w[p-bottomX][q-bottomY] 1460 1419 1461 1420 1462 return(0) … … 1432 1474 1433 1475 Wave w = V_getDetectorDataW(folder,"B") 1434 1435 MatrixFilter /N=3 median w 1436 Print "*** median noise filter (ONE pass) applied to the back detector***" 1437 1476 1477 NVAR gHighResBinning = root:Packages:NIST:VSANS:Globals:gHighResBinning 1478 switch(gHighResBinning) 1479 case 1: 1480 MatrixFilter /N=11 /P=1 median w // /P=n flag sets the number of passes (default is 1 pass) 1481 1482 Print "*** median noise filter 11x11 applied to the back detector (1 pass) ***" 1483 break 1484 case 4: 1485 MatrixFilter /N=3 /P=1 median w // /P=n flag sets the number of passes (default is 1 pass) 1486 1487 Print "*** median noise filter 3x3 applied to the back detector (1 pass) ***" 1488 break 1489 default: 1490 Abort "No binning case matches in V_MedianFilterBack" 1491 endswitch 1492 1438 1493 return(0) 1439 1494 End … … 1474 1529 Wave w = V_getDetectorDataW(folder,"B") 1475 1530 w -= readNoise // a constant value 1476 1477 MatrixFilter /N=3 median w 1478 Print "*** median noise filter applied to the back detector***" 1479 1531 1532 NVAR gHighResBinning = root:Packages:NIST:VSANS:Globals:gHighResBinning 1533 switch(gHighResBinning) 1534 case 1: 1535 MatrixFilter /N=11 /P=1 median w // /P=n flag sets the number of passes (default is 1 pass) 1536 1537 Print "*** median noise filter 11x11 applied to the back detector (1 pass) ***" 1538 break 1539 case 4: 1540 MatrixFilter /N=3 /P=1 median w // /P=n flag sets the number of passes (default is 1 pass) 1541 1542 Print "*** median noise filter 3x3 applied to the back detector (1 pass) ***" 1543 break 1544 default: 1545 Abort "No binning case matches in V_MedianAndReadNoiseBack" 1546 endswitch 1547 1480 1548 return(0) 1481 1549 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_RW_Utils.ipf
r1114 r1117 148 148 // -- the pixel value is needed for display of the panels 149 149 if(kBCTR_CM) 150 //V_ConvertBeamCtr _to_mm(folder,detStr,destPath)150 //V_ConvertBeamCtrPix_to_mm(folder,detStr,destPath) 151 151 // 152 152 … … 164 164 else 165 165 // beam center is in pixels, so use the old routine 166 V_ConvertBeamCtr _to_mm(folder,detStr,destPath)166 V_ConvertBeamCtrPix_to_mm(folder,detStr,destPath) 167 167 endif 168 168 … … 211 211 212 212 // beam center is in pixels, so use the old routine 213 V_ConvertBeamCtr _to_mmB(folder,detStr,destPath)213 V_ConvertBeamCtrPix_to_mmB(folder,detStr,destPath) 214 214 215 215 // endif -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Initialize.ipf
r1114 r1117 30 30 // for the change in July 2017 where the beam center is now defined in cm, rather than pixels. 31 31 // this need not ever change from 1 32 // the back detector is always treated as a beam center in pixels, since it is the natural definition 32 33 Constant kBCTR_CM = 1 //set to 1 to use beam center in cm. O to use pixels 33 34 … … 84 85 // 85 86 // 200 appears to be a better value - (empirical, based on teflon/converging pinhole data) 86 Constant kReadNoiseLevel = 200 87 //Constant kReadNoiseLevel = 208 88 Constant kReadNoiseLevel_Err = 14 87 Constant kReadNoiseLevel_bin4 = 200 88 //Constant kReadNoiseLevel_bin4 = 208 89 Constant kReadNoiseLevel_Err_bin4 = 14 90 91 92 // TODOHIGHRES: these values are complete fiction 93 Constant kReadNoiseLevel_bin1 = 20 94 Constant kReadNoiseLevel_Err_bin1 = 1 89 95 90 96 … … 96 102 // middle CCD is not moved 97 103 // See V_ShiftBackDetImage() for implementation 98 Constant kShift_TopX = 7 99 Constant kShift_TopY = 105 100 Constant kShift_BottomX = 5 101 Constant kShift_BottomY = 35 102 103 104 Constant kShift_TopX_bin4 = 7 105 Constant kShift_TopY_bin4 = 105 106 Constant kShift_BottomX_bin4 = 5 107 Constant kShift_BottomY_bin4 = 35 108 109 // TODOHIGHRES -- these values need to be verified. they are currently simply 4x the bin4 values 110 Constant kShift_TopX_bin1 = 28 111 Constant kShift_TopY_bin1 = 420 112 Constant kShift_BottomX_bin1 = 20 113 Constant kShift_BottomY_bin1 = 130 104 114 105 115 … … 110 120 End 111 121 112 //this is the main init ualization procedure that must be the first thing122 //this is the main initialization procedure that must be the first thing 113 123 //done when opening a new Data reduction experiment 114 124 // … … 131 141 V_InitFolders() 132 142 133 VC_Initialize_Space() //initialize folders for VCALC134 143 135 144 V_InitFakeProtocols() … … 142 151 Endif 143 152 // V_ResizeCmdWindow() 153 154 VC_Initialize_Space() //initialize folders for VCALC 144 155 145 156 // TODO - be sure that NCNR is defined correctly … … 246 257 //set flag if Demo Version is detected 247 258 Variable/G root:Packages:NIST:VSANS:Globals:isDemoVersion = V_isDemo() 259 248 260 249 261 //set XML globals … … 452 464 Printf "Hook cleaned out RawVSANS, experiment saved\r" 453 465 454 466 NVAR gHighResBinning = root:Packages:NIST:VSANS:Globals:gHighResBinning 467 if(gHighResBinning == 1) 455 468 // these KillDF are a bad idea - it wipes out all of the current work 456 469 // whenever a save is done - which is the opposite of what you want 457 470 // to happen when you save! 458 459 // KillDataFolder/Z root:Packages:NIST:VSANS:RAW 460 // KillDataFolder/Z root:Packages:NIST:VSANS:SAM 461 // KillDataFolder/Z root:Packages:NIST:VSANS:EMP 462 // KillDataFolder/Z root:Packages:NIST:VSANS:BGD 463 // KillDataFolder/Z root:Packages:NIST:VSANS:COR 464 // KillDataFolder/Z root:Packages:NIST:VSANS:DIV 465 // KillDataFolder/Z root:Packages:NIST:VSANS:MSK 466 // KillDataFolder/Z root:Packages:NIST:VSANS:ABS 467 // KillDataFolder/Z root:Packages:NIST:VSANS:CAL 468 // KillDataFolder/Z root:Packages:NIST:VSANS:STO 469 // KillDataFolder/Z root:Packages:NIST:VSANS:SUB 470 // KillDataFolder/Z root:Packages:NIST:VSANS:DRK 471 // KillDataFolder/Z root:Packages:NIST:VSANS:ADJ 472 471 472 Printf "Hook cleaned out WORK folders, experiment saved\r" 473 474 KillDataFolder/Z root:Packages:NIST:VSANS:RAW 475 KillDataFolder/Z root:Packages:NIST:VSANS:SAM 476 KillDataFolder/Z root:Packages:NIST:VSANS:EMP 477 KillDataFolder/Z root:Packages:NIST:VSANS:BGD 478 KillDataFolder/Z root:Packages:NIST:VSANS:COR 479 KillDataFolder/Z root:Packages:NIST:VSANS:DIV 480 KillDataFolder/Z root:Packages:NIST:VSANS:MSK 481 KillDataFolder/Z root:Packages:NIST:VSANS:ABS 482 KillDataFolder/Z root:Packages:NIST:VSANS:CAL 483 KillDataFolder/Z root:Packages:NIST:VSANS:STO 484 KillDataFolder/Z root:Packages:NIST:VSANS:SUB 485 KillDataFolder/Z root:Packages:NIST:VSANS:DRK 486 KillDataFolder/Z root:Packages:NIST:VSANS:ADJ 487 KillDataFolder/Z root:Packages:NIST:VSANS:VCALC 488 489 endif 473 490 // re-create anthing that was killed 474 491 V_initFolders() -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MaskUtils.ipf
r1110 r1117 644 644 bottom = top+height 645 645 646 Print left,top,right,bottom646 // Print left,top,right,bottom 647 647 648 648 break … … 836 836 NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument 837 837 Make/O/T/N=1 name = "NG3_VSANS" 838 839 840 // NVAR gHighResBinning = root:Packages:NIST:VSANS:Globals:gHighResBinning 838 841 NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_B 839 Make/O/I/N=(680,1656) data = 0 840 data[][0,5] = 1 841 data[][1650,1655] = 1 842 data[0,5][] = 1 843 data[675,679][] = 1 842 if(root:Packages:NIST:VSANS:Globals:gHighResBinning == 1) 843 // TODOHIGHRES - the pixel values are hard-wired 844 Make/O/I/N=(2720,6624) data = 0 845 846 // TODOHIGHRES -- these values are simply the 4x4 values x4 847 // these will need to be updated 848 data[][0,20] = 1 849 data[][6603,6623] = 1 // 850 data[0,20][] = 1 851 data[2599,2719][] = 1 // 852 853 else 854 Make/O/I/N=(680,1656) data = 0 855 856 data[][0,5] = 1 857 data[][1650,1655] = 1 858 data[0,5][] = 1 859 data[675,679][] = 1 860 861 endif 862 863 844 864 NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_MR 845 865 Make/O/I/N=(48,128) data = 0 … … 908 928 NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry:instrument 909 929 Make/O/T/N=1 name = "NG3_VSANS" 930 931 932 NVAR gHighResBinning = root:Packages:NIST:VSANS:Globals:gHighResBinning 910 933 NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry:instrument:detector_B 911 Make/O/I/N=(680,1656) data = 0 912 data[][0,38] = 1 913 data[][1548,1655] = 1 914 data[0,10][] = 1 915 data[669,679][] = 1 934 switch(gHighResBinning) 935 case 1: 936 // TODOHIGHRES - the pix values are hard-wired 937 Make/O/I/N=(2720,6624) data = 0 938 939 // TODOHIGHRES -- these values are simply the 4x4 values x4 940 // these will need to be updated 941 data[][0,152] = 1 942 data[][6195,6623] = 1 // 107 pix *4 =428 943 data[0,40][] = 1 944 data[2679,2719][] = 1 // 10 pix (*4) 945 946 break 947 case 4: 948 Make/O/I/N=(680,1656) data = 0 949 950 data[][0,38] = 1 951 data[][1548,1655] = 1 952 data[0,10][] = 1 953 data[669,679][] = 1 954 break 955 default: 956 Abort "No binning case matches in V_GenerateDefaultMask" 957 endswitch 958 959 916 960 NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry:instrument:detector_MR 917 961 Make/O/I/N=(48,128) data = 0 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_PatchFiles.ipf
r1106 r1117 2849 2849 return(0) 2850 2850 End 2851 2852 // 2853 // simple utility to patch all of the pixel sizes 2854 // - in the header, the Y size for LR panels was grossly wrong (4 mm) 2855 // and all of the values are slightly off from the true values 2856 // 2857 // data collected after 10/3/18 should not need this patch since the 2858 // config.js file was updated 2859 // 2860 // 2861 // 2862 // lo is the first file number 2863 // hi is the last file number (inclusive) 2864 // 2865 Function V_fPatch_XYPixelSize(lo,hi) 2866 Variable lo,hi 2867 2868 2869 Variable ii,jj 2870 String fname,detStr 2871 2872 2873 //loop over all files 2874 for(jj=lo;jj<=hi;jj+=1) 2875 fname = V_FindFileFromRunNumber(jj) 2876 if(strlen(fname) != 0) 2877 2878 // patch pixel size x and y [cm] L/R panels 2879 V_writeDet_x_pixel_size(fname,"FL",8.4) 2880 V_writeDet_y_pixel_size(fname,"FL",8.14) 2881 2882 V_writeDet_x_pixel_size(fname,"FR",8.4) 2883 V_writeDet_y_pixel_size(fname,"FR",8.14) 2884 2885 V_writeDet_x_pixel_size(fname,"ML",8.4) 2886 V_writeDet_y_pixel_size(fname,"ML",8.14) 2887 2888 V_writeDet_x_pixel_size(fname,"MR",8.4) 2889 V_writeDet_y_pixel_size(fname,"MR",8.14) 2890 2891 // patch pixel size x and y [cm] T/B panels 2892 V_writeDet_x_pixel_size(fname,"FT",4.16) 2893 V_writeDet_y_pixel_size(fname,"FT",8.4) 2894 2895 V_writeDet_x_pixel_size(fname,"FB",4.16) 2896 V_writeDet_y_pixel_size(fname,"FB",8.4) 2897 2898 V_writeDet_x_pixel_size(fname,"MT",4.16) 2899 V_writeDet_y_pixel_size(fname,"MT",8.4) 2900 2901 V_writeDet_x_pixel_size(fname,"MB",4.16) 2902 V_writeDet_y_pixel_size(fname,"MB",8.4) 2903 2904 else 2905 printf "run number %d not found\r",jj 2906 endif 2907 endfor 2908 2909 return(0) 2910 End 2911 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Protocol_Reduction.ipf
r1116 r1117 2526 2526 // and determine box sum and error 2527 2527 // store these locally 2528 2529 2530 if(cmpstr(detStr,"B") == 0 ) 2531 Print "Median Filtering RAW data (3 passes)" 2532 Wave w = V_getDetectorDataW("RAW",detStr) 2533 MatrixFilter /N=3 /P=3 median w 2528 Variable tmpReadNoiseLevel,tmpReadNoiseLevel_Err 2529 2530 // TODO: change the math to do the filtering and subtraction both here in this step, 2531 // then determine the patch sum and proper error propogation. 2532 // 2533 // just do the median filter now, do the background subtraction later on the patch 2534 if(isBack) 2535 Wave w = V_getDetectorDataW("RAW","B") 2536 NVAR gHighResBinning = root:Packages:NIST:VSANS:Globals:gHighResBinning 2537 switch(gHighResBinning) 2538 case 1: 2539 tmpReadNoiseLevel = kReadNoiseLevel_bin1 // a constant value 2540 tmpReadNoiseLevel_Err = kReadNoiseLevel_Err_bin1 // a constant value 2541 2542 MatrixFilter /N=11 /P=1 median w // /P=n flag sets the number of passes (default is 1 pass) 2543 2544 Print "*** median noise filter 11x11 applied to the back detector (1 pass) ***" 2545 break 2546 case 4: 2547 tmpReadNoiseLevel = kReadNoiseLevel_bin4 // a constant value 2548 tmpReadNoiseLevel_Err = kReadNoiseLevel_Err_bin4 // a constant value 2549 2550 MatrixFilter /N=3 /P=3 median w // /P=n flag sets the number of passes (default is 1 pass) 2551 2552 Print "*** median noise filter 3x3 applied to the back detector (3 passes) ***" 2553 break 2554 default: 2555 Abort "No binning case matches in V_AskForAbsoluteParams_Quest" 2556 endswitch 2557 2534 2558 endif 2535 2559 … … 2561 2585 // 2562 2586 nPixInBox = (xyBoxW[1] - xyBoxW[0])*(xyBoxW[3]-xyBoxW[2]) 2563 emptyCts -= kReadNoiseLevel*nPixInBox2564 empty_ct_err = sqrt(empty_ct_err^2 + ( kReadNoiseLevel_Err*nPixInBox)^2)2587 emptyCts -= tmpReadNoiseLevel*nPixInBox 2588 empty_ct_err = sqrt(empty_ct_err^2 + (tmpReadNoiseLevel_Err*nPixInBox)^2) 2565 2589 2566 2590 Print "adjusted empty counts = ",emptyCts -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Testing_Data_Procs.ipf
r1106 r1117 86 86 if(cmpstr(detStr,"B") == 0) 87 87 //always write out the center of the detector since this is dummy data 88 V_writeDet_beam_center_x(fileName,detStr,V_getDet_beam_center_x("VCALC",detStr)/10) //write out [cm] 89 V_writeDet_beam_center_y(fileName,detStr,V_getDet_beam_center_y("VCALC",detStr)/10) 88 // the back detector always has its beam center in pixels 89 V_writeDet_beam_center_x(fileName,detStr,V_getDet_beam_center_x("VCALC",detStr)) 90 V_writeDet_beam_center_y(fileName,detStr,V_getDet_beam_center_y("VCALC",detStr)) 90 91 91 92 // write out the number of pixels x and y … … 115 116 116 117 117 // writes out "perfect" detector calibration constants for all 8 tube banks 118 // writes out "perfect" detector calibration constants for all 8 tube banks + back detector 118 119 V_WritePerfectSpatialCalib(filename) 119 120 // writes out "perfect" dead time constants for all 8 tube banks + back detector … … 195 196 196 197 // and for the back detector "B" 198 NVAR gHighResBinning = root:Packages:NIST:VSANS:Globals:gHighResBinning 199 Variable tmpPix 200 if(gHighResBinning == 1) 201 tmpPix = 0.00845 //[cm] 202 else 203 //binning 4x4 assumed 204 tmpPix = 0.034 205 endif 206 197 207 Make/O/D/N=3 tmpCalib 198 tmpCalib[0] = 1208 tmpCalib[0] = tmpPix 199 209 tmpCalib[1] = 1 200 210 tmpcalib[2] = 10000 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Utilities_Comparisons.ipf
r1105 r1117 15 15 // so passing 0.01*val_1 = 1% tolerance, as long as val_1 can't be zero 16 16 // 17 // SEP 2018 -- increased the tolerance to 2%, since I was getting false differences 18 // especially for the lateral offset after switching from trans->scatter configs. Panel 19 // was returning to postion, but within 2% (since the value was near zero) 17 20 // 18 21 … … 302 305 303 306 if(val1 != 0) 304 tol = abs(0.0 1* val1)307 tol = abs(0.02 * val1) 305 308 else 306 tol = abs(0.0 1* val2)309 tol = abs(0.02 * val2) 307 310 endif 308 311 … … 328 331 329 332 if(val1 != 0) 330 tol = abs(0.0 1* val1)333 tol = abs(0.02 * val1) 331 334 else 332 tol = abs(0.0 1* val2)335 tol = abs(0.02 * val2) 333 336 endif 334 337 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_VSANS_Preferences.ipf
r1109 r1117 94 94 val = NumVarOrDefault("root:Packages:NIST:VSANS:Globals:gIgnoreDetB", 1 ) 95 95 Variable/G root:Packages:NIST:VSANS:Globals:gIgnoreDetB = 1 96 96 97 // TODOHIGHRES 98 // OCT 2018 99 // new global to flag the highRes detector binning to accomodate the change in binning 100 // that was set 10/16/18 (changed from 4x4 bin to 1x1= no binning) 101 // set this flag == 1 for 1x1 102 // set flag 4 == 4x4 103 Variable/G root:Packages:NIST:VSANS:Globals:gHighResBinning = 4 104 97 105 DoAlert 1,"Are you using the back detector? (This can be changed later in the Preferences Panel)" 98 106 if(V_flag == 1) 99 107 // yes 100 108 Variable/G root:Packages:NIST:VSANS:Globals:gIgnoreDetB = 0 109 DoAlert 1,"Are you using 1x1 binning?" 110 if(V_flag == 1) 111 // yes 112 Variable/G root:Packages:NIST:VSANS:Globals:gHighResBinning = 1 113 endif 101 114 endif 102 115 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_WorkFolderUtils.ipf
r1115 r1117 511 511 if(gIgnoreDetB == 0) 512 512 Wave w = V_getDetectorDataW(fname,"B") 513 w -= kReadNoiseLevel // a constant value 514 515 MatrixFilter /N=3 /P=3 median w // /P=n flag sets the number of passes (default is 1 pass) 516 Print "*** median noise filter applied to the back detector (3 passes) ***" 513 514 NVAR gHighResBinning = root:Packages:NIST:VSANS:Globals:gHighResBinning 515 516 switch(gHighResBinning) 517 case 1: 518 w -= kReadNoiseLevel_bin1 // a constant value 519 520 MatrixFilter /N=11 /P=1 median w // /P=n flag sets the number of passes (default is 1 pass) 521 522 Print "*** median noise filter 11x11 applied to the back detector (1 pass) ***" 523 break 524 case 4: 525 w -= kReadNoiseLevel_bin4 // a constant value 526 527 MatrixFilter /N=3 /P=3 median w // /P=n flag sets the number of passes (default is 1 pass) 528 529 Print "*** median noise filter 3x3 applied to the back detector (3 passes) ***" 530 break 531 default: 532 Abort "No binning case matches in V_Raw_to_Work" 533 endswitch 534 517 535 endif 518 536 … … 582 600 // -- the pixel value is needed for display of the panels 583 601 if(kBCTR_CM) 584 //V_ConvertBeamCtr _to_mm(folder,detStr,destPath)602 //V_ConvertBeamCtrPix_to_mm(folder,detStr,destPath) 585 603 // 586 604 … … 598 616 else 599 617 // beam center is in pixels, so use the old routine 600 V_ConvertBeamCtr _to_mm(fname,detStr,destPath)618 V_ConvertBeamCtrPix_to_mm(fname,detStr,destPath) 601 619 endif 602 620 … … 640 658 // else 641 659 // beam center is in pixels, so use the old routine 642 V_ConvertBeamCtr _to_mmB(fname,detStr,destPath)660 V_ConvertBeamCtrPix_to_mmB(fname,detStr,destPath) 643 661 644 662 // endif
Note: See TracChangeset
for help on using the changeset viewer.