Ignore:
Timestamp:
Jun 6, 2017 2:19:21 PM (5 years ago)
Author:
srkline
Message:

Minor changes to the function of the Beam Center panel so that it made sense, and would untimately allow writing the new center values to a data file on disk

Other cosetic changes to some of the panels

File:
1 edited

Legend:

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

    r1033 r1043  
    33// 
    44// ******** 
    5 // TODO -- this is only a fake DIV file. need to identify how to generate a real DIV file 
    6 //     for the different detectors, and how to fill it into a file. ProDIV for SANS may be a good 
    7 //     starting point, or it may be cumbersome. Not sure how it will be measured in practice 
    8 //     on VSANS. 
     5// TODO -- this is an incomplete DIV file. need to identify how to generate a real DIV file 
     6//     for the different detectors, and how to fill it into a file.  
     7//    Not sure how it will be measured in practice on VSANS. 
    98// 
    109//   JAN 2017 
     
    2625// the high angle issues. 
    2726// 
    28 // 
    29  
     27// -- what about the T/B panels? Since a large chunk of these detectors may be obscured, 
     28//   the normalization will be way off -- and the "active" area will end up much larger  
     29//   than it should be - since the wings of the detector are mostly zero... 
     30// 
     31// 
    3032 
    3133 
     
    4042 
    4143 
    42  
    43  
    44  
    45  
    46 //works on the data in "type" folder (expecting data to be reduced to the COR level) 
    47 //sums all of the data, and normalizes by the number of cells (=pixelX*pixelY) 
    48 // calling procedure must make sure that the folder is on linear scale FIRST 
     44// Basic function: 
     45// -- first, reduce the data (to the COR level?) 
     46// -- next, V_NormalizeDIV() 
     47// -- then Setup_VSANS_DIV_Struct() 
     48// -- next, V_CopyDIVToSave() 
     49// -- last, Save_VSANS_DIV_Nexus()  
     50 
     51 
     52 
     53 
     54// 
     55// Normalizes each panel independently 
     56// Normalizes in-place, replacing whatever was there 
     57// 
     58// type is the work folder where the (? corrected) data is currently 
     59// 
     60// TODO 
     61// -- data should be copied to some alternate work folder before this step 
     62// 
    4963Function V_NormalizeDIV(type) 
    5064        String type 
    51          
    52         WAVE data=$("root:Packages:NIST:"+type+":data") 
    53         WAVE data_lin=$("root:Packages:NIST:"+type+":linear_data") 
    54         WAVE data_err=$("root:Packages:NIST:"+type+":linear_data_error") 
    55          
    56         Variable totCts=sum(data,Inf,-Inf)              //sum all of the data 
    57         NVAR pixelX = root:myGlobals:gNPixelsX 
    58         NVAR pixelY = root:myGlobals:gNPixelsY 
    59  
    60          
    61         data /= totCts 
    62         data *= pixelX*pixelY 
    63          
    64         data_lin /= totCts 
    65         data_lin *= pixelX*pixelY 
    66          
    67         data_err /= totCts 
    68         data_err *= pixelX*pixelY 
    69                  
     65 
     66        Variable ii,totCts,pixelX,pixelY 
     67        String detStr 
     68 
     69        for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
     70                detStr = StringFromList(ii, ksDetectorListAll, ";") 
     71                Wave w = V_getDetectorDataW(type,detStr) 
     72                Wave w_err = V_getDetectorDataErrW(type,detStr) 
     73                pixelX = V_getDet_pixel_num_x(type,detStr) 
     74                pixelY = V_getDet_pixel_num_y(type,detStr) 
     75 
     76                totCts=sum(w,Inf,-Inf)          //sum all of the data 
     77                 
     78                w /= totCts 
     79                w *= pixelX*pixelY 
     80 
     81                w_err /= totCts 
     82                w_err *= pixelX*pixelY 
     83                 
     84        endfor 
     85         
    7086        return(0) 
    7187End 
    7288 
    7389 
     90 
     91Function V_CopyDIVToSave(type) 
     92        String type 
     93         
     94        Variable ii,totCts,pixelX,pixelY 
     95        String detStr 
     96        String topath = "root:VSANS_DIV_file:entry:instrument:detector_" 
     97        String fromPath = "root:Packages:NIST:VSANS:"+type+":entry:instrument:detector_" 
     98         
     99         
     100        for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
     101                detStr = StringFromList(ii, ksDetectorListAll, ";") 
     102 
     103                Duplicate/O $(fromPath+detStr+":data") $(toPath+detStr+":data") 
     104                Duplicate/O $(fromPath+detStr+":linear_data_error") $(toPath+detStr+":linear_data_error") 
     105                 
     106        endfor 
     107         
     108        return(0) 
     109End 
    74110 
    75111 
Note: See TracChangeset for help on using the changeset viewer.