- Timestamp:
- Oct 18, 2018 12:09:16 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.