Ignore:
Timestamp:
Jul 3, 2018 2:30:41 PM (4 years ago)
Author:
srkline
Message:

Many changes:

Made the VCALC panel aware of all of the binning options
Corrected the behavior of the VCALC preset conditions
Adjusted how the Slit data is binned so that there are not duplicated q-values in the output

Made Absolute scaling aware of the back detector. Now the ABS String in the protocol has a second
set of scaling constants tagged with "_B" for the back detector. There is an added button
on the protocol panel to set the second set of constants. For the back detector, the read noise
is subtracted by reading it from the empty beam file (shifting over to the right by one box width)
All of the associated abs procedures are now aware of this.
More error checking needs to be added.

Back detector image is now shifted upon loading of the data. the default mask takes this into account
and masks out the padded (zero) regions.

in the protocol, DIV and MSK do not use grep any longer. it was just way too slow. Now it depends on

the file name having DIV or MASK respectively.



Raw data files can now be added together, in the usual way from the protocol panel.



File:
1 edited

Legend:

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

    r1100 r1109  
    179179        nYpix = DimSize(inten,1) 
    180180         
    181         for(ii=0;ii<ntube;ii+=1) 
     181        for(ii=0;ii<ntube;ii+=1)                //for each tube... 
    182182                sum_inten = 0                   // initialize the sum 
    183183                sum_n = 0 
    184184                sum_inten2 = 0 
    185185                 
    186                 for(jj=0;jj<nYpix;jj+=1) 
     186                for(jj=0;jj<nYpix;jj+=1)                        //sum along y... 
    187187                                val = inten[ii][jj] 
    188188                                if(isVCALC || maskMissing)              // mask_val == 0 == keep, mask_val == 1 = YES, mask out the point 
     
    199199                iBin_qxqy[ii] = sum_inten/sum_n         //the average value 
    200200                 
    201 //              if(numtype(iBin_qxqy[ii]) == 2) 
    202 //                      print "asdfasdf" 
    203 //              endif 
    204                  
     201 
    205202                avesq = (sum_inten/sum_n)^2 
    206203                aveisq = sum_inten2/sum_n 
     
    214211        endfor 
    215212 
    216 //TODO: use only the Qx component in the y-center of the detector, not Qtotal 
     213// x- use only the Qx component in the y-center of the detector, not Qtotal 
    217214// if the detectors are "L", then the values are all negative, so take the absolute value here 
    218215        qBin_qxqy =  abs(qx[p][nYpix/2])                 
     216 
    219217 
    220218// for the L panels, sort the q-values (and data) after the abs() step, otherwise the data is reversed 
     
    222220        Sort qBin_qxqy, qBin_qxqy,iBin_qxqy,eBin_qxqy 
    223221 
     222// average and get rid of the duplicate q-values from the L and R sides 
     223        Variable q1,q2,tol 
     224        tol = 0.001             // 0.1 % 
     225        q1 = qBin_qxqy[0] 
     226        ii=0 
     227        do 
     228                q2 = qBin_qxqy[ii+1] 
     229                if(V_CloseEnough(q1,q2,q1*tol)) 
     230                        // check to be sure that both values are actually real numbers before trying to average 
     231                        if(numtype(iBin_qxqy[ii])==0 && numtype(iBin_qxqy[ii+1])==0)            //==0 => real number 
     232                                iBin_qxqy[ii] = (iBin_qxqy[ii] + iBin_qxqy[ii+1])/2             //both OK 
     233                        endif 
     234                        if(numtype(iBin_qxqy[ii])==0 && numtype(iBin_qxqy[ii+1])!=0)            //==0 => real number 
     235                                iBin_qxqy[ii] = iBin_qxqy[ii]           //one OK 
     236                        endif 
     237                        if(numtype(iBin_qxqy[ii])!=0 && numtype(iBin_qxqy[ii+1])==0)            //==0 => real number 
     238                                iBin_qxqy[ii] = iBin_qxqy[ii+1]         //other OK 
     239                        endif 
     240                        if(numtype(iBin_qxqy[ii])!=0 && numtype(iBin_qxqy[ii+1])!=0)            //==0 => real number 
     241                                iBin_qxqy[ii] = (iBin_qxqy[ii])         // both NaN, get rid of it later 
     242                        endif 
     243                 
     244                        if(numtype(eBin_qxqy[ii])==0 && numtype(eBin_qxqy[ii+1])==0)            //==0 => real number 
     245                                eBin_qxqy[ii] = sqrt(eBin_qxqy[ii]^2 + eBin_qxqy[ii+1]^2)               //both OK 
     246                        endif 
     247                        if(numtype(eBin_qxqy[ii])==0 && numtype(eBin_qxqy[ii+1])!=0)            //==0 => real number 
     248                                eBin_qxqy[ii] = eBin_qxqy[ii]           //one OK 
     249                        endif 
     250                        if(numtype(eBin_qxqy[ii])!=0 && numtype(eBin_qxqy[ii+1])==0)            //==0 => real number 
     251                                eBin_qxqy[ii] = eBin_qxqy[ii+1]         //other OK 
     252                        endif 
     253                        if(numtype(eBin_qxqy[ii])!=0 && numtype(eBin_qxqy[ii+1])!=0)            //==0 => real number 
     254                                eBin_qxqy[ii] = (eBin_qxqy[ii])         // both NaN, get rid of it later 
     255                        endif 
     256                         
     257                        DeletePoints ii+1, 1, qBin_qxqy,iBin_qxqy,eBin_qxqy,iBin2_qxqy,nBin_qxqy,eBin2D_qxqy 
     258                else 
     259                        ii+=1 
     260                        q1 = q2 
     261                endif 
     262        while(ii<numpnts(qBin_qxqy)-2) 
    224263 
    225264        // TODO: do I use dQ for the height of the panel? 
    226         // TODO : do I use 1/2 of dQ due to the symmetry of my smearing calculation?     
    227         delQy = abs(qy[0][nYpix-1] - qy[0][0]) 
     265        // TODO : do I use 1/2 of dQ due to the symmetry of my smearing calculation? 
     266 
     267// TODO: use only dQy for the portion of the detector that was not masked! 
     268         
     269        ii = trunc(ntube/4)             //random tube number 
     270         
     271        Make/O/D/N=(nYpix) tmpTube,tmpMaskTube 
     272        tmpTube = qy[ii][p] 
     273        tmpMaskTube = mask[ii][p] 
     274         
     275        // along the tube, keep the value, or set to NaN if masked 
     276        tmpTube = tmpMaskTube == 0 ? tmpTube : NaN 
     277        WaveStats/Q tmpTube 
     278//      Print V_max 
     279//      Print V_min 
     280         
     281        delQy = abs(V_max - V_min) 
     282//print delQy 
     283         
     284        // not quite correct - this uses the whole detector height, but there is some masked out 
     285//      delQy = abs(qy[0][nYpix-1] - qy[0][0]) 
    228286 
    229287//      iBin_qxqy *= delQy 
Note: See TracChangeset for help on using the changeset viewer.