Ignore:
Timestamp:
May 1, 2018 8:52:07 AM (5 years ago)
Author:
srkline
Message:

renamed white beam smearing models so they would be grouped together on the file list.

Re-worked the logic and flow of the averaging/plotting/saving steps of the reduction protocol so that it would flow cleanly and leave room for changes for the multitude of different collimation conditions. The averaging routines are now aware of the collimation conditions so that the appropriate resolution can be calculated. The collimation string is also written out to the averaged data file as element[9] of the protocol. The hope is that one could key on this collimation string to decide how to proceed with the analysis.

File:
1 edited

Legend:

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

    r1097 r1098  
    14231423         
    14241424// DDet = detector pixel resolution [cm]        **assumes square pixel 
    1425         DDet = 0.8              // TODO -- this is hard-wired 
    1426          
     1425        // V_getDet_pixel_fwhm_x(folderStr,detStr) 
     1426        // V_getDet_pixel_fwhm_y(folderStr,detStr) 
     1427//      DDet = 0.8              // TODO -- this is hard-wired 
     1428 
     1429        if(strlen(type) == 1) 
     1430                // it's "B" 
     1431                DDet = V_getDet_pixel_fwhm_x(folderStr,type)            // value is already in cm 
     1432        else 
     1433                DDet = V_getDet_pixel_fwhm_x(folderStr,type[0,1])               // value is already in cm 
     1434        endif 
     1435                 
    14271436// apOff = sample aperture to sample distance [cm] 
    14281437        apOff = 10              // TODO -- this is hard-wired 
    14291438         
    14301439// S1 = source aperture diameter [mm] 
    1431         S1 = str2num(V_getSourceAp_size(folderStr)) 
     1440// may be either circle or rectangle 
     1441        String s1_shape="",bs_shape="" 
     1442        Variable width,height,equiv_S1,equiv_bs 
     1443         
     1444         
     1445        s1_shape = V_getSourceAp_shape(folderStr) 
     1446        if(cmpstr(s1_shape,"CIRCLE") == 0) 
     1447                S1 = str2num(V_getSourceAp_size(folderStr)) 
     1448        else 
     1449                S1 = V_getSourceAp_height(folderStr)            // TODO: need the width or at least an equivalent diameter 
     1450        endif 
     1451         
    14321452         
    14331453// S2 = sample aperture diameter [cm] 
     
    14471467// if the type is say, MLRTB, then the implicit assumption in combining all four panels is that the resolution 
    14481468// is not an issue for the slightly different distances. 
    1449         L2 = V_getDet_ActualDistance(folderStr,type[0,1])/100           //convert cm to m 
     1469        if(strlen(type) == 1) 
     1470                // it's "B" 
     1471                L2 = V_getDet_ActualDistance(folderStr,type)/100                //convert cm to m 
     1472        else 
     1473                L2 = V_getDet_ActualDistance(folderStr,type[0,1])/100           //convert cm to m 
     1474        endif 
    14501475         
    14511476// BS = beam stop diameter [mm] 
    14521477//TODO:? which BS is in? carr2, carr3, none? 
    1453 // -- need to check the num_beamstops field, then description, then shape/size or shape/height and shape/width 
     1478// -- need to check the detector, num_beamstops field, then description, then shape/size or shape/height and shape/width 
    14541479// 
    14551480// TODO: the values in the file are incorrect!!! BS = 1000 mm diameter!!! 
    14561481//      BS = V_getBeamStopC2_size(folderStr)            // Units are [mm]  
    14571482        BS = 25.4                       //TODO hard-wired value 
     1483         
     1484//      bs_shape = V_getBeamStopC2_shape(folderStr) 
     1485//      if(cmpstr(s1_shape,"CIRCLE") == 0) 
     1486//              bs = V_getBeamStopC2_size(folderStr) 
     1487//      else 
     1488//              bs = V_getBeamStopC2_height(folderStr)   
     1489//      endif 
     1490 
     1491 
    14581492         
    14591493// del_r = step size [mm] = binWidth*(mm/pixel)  
     
    14841518// pinhole 
    14851519// pinhole_whiteBeam 
     1520// convergingPinholes 
     1521// 
     1522// *slit data should be reduced using the slit routine, not here, proceed but warn 
    14861523// narrowSlit 
    14871524// narrowSlit_whiteBeam 
    1488 // convergingPinholes 
    14891525 
    14901526        if(cmpstr(collimationStr,"pinhole") == 0) 
     
    15361572         
    15371573        endif 
     1574 
     1575 
     1576// should not end up here, except for odd testing cases 
     1577        if(cmpstr(collimationStr,"narrowSlit") == 0) 
     1578 
     1579                Print "??? Slit data is being averaged as pinhole - reset the AVERAGE parameters in the protocol ???" 
     1580                ii=0 
     1581                do 
     1582                        V_getResolution(qBin_qxqy[ii],lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,ret1,ret2,ret3) 
     1583                        sigmaq[ii] = ret1        
     1584                        qbar[ii] = ret2  
     1585                        fsubs[ii] = ret3         
     1586                        ii+=1 
     1587                while(ii<nq) 
     1588         
     1589        endif 
     1590         
     1591// should not end up here, except for odd testing cases 
     1592        if(cmpstr(collimationStr,"narrowSlit_whiteBeam") == 0) 
     1593 
     1594//              set lambdaWidth == 0 so that the gaussian resolution calculates only the geometry contribution. 
     1595// the white beam distribution will need to be flagged some other way 
     1596// 
     1597                Print "??? Slit data is being averaged as pinhole - reset the AVERAGE parameters in the protocol ???" 
     1598 
     1599                lambdaWidth = 0 
     1600                 
     1601                ii=0 
     1602                do 
     1603                        V_getResolution(qBin_qxqy[ii],lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,ret1,ret2,ret3) 
     1604                        sigmaq[ii] = ret1        
     1605                        qbar[ii] = ret2  
     1606                        fsubs[ii] = ret3         
     1607                        ii+=1 
     1608                while(ii<nq) 
     1609         
     1610        endif 
     1611 
     1612 
     1613 
    15381614                 
    15391615        SetDataFolder root: 
Note: See TracChangeset for help on using the changeset viewer.