Ignore:
Timestamp:
Feb 9, 2018 3:47:28 PM (5 years ago)
Author:
srkline
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!)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorCorrections.ipf

    r1081 r1083  
    156156// kPanelTouchingGap is in mm    
    157157// 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 
    175184         
    176185        if(cmpstr(orientation,"vertical")==0) 
     
    13551364        //check for DIV 
    13561365        // 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         
    13611368//      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) 
    13631370                Print "The DIV wave does not exist in V_DIVCorrection()" 
    13641371                Return(1)               //error condition 
    13651372        Endif 
    1366         if(WaveExists(div_data_err) == 0) 
     1373        if(WaveExists($("root:Packages:NIST:VSANS:DIV:entry:instrument:detector_"+detStr+":linear_data_error")) == 0) 
    13671374                Print "The DIV error wave does not exist in V_DIVCorrection()" 
    13681375                Return(1)               //error condition 
     
    13701377        //files exist, proceed 
    13711378 
     1379        WAVE/Z div_data_err = V_getDetectorDataErrW("DIV",detStr) 
     1380        WAVE/Z div_data = V_getDetectorDataW("DIV",detStr) 
     1381 
     1382 
     1383 
    13721384// do the error propagation first, since data is changed by the correction 
    13731385        data_err = sqrt(data_err^2/div_data^2 + div_data_err^2 * data^2/div_data^4 ) 
Note: See TracChangeset for help on using the changeset viewer.