Ignore:
Timestamp:
Sep 23, 2015 8:24:30 AM (7 years ago)
Author:
srkline
Message:

Updated the display of the "beam center finder" to better display the panels with an appropriate aspect ratio for the pixels.

Made the number of pixels (x,y) on each of the panels as globals, plus access functions. Large panels were coded for 256, but will likely be 128 pixels in reality. Make global for easy changes. Made sure that exsting functions used the global and were not hard-wired.

File:
1 edited

Legend:

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

    r955 r963  
    104104Function V_CalculateQFrontPanels() 
    105105 
    106         Variable xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY 
     106        Variable xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,nPix_X,nPix_Y 
    107107        Variable F_LR_sep,F_TB_sep,F_offset,F_sdd_offset 
    108108 
     
    126126 
    127127        SetDataFolder root:Packages:NIST:VSANS:VCALC:Front 
    128         Wave det_FL,det_FR                      // these are (48,256) 
     128        Wave det_FL,det_FR                      // these are (48,128)           (nominal, may change) 
    129129        Wave det_FT,det_FB                      // these are (128,48) 
    130130 
     
    142142//      pixSizeX = 0.8                  // 0.8 cm/pixel along width 
    143143//      pixSizeY = 0.4                  // approx 0.4 cm/pixel along length 
    144          
    145         xCtr = 48+(F_LR_sep/2/pixSizeX)         // TODO  -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? 
    146         yCtr = 127       
     144        nPix_X = VCALC_get_nPix_X("FL") 
     145        nPix_Y = VCALC_get_nPix_Y("FL") 
     146         
     147        xCtr = nPix_X+(F_LR_sep/2/pixSizeX)             // TODO  -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? 
     148        yCtr = nPix_Y/2  
    147149        V_Detector_2Q(det_FL,qTot_FL,qx_FL,qy_FL,qz_FL,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 
    148150//      Print "xy for FL = ",xCtr,yCtr 
     
    168170        pixSizeX = VCALC_getPixSizeX("FR") 
    169171        pixSizeY = VCALC_getPixSizeY("FR") 
     172        nPix_X = VCALC_get_nPix_X("FR") 
     173        nPix_Y = VCALC_get_nPix_Y("FR") 
    170174         
    171175        xCtr = -(F_LR_sep/2/pixSizeX)-1          
    172         yCtr = 127 
     176        yCtr = nPix_Y/2  
    173177        V_Detector_2Q(det_FR,qTot_FR,qx_FR,qy_FR,qz_FR,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 
    174178//      Print "xy for FR = ",xCtr,yCtr 
     
    189193        pixSizeX = VCALC_getPixSizeX("FT") 
    190194        pixSizeY = VCALC_getPixSizeY("FT") 
    191  
    192         xCtr = 64 
     195        nPix_X = VCALC_get_nPix_X("FT") 
     196        nPix_Y = VCALC_get_nPix_Y("FT") 
     197         
     198        xCtr = nPix_X/2 
    193199        yCtr = -(F_TB_sep/2/pixSizeY)-1    
    194200        // global sdd_offset is in (mm), convert to meters here for the Q-calculation 
     
    211217        pixSizeX = VCALC_getPixSizeX("FB") 
    212218        pixSizeY = VCALC_getPixSizeY("FB") 
    213          
    214         xCtr = 64 
    215         yCtr = 48+(F_TB_sep/2/pixSizeY)                 // TODO  -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? 
     219        nPix_X = VCALC_get_nPix_X("FB") 
     220        nPix_Y = VCALC_get_nPix_Y("FB") 
     221                 
     222        xCtr = nPix_X/2 
     223        yCtr = nPix_Y+(F_TB_sep/2/pixSizeY)             // TODO  -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? 
    216224        // global sdd_offset is in (mm), convert to meters here for the Q-calculation 
    217225        V_Detector_2Q(det_FB,qTot_FB,qx_FB,qy_FB,qz_FB,xCtr,yCtr,sdd+F_sdd_offset/1000,lam,pixSizeX,pixSizeY) 
     
    234242        String folderStr,type 
    235243         
    236         Variable LR_sep,nPix,xCtr,ii,jj,numCol,pixSizeX,pixSizeY 
     244        Variable LR_sep,nPix,xCtr,ii,jj,numCol,pixSizeX,pixSizeY,nPix_X,nPix_Y 
    237245 
    238246/// !! type passed in will be FT, FB, MT, MB, so I can't ask for the panel separation -- or I'll get the TB separation... 
     
    259267        pixSizeY = VCALC_getPixSizeY(type) 
    260268 
     269        nPix_X = VCALC_get_nPix_X(type) 
     270        nPix_Y = VCALC_get_nPix_Y(type) 
     271         
    261272        //TODO -- get this from a global 
    262         xCtr = 64 
     273        xCtr = nPix_X/2 
    263274        nPix = trunc(LR_sep/2/pixSizeX)         // approx # of pixels Left/right of center that are not obscured by L/R panels 
    264275         
     
    442453Function V_CalculateQMiddlePanels() 
    443454 
    444         Variable xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY 
     455        Variable xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,nPix_X,nPix_Y 
    445456        Variable M_LR_sep,M_TB_sep,M_offset, M_sdd_offset 
    446457 
     
    462473 
    463474        SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle 
    464         Wave det_ML,det_MR                      // these are (48,256) 
     475        Wave det_ML,det_MR                      // these are (48,128)           nominal, may change 
    465476        Wave det_MT,det_MB                      // these are (128,48) 
    466477 
     
    476487        pixSizeX = VCALC_getPixSizeX("ML") 
    477488        pixSizeY = VCALC_getPixSizeY("ML") 
    478          
    479         xCtr = 48+(M_LR_sep/2/pixSizeX)         // TODO  -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? 
    480         yCtr = 127       
     489        nPix_X = VCALC_get_nPix_X("ML") 
     490        nPix_Y = VCALC_get_nPix_Y("ML") 
     491         
     492        xCtr = nPix_X+(M_LR_sep/2/pixSizeX)             // TODO  -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? 
     493        yCtr = nPix_Y/2  
    481494        V_Detector_2Q(det_ML,qTot_ML,qx_ML,qy_ML,qz_ML,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 
    482495//      Print "xy for ML = ",xCtr,yCtr 
     
    503516        pixSizeX = VCALC_getPixSizeX("MR") 
    504517        pixSizeY = VCALC_getPixSizeY("MR") 
     518 
     519        nPix_X = VCALC_get_nPix_X("MR") 
     520        nPix_Y = VCALC_get_nPix_Y("MR") 
    505521         
    506522        xCtr = -(M_LR_sep/2/pixSizeX)-1          
    507         yCtr = 127 
     523        yCtr = nPix_Y/2 
    508524        V_Detector_2Q(det_MR,qTot_MR,qx_MR,qy_MR,qz_MR,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) 
    509525//      Print "xy for MR = ",xCtr,yCtr 
     
    524540        pixSizeX = VCALC_getPixSizeX("MT") 
    525541        pixSizeY = VCALC_getPixSizeY("MT") 
    526  
    527         xCtr = 64 
     542        nPix_X = VCALC_get_nPix_X("MT") 
     543        nPix_Y = VCALC_get_nPix_Y("MT") 
     544         
     545        xCtr = nPix_X/2 
    528546        yCtr = -(M_TB_sep/2/pixSizeY)-1  
    529547                // global sdd_offset is in (mm), convert to meters here for the Q-calculation   
     
    546564        pixSizeX = VCALC_getPixSizeX("MB") 
    547565        pixSizeY = VCALC_getPixSizeY("MB") 
    548          
    549         xCtr = 64 
    550         yCtr = 48+(M_TB_sep/2/pixSizeY)                 // TODO  -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? 
     566        nPix_X = VCALC_get_nPix_X("MB") 
     567        nPix_Y = VCALC_get_nPix_Y("MB") 
     568                 
     569        xCtr = nPix_X/2 
     570        yCtr = nPix_Y+(M_TB_sep/2/pixSizeY)             // TODO  -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? 
    551571                // global sdd_offset is in (mm), convert to meters here for the Q-calculation 
    552572        V_Detector_2Q(det_MB,qTot_MB,qx_MB,qy_MB,qz_MB,xCtr,yCtr,sdd+M_sdd_offset/1000,lam,pixSizeX,pixSizeY) 
Note: See TracChangeset for help on using the changeset viewer.