Ignore:
Timestamp:
Apr 6, 2018 9:06:40 AM (5 years ago)
Author:
srkline
Message:

New dimensions added for the back detector. many functions neede to be updated to accomodate these changes. Beam center is handled in the same way (in cm, not pixels) as other panels even though this panel is like the 2D detectors on SANS.

Still missing is the real values for caibration, pixel size, dead time, etc. that are yet to be measured.

File:
1 edited

Legend:

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

    r1083 r1093  
    106106// 
    107107// output is wave of corrected real space distance corresponding to each pixel of the data 
     108// ** its distance from the nominal beam center of (0,0) ** 
    108109// 
    109110// 
     
    270271                return(0) 
    271272        endif 
     273 
     274Print "***Cal_X and Cal_Y for Back are using default values instead of file values ***" 
     275 
     276                cal_x[0] = VCALC_getPixSizeX(detStr)*10                 // pixel size in mm  VCALC_getPixSizeX(detStr) is [cm] 
     277                cal_x[1] = 1 
     278                cal_x[2] = 10000 
     279                cal_y[0] = VCALC_getPixSizeY(detStr)*10                 // pixel size in mm  VCALC_getPixSizeX(detStr) is [cm] 
     280                cal_y[1] = 1 
     281                cal_y[2] = 10000 
     282 
    272283         
    273284        // do I count on the orientation as an input, or do I just figure it out on my own? 
     
    285296        Wave data_realDistX = $(destPath + ":entry:instrument:detector_"+detStr+":data_realDistX") 
    286297        Wave data_realDistY = $(destPath + ":entry:instrument:detector_"+detStr+":data_realDistY") 
    287          
    288298         
    289299//      Wave cal_x = V_getDet_cal_x(folder,detStr) 
     
    471481end 
    472482 
     483// converts from [cm] beam center to pixels 
     484// 
     485// the value in pixels is written to the local data folder, NOT to disk (it is recalculated as needed) 
     486// 
     487Function V_ConvertBeamCtr_to_pixB(folder,detStr,destPath) 
     488        String folder,detStr,destPath 
     489         
     490        Wave data_realDistX = $(destPath + ":entry:instrument:detector_"+detStr+":data_realDistX") 
     491        Wave data_realDistY = $(destPath + ":entry:instrument:detector_"+detStr+":data_realDistY")       
     492 
     493        Variable dimX,dimY,xCtr,yCtr 
     494        dimX = DimSize(data_realDistX,0) 
     495        dimY = DimSize(data_realDistX,1) 
     496         
     497        xCtr = V_getDet_beam_center_x(folder,detStr)                    //these are in cm, *10 to get mm 
     498        yCtr = V_getDet_beam_center_y(folder,detStr)     
     499         
     500        Make/O/D/N=1 $(destPath + ":entry:instrument:detector_"+detStr+":beam_center_x_pix") 
     501        Make/O/D/N=1 $(destPath + ":entry:instrument:detector_"+detStr+":beam_center_y_pix") 
     502        WAVE x_pix = $(destPath + ":entry:instrument:detector_"+detStr+":beam_center_x_pix") 
     503        WAVE y_pix = $(destPath + ":entry:instrument:detector_"+detStr+":beam_center_y_pix") 
     504 
     505 
     506// simple wave lookup 
     507// can't use x_pix[0] = data_RealDistX(xCtr)[0] since the data has no x-scale and (xCtr) is interpreted  
     508// as a point value 
     509 
     510// 
     511//xCtr, yCtr are in cm, *10 to get mm to compare to distance array 
     512 
     513        Make/O/D/N=(dimX) tmpTube 
     514        tmpTube = data_RealDistX[p][0] 
     515        FindLevel /P/Q tmpTube, xCtr*10 
     516         
     517        x_pix[0] = V_levelX 
     518        KillWaves/Z tmpTube 
     519         
     520         
     521        Make/O/D/N=(dimY) tmpTube 
     522        tmpTube = data_RealDistY[0][p] 
     523        FindLevel /P/Q tmpTube, yCtr*10 
     524         
     525        y_pix[0] = V_levelX 
     526        KillWaves/Z tmpTube 
     527                 
     528        print "pixel ctr B = ",x_pix[0],y_pix[0] 
     529                 
     530        return(0) 
     531end 
     532 
    473533// 
    474534// 
     
    480540// -- not much is known about the "B" detector, so this 
    481541//    all hinges on the non-linear corrections being done correctly for that detector 
     542// 
     543//      Variable detCtrX, detCtrY 
     544//      // get the pixel center of the detector (not the beam center) 
     545//      detCtrX = trunc( DimSize(dataW,0)/2 )           // 
     546//      detCtrY = trunc( DimSize(dataW,1)/2 ) 
    482547// 
    483548// 
     
    593658        Wave cal_y = V_getDet_cal_y("RAW","B") 
    594659         
    595         cal_x = 1               // mm, ignore the other 2 values 
    596         cal_y = 1               // mm 
     660        cal_x = .34             // mm, ignore the other 2 values 
     661        cal_y = .34             // mm 
    597662        return(0) 
    598663End 
Note: See TracChangeset for help on using the changeset viewer.