Ignore:
Timestamp:
Aug 29, 2017 12:55:04 PM (5 years ago)
Author:
srkline
Message:

many changes to the VCALC code and a few changes to the main code to get the units consistent, and centimeters everywhere possible. The real space distance array and the non-linear calibrations are still defined and calculated in mm. This can hopefully be changed in the future. Some constants in the data file will need to be updated to cm, such as the T/B setback, which has been confirmed to be 41.0 cm

File:
1 edited

Legend:

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

    r1055 r1062  
    3636        // need SDD 
    3737        // need pixel dimensions 
    38         // nominal sdd in meters, offset in mm, want result in cm ! 
    39         sdd = VCALC_getSDD(type)*100    +  VCALC_getTopBottomSDDOffset(type) / 10               // result is sdd in [cm] 
     38        // nominal sdd in cm, offset in cm, want result in cm ! 
     39        sdd = VCALC_getSDD(type)        +  VCALC_getTopBottomSDDSetback(type)           // result is sdd in [cm] 
    4040 
    4141        pixSizeX = VCALC_getPixSizeX(type)              // cm 
     
    193193// 
    194194// 
    195 // -- sdd in meters 
     195// -- sdd in cm 
    196196// -- lambda in Angstroms 
    197197Function VC_Detector_2Q(data,qTot,qx,qy,qz,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 
     
    215215// reverts to the "regular" linear detector if waves not found or a flag is set 
    216216// 
    217 // need to convert the beam center to mm 
    218217// need to call the VSANS V_CalcQval routines (these use the real-space distance, not pixel dims) 
     218// 
     219// ***** everything passed in is [cm], except for wavelength [A] 
     220// 
     221// ****  TODO :: calibration constants are still in [mm] 
     222// 
    219223// 
    220224// TODO: 
     
    267271         
    268272//      Wave w_calib = V_getDetTube_spatialCalib("VCALC",detStr) 
    269         Variable tube_width = 8.4                       // TODO: Hard-wired value!! 
     273        Variable tube_width = 8.4                       // TODO: UNITS!!! Hard-wired value in [mm] 
    270274        if(cmpstr(detStr,"B") == 0) 
    271275                V_NonLinearCorrection_B("VCALC",data,tmpCalib,tmpCalib,detStr,destPath) 
     
    280284        if(kBCTR_CM) 
    281285                if(gUseNonLinearDet && WaveExists(data_realDistX) && WaveExists(data_realDistY)) 
    282                         // no need to convert the beam centers to real space, just to mm 
    283                         xCtr *= 10              // convert from cm to mm 
    284                         yCtr *= 10               
     286                        // beam ctr is in cm already 
     287 
    285288                        // calculate all of the q-values 
    286289                        qTot = V_CalcQval(p,q,xCtr,yCtr,sdd,lam,data_realDistX,data_realDistY) 
     
    365368//and are in detector coordinates (1,128) rather than axis values 
    366369//the pixel locations need not be integers, reals are ok inputs 
    367 //sdd is in meters 
     370//sdd is in [cm] 
    368371//wavelength is in Angstroms 
    369372// 
     
    376379        Variable dx,dy,qval,two_theta,dist 
    377380                 
    378         sdd *=100               //convert to cm 
     381 
    379382        dx = (xaxval - xctr)*pixSizeX           //delta x in cm 
    380383        dy = (yaxval - yctr)*pixSizeY           //delta y in cm 
     
    392395//ALL inputs are in detector coordinates 
    393396// 
    394 //sdd is in meters 
     397//sdd is in [cm] 
    395398//wavelength is in Angstroms 
    396399// 
     
    405408        qval = VC_CalcQval(xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
    406409         
    407         sdd *=100               //convert to cm 
     410//      sdd *=100               //convert to cm 
    408411        dx = (xaxval - xctr)*pixSizeX           //delta x in cm 
    409412        dy = (yaxval - yctr)*pixSizeY           //delta y in cm 
     
    422425//input/output is the same as CalcQval() 
    423426//ALL inputs are in detector coordinates 
    424 //sdd is in meters 
     427//sdd is in [cm] 
    425428//wavelength is in Angstroms 
    426429// 
     
    435438        qval = VC_CalcQval(xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
    436439         
    437         sdd *=100               //convert to cm 
     440//      sdd *=100               //convert to cm 
    438441        dx = (xaxval - xctr)*pixSizeX           //delta x in cm 
    439442        dy = (yaxval - yctr)*pixSizeY           //delta y in cm 
     
    452455//input/output is the same as CalcQval() 
    453456//ALL inputs are in detector coordinates 
    454 //sdd is in meters 
     457//sdd is in [cm] 
    455458//wavelength is in Angstroms 
    456459// 
     
    464467        qval = VC_CalcQval(xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
    465468         
    466         sdd *=100               //convert to cm 
     469//      sdd *=100               //convert to cm 
    467470         
    468471        //get scattering angle to project onto flat detector => Qr = qval*cos(theta) 
Note: See TracChangeset for help on using the changeset viewer.