# Changeset 1083 for sans/Dev/trunk/NCNR_User_Procedures

Ignore:
Timestamp:
Feb 9, 2018 3:47:28 PM (5 years ago)
Message:

minor changes to allow patching of more incorrect metadata

added simple way to estimate beam centers from a single measurement (stiil to be thoroughly verified!)

Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
Files:
7 edited

Unmodified
Removed
• ## sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_BeamCenter.ipf

 r1064 End ////////////////// // // Simple utility to calculate beam centers [cm] based on a single measurement //  and empirical relations between the panel zero positions // // Empirical relations are derived from beam center measurements using 6A data and WB data (9/10/17) // only measurements on L, R, and x-coordinate of B were used. T panel cannot be translated down far enough // to reach the direct beam. // // Start with the (default) case of a beam center measured on R (MR or FR) // // Empirical values are averaged as noted // Proc V_DeriveBeamCenters() Make/O/T panelWave = {"FL","FR","FT","FB","ML","MR","MT","MB","B"} Make/O/D/N=9 newXCtr_cm,newYCtr_cm Edit panelWave,newXCtr_cm,newYCtr_cm DoAlert 0, "enter the measured beam center for FR and MR panels" V_fDeriveBeamCenters() End Proc V_fDeriveBeamCenters(xFR,yFR,xMR,yMR) Variable xFR,yFR,xMR,yMR // start with the front // FR newXCtr_cm[1] = xFR newYCtr_cm[1] = yFR // FL newXCtr_cm[0] = xFR - (0.03 + 0.03)/2 newYCtr_cm[0] = yFR + (0.34 + 0.32)/2 // FB newXCtr_cm[3] = xFR - (2.02 + 2.06)/2 newYCtr_cm[3] = yFR - (0.12 + 0.19)/2 // FT (duplicate FB) newXCtr_cm[2] = newXCtr_cm[3] newYCtr_cm[2] = newYCtr_cm[3] // MR newXCtr_cm[5] = xMR newYCtr_cm[5] = yMR // ML newXCtr_cm[4] = xMR - (0.06 + 0.05)/2 newYCtr_cm[4] = yMR + (0.14 + 0.01)/2 // MB newXCtr_cm[7] = xMR - (0.51 + 0.62)/2 newYCtr_cm[7] = yMR + (0.79 + 0.74)/2 // MT (duplicate MB) newXCtr_cm[6] = newXCtr_cm[7] newYCtr_cm[6] = newYCtr_cm[7] // dummy value for B newXCtr_cm[8] = 50 newYCtr_cm[8] = 50 return End
• ## sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorCorrections.ipf

 r1081 // kPanelTouchingGap is in mm // the gap is split equally between the panel pairs // TODO -- replace all of this with V_getDet_panel_gap(fname,detStr) once it is added to the file // these hard-wired values were determined from 6A and WB beam centers. LR values were exactly the same for // both beam conditions (+/- 0.0 mm). FTB was +/- 0.8 mm, MTB +/- 2 mm if(cmpstr(detStr,"FL") == 0 || cmpstr(detStr,"FR") == 0) gap = 3.5               //mm (measured, JB 1/4/18) endif if(cmpstr(detStr,"FT") == 0 || cmpstr(detStr,"FB") == 0) gap = 3.3               //mm (measured, JB 2/1/18) endif if(cmpstr(detStr,"ML") == 0 || cmpstr(detStr,"MR") == 0) gap = 5.9               //mm (measured, JB 1/4/18) endif if(cmpstr(detStr,"MT") == 0 || cmpstr(detStr,"MB") == 0) gap = 18.3              //mm (measured, JB 2/1/18) endif // TODO: this is the line to keep, to replace the hard-wired values //      gap = V_getDet_panel_gap(fname,detStr) // (DONE) -- replace all of this with V_getDet_panel_gap(fname,detStr) once it is added to the file gap = V_getDet_panel_gap(fname,detStr) // TODO: // -- once the gap fields have been verified, this check can be removed // -- it should only apply to data pre-2018 when the field did not exist in the file // -- any VSANS data from 2018+ should read gap from the file. if(gap < -100)          //-999999 returned if field is missing from file if(cmpstr(detStr,"FL") == 0 || cmpstr(detStr,"FR") == 0) gap = 3.5               //mm (measured, JB 1/4/18) endif if(cmpstr(detStr,"FT") == 0 || cmpstr(detStr,"FB") == 0) gap = 3.3               //mm (measured, JB 2/1/18) endif if(cmpstr(detStr,"ML") == 0 || cmpstr(detStr,"MR") == 0) gap = 5.9               //mm (measured, JB 1/4/18) endif if(cmpstr(detStr,"MT") == 0 || cmpstr(detStr,"MB") == 0) gap = 18.3              //mm (measured, JB 2/1/18) endif endif if(cmpstr(orientation,"vertical")==0) //check for DIV // if the DIV workfile doesn't exist, let the user know,and abort WAVE/Z div_data_err = V_getDetectorDataErrW("DIV",detStr) WAVE/Z div_data = V_getDetectorDataW("DIV",detStr) // !! be sure to check first, before trying to access the wave //      WAVE/Z div_data = \$("root:Packages:NIST:VSANS:DIV:entry:instrument:detector_"+detStr+":data") if(WaveExists(div_data) == 0) if(WaveExists(\$("root:Packages:NIST:VSANS:DIV:entry:instrument:detector_"+detStr+":data")) == 0) Print "The DIV wave does not exist in V_DIVCorrection()" Return(1)               //error condition Endif if(WaveExists(div_data_err) == 0) if(WaveExists(\$("root:Packages:NIST:VSANS:DIV:entry:instrument:detector_"+detStr+":linear_data_error")) == 0) Print "The DIV error wave does not exist in V_DIVCorrection()" Return(1)               //error condition //files exist, proceed WAVE/Z div_data_err = V_getDetectorDataErrW("DIV",detStr) WAVE/Z div_data = V_getDetectorDataW("DIV",detStr) // do the error propagation first, since data is changed by the correction 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 String groupName = "/entry/instrument/detector_"+detStr String varName = "setback" wTmpWrite[0] = val variable err err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) if(err) Print "HDF write err = ",err endif // now be sure to kill the data folder to force a re-read of the data next time this file is read in //      err = V_KillNamedDataFolder(fname) //      if(err) //              Print "DataFolder kill err = ",err //      endif return(err) End // gap when panels are "touching" // units are mm // writes panel gap for detector panel specified // does not write anything if "B" is passed (no such field for this detector) // Function V_writeDet_panel_gap(fname,detStr,val) String fname,detStr Variable val if(cmpstr(detStr,"B") == 0) return(0) endif //      String path = "entry:instrument:detector_"+detStr+":panel_gap" Make/O/D/N=1 wTmpWrite //      Make/O/R/N=1 wTmpWrite String groupName = "/entry/instrument/detector_"+detStr String varName = "panel_gap" wTmpWrite[0] = val