Changeset 1239


Ignore:
Timestamp:
Feb 14, 2020 2:44:16 PM (3 years ago)
Author:
srkline
Message:

adding downstream window transmission correction -- added function to detector corrections, and added item to preference panel. Transmission value is currently set as a global since the value is not part of the VSANS header. Global value defaults to T=1= no correction.

Other changes are cleanup of TODO items that were already done and tested. inline commnents have been updated.

Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
Files:
8 edited

Legend:

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

    r1236 r1239  
    22002200///////////// 
    22012201 
     2202// 
     2203// 
     2204// testing function to calculate the correction for the attenuation 
     2205// of the scattered beam by windows downstream of the sample 
     2206// (the back window of the sample block, the Si window) 
     2207// 
     2208// For implementation, this function could be made identical 
     2209// to the large angle transmission correction, since the math is 
     2210// identical - only the Tw value is different (and should ideally be 
     2211// quite close to 1). With Tw near 1, this would be a few percent correction 
     2212// at the largest scattering angles. 
     2213// 
     2214// 
     2215Function V_WindowTransmission(tw) 
     2216        Variable tw 
     2217         
     2218        Make/O/D/N=100 theta,method1,method2,arg 
     2219         
     2220        theta = p/2 
     2221        theta = theta/360*2*pi          //convert to radians 
     2222         
     2223//      method1 = exp( -ln(tw)/cos(theta) )/tw 
     2224         
     2225        Variable tau 
     2226        tau = -ln(tw) 
     2227        arg = (1-cos(theta))/cos(theta) 
     2228         
     2229        if(tau < 0.01) 
     2230                method2 = 1 - 0.5*tau*arg        
     2231        else 
     2232                method2 = ( 1 - exp(-tau*arg) )/(tau*arg) 
     2233        endif 
     2234         
     2235        return(0) 
     2236end 
     2237 
     2238 
     2239// 
     2240// Large angle transmission correction for the downstream window 
     2241// 
     2242// DIVIDE the intensity by this correction to get the right answer 
     2243// 
     2244// -- this is a duplication of the math for the large angle 
     2245// sample tranmission correction. Same situation, but now the  
     2246// scattered neutrons are attenuated by whatever windows are  
     2247// downstream of the scattering event. 
     2248// (the back window of the sample block, the Si window) 
     2249// 
     2250// For implementation, this function is made identical 
     2251// to the large angle transmission correction, since the math is 
     2252// identical - only the Tw value is different (and should ideally be 
     2253// quite close to 1). With Tw near 1, this would be a few percent correction 
     2254// at the largest scattering angles. 
     2255// 
     2256// 
     2257Function V_DownstreamWindowTransmission(w,w_err,fname,detStr,destPath) 
     2258        Wave w,w_err 
     2259        String fname,detStr,destPath 
     2260 
     2261        Variable sdd,xCtr,yCtr,uval 
     2262 
     2263// get all of the geometry information   
     2264//      orientation = V_getDet_tubeOrientation(fname,detStr) 
     2265        sdd = V_getDet_ActualDistance(fname,detStr) 
     2266 
     2267        // this is ctr in mm 
     2268        xCtr = V_getDet_beam_center_x_mm(fname,detStr) 
     2269        yCtr = V_getDet_beam_center_y_mm(fname,detStr) 
     2270 
     2271// get the value of the overall transmission of the downstream components 
     2272// + error if available. 
     2273//      trans = V_getSampleTransmission(fname) 
     2274//      trans_err = V_getSampleTransError(fname) 
     2275// TODO -- HARD WIRED values, need to set a global or find a place in the header (instrument block?) (reduction?) 
     2276// currently globals are forced to one in WorkFolderUtils.ipf as the correction is done 
     2277        NVAR trans = root:Packages:NIST:VSANS:Globals:gDownstreamWinTrans 
     2278        NVAR trans_err = root:Packages:NIST:VSANS:Globals:gDownstreamWinTransErr         
     2279 
     2280        SetDataFolder $(destPath + ":entry:instrument:detector_"+detStr) 
     2281         
     2282        Wave data_realDistX = data_realDistX 
     2283        Wave data_realDistY = data_realDistY 
     2284 
     2285        Duplicate/O w dwt_corr,tmp_theta,tmp_dist,dwt_err,tmp_err               //in the current df 
     2286 
     2287//// calculate the scattering angle 
     2288//      dx = (distX - xctr)             //delta x in mm 
     2289//      dy = (distY - yctr)             //delta y in mm 
     2290        tmp_dist = sqrt((data_realDistX - xctr)^2 + (data_realDistY - yctr)^2) 
     2291         
     2292        tmp_dist /= 10  // convert mm to cm 
     2293        // sdd is in [cm] 
     2294 
     2295        tmp_theta = atan(tmp_dist/sdd)          //this is two_theta, the scattering angle 
     2296 
     2297        Variable ii,jj,numx,numy,dx,dy,cos_th,arg,tmp 
     2298        numx = DimSize(tmp_theta,0) 
     2299        numy = DimSize(tmp_theta,1) 
     2300         
     2301         
     2302        //optical thickness 
     2303        uval = -ln(trans)               //use natural logarithm 
     2304         
     2305        for(ii=0        ;ii<numx;ii+=1) 
     2306                for(jj=0;jj<numy;jj+=1) 
     2307                         
     2308                        cos_th = cos(tmp_theta[ii][jj]) 
     2309                        arg = (1-cos_th)/cos_th 
     2310                         
     2311                        // a Taylor series around uval*arg=0 only needs about 4 terms for very good accuracy 
     2312                        //                      correction= 1 - 0.5*uval*arg + (uval*arg)^2/6 - (uval*arg)^3/24 + (uval*arg)^4/120 
     2313                        // OR 
     2314                        if((uval<0.01) || (cos_th>0.99))         
     2315                                //small arg, approx correction 
     2316                                dwt_corr[ii][jj] = 1-0.5*uval*arg 
     2317                        else 
     2318                                //large arg, exact correction 
     2319                                dwt_corr[ii][jj] = (1-exp(-uval*arg))/(uval*arg) 
     2320                        endif 
     2321                          
     2322                        // (DONE) 
     2323                        // x- properly calculate and apply the 2D error propagation 
     2324                        if(trans == 1) 
     2325                                dwt_err[ii][jj] = 0             //no correction, no error 
     2326                        else 
     2327                                //sigT, calculated from the Taylor expansion 
     2328                                tmp = (1/trans)*(arg/2-arg^2/3*uval+arg^3/8*uval^2-arg^4/30*uval^3) 
     2329                                tmp *= tmp 
     2330                                tmp *= trans_err^2 
     2331                                tmp = sqrt(tmp)         //sigT 
     2332                                 
     2333                                dwt_err[ii][jj] = tmp 
     2334                        endif 
     2335                          
     2336                endfor 
     2337        endfor 
     2338         
     2339        // Here it is! Apply the correction to the intensity (divide -- to get the proper correction) 
     2340        w /= dwt_corr 
     2341 
     2342        // relative errors add in quadrature to the current 2D error 
     2343        tmp_err = (w_err/dwt_corr)^2 + (dwt_err/dwt_corr)^2*w*w/dwt_corr^2 
     2344        tmp_err = sqrt(tmp_err) 
     2345         
     2346        w_err = tmp_err  
     2347         
     2348        // DONE x- clean up after I'm satisfied computations are correct                 
     2349        KillWaves/Z tmp_theta,tmp_dist,tmp_err,dwt_err 
     2350         
     2351        return(0) 
     2352end 
     2353 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_IQ_Annular.ipf

    r1126 r1239  
    2121//    Mask(translucent?), like a "thresholding" operation, but act on the Q-value, not the Z- value. 
    2222// 
    23 // TODO!!! 
     23// DONE 
    2424// x- none of these procedures are aware of the BACK detector 
    2525// 
     
    2727// 
    2828// 
    29 Proc Annular_Binning(folderStr,detGroup,qCtr_Ann,qWidth) 
     29Proc V_Annular_Binning(folderStr,detGroup,qCtr_Ann,qWidth) 
    3030        String folderStr="SAM",detGroup="F" 
    3131        Variable qCtr_Ann=0.1,qWidth=0.01       // +/- in A^-1 
     
    3737End 
    3838 
    39  
    40 // TODO -- binType == 4 (slit mode) should never end up here, as it makes no sense 
    41 // 
    42 // -- really, the only binning that makes any sense is "one", treating each panel individually, 
    43 // so I may scrap the parameter, or ignore it. so don't count on it in the future. 
     39// 
     40// entry procedure for annular averaging 
     41// 
     42// detGroup defines which of the three carriages are used for the annulus 
     43// (defined by qCtr and qWidth) 
     44// 
     45// currently the q-range defined is only checked on a single carriage. No crossing 
     46// of the ring is allowed to spill onto other carriages. Probably not a significant issue 
     47// but may come up in the future. 
     48// 
     49// All of the detector panels for a given carriage are used for the averaging, although 
     50// in practice this cound be specified as say, ML+MR only if the panels were closed together 
     51// and MT and MB were blocked. This would speed up the calculation. 
    4452// 
    4553Function V_QBinAllPanels_Annular(folderStr,detGroup,qCtr_Ann,qWidth) 
     
    6573        endswitch 
    6674 
    67          
    68 // right now, use all of the detectors. There is a lot of waste in this and it could be  
    69 // done a lot faster, but... 
    70  
    71 // TODO          
    72                 // detStr = "FLRTB" or "MLRTB", depending which panel the q-ring is centered on/ 
    73                 // for now, no crossing of the rings onto different carriages 
    74                  
     75        // right now, use all of the detectors. There is a lot of waste in this and it could be  
     76        // done a lot faster, but... 
     77 
     78        // detStr = "FLRTB" or "MLRTB", depending which panel the q-ring is centered on/ 
     79        // for now, no crossing of the rings onto different carriages 
     80         
    7581        V_fDoAnnularBin_QxQy2D(folderStr,detStr,qCtr_Ann,qWidth) 
    7682 
     
    350356        endif 
    351357 
    352         // TODO -- nq will need to be larger, once the back detector is installed 
    353         // 
    354         // note that the back panel of 320x320 (1mm res) results in 447 data points! 
    355         // - so I upped nq to 600 
     358        // TODO -- nq may need to be larger, if annular averaging on the back detector 
    356359 
    357360        nq = 600 
     
    385388        Variable nphi,dphi,isIn,phiij,iphi 
    386389 
    387 // TODO: define nphi 
     390// DONE: define nphi (this is now set as a preference) 
    388391//      dr = 1                  //minimum annulus width, keep this fixed at one 
    389392        NVAR numPhiSteps = root:Packages:NIST:VSANS:Globals:gNPhiSteps 
     
    402405// 
    403406// this needs to be a double loop now... 
    404 // TODO: 
    405 // -- the iErr (=2D) wave and accumulation of error is NOT CALCULATED CORRECTLY YET 
    406 // -- the solid angle per pixel is not completely implemented. 
    407 //    it will be present for WORK data other than RAW, but not for RAW 
     407// DONE: 
     408// x- the iErr (=2D) wave and accumulation of error is correctly propagated through all steps 
     409// x- the solid angle per pixel is completely implemented. 
     410//    -Solid angle will be present for WORK data other than RAW, but not for RAW 
    408411 
    409412// if any of the masks don't exist, display the error, and proceed with the averaging, using all data 
     
    600603// after looping through all of the data on the panels, calculate errors on I(q), 
    601604// just like in CircSectAve.ipf 
    602 // TODO: 
    603 // -- 2D Errors were NOT properly acculumated through reduction, so this loop of calculations is NOT MEANINGFUL (yet) 
     605// DONE: 
     606// x- 2D Errors ARE properly acculumated through reduction, so this loop of calculations is correct 
    604607// x- the error on the 1D intensity, is correctly calculated as the standard error of the mean. 
    605608        for(ii=0;ii<nphi;ii+=1) 
     
    694697end 
    695698 
    696 // TODO: 
    697 // -- this is a temporary solution before a real writer is created 
    698 // -- resolution is not generated here (and it shouldn't be) since resolution is not known yet. 
    699 // -- but a real writer will need to be aware of resolution, and there may be different forms 
     699// DONE: 
     700// - this is a basic solution before a more complete writer is created 
     701// - resolution is not generated here and is generally not reported for annualr data 
     702// (although it could be) 
    700703// 
    701704// this will bypass save dialogs 
    702 // -- AND WILL OVERWITE DATA WITH THE SAME NAME 
    703 // 
    704 //                      V_Write1DData_ITX("root:Packages:NIST:VSANS:",type,saveName,binType) 
     705// - AND WILL OVERWITE DATA WITH THE SAME NAME 
     706// 
    705707// 
    706708Function V_fWrite1DAnnular(pathStr,folderStr,detGroup,saveName) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Menu.ipf

    r1229 r1239  
    2727                "-" 
    2828                "Show Mask for Averaging",V_Display_Four_Panels() 
    29 //              "Annular Binning",Annular_Binning() 
     29//              "Annular Binning",V_Annular_Binning() 
    3030//              "Write Annular Data",V_Write1DAnnular() 
    3131//              "Trim I(q) points",V_CombineDataGraph() 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_RAW_Data_Panel.ipf

    r1150 r1239  
    44 
    55// 
    6 // this will become the equivalent of "RawWindowHook" 
    7 // 
    8 // Procedures to: 
     6// this panel and proceudres is the equivalent of "RawWindowHook" for SANS 
     7// 
     8// This includes procedures to: 
    99// display the detector data 
    1010// visualization tools 
     
    1212// status information necessary to understand the data 
    1313// buttons to more functionality to process data 
    14  
    15  
    16 // TODO 
    17 // 
    18 // -- have the status automatically fill in when a new file is loaded, rather than needing a click of the "status" button 
     14// 
     15 
     16// DONE 
     17// 
     18// x- have the status automatically fill in when a new file is loaded, rather than needing a click of the "status" button 
    1919// x- need a place somewhere to show the currently displayed folder 
    2020// x- checkboxes for "active" corrections? 
     
    2929// call this after loading data to either draw the data display panel or to update the contents 
    3030// 
    31 // TODO 
    32 // -- make sure that the "type" input is correctly used for the updating of the data, values, etc. 
    33 // -- add a procedure to define the global variables for pos, counts, QxQy, etc. 
     31// DONE 
     32// x- make sure that the "type" input is correctly used for the updating of the data, values, etc. 
     33// x- add a procedure to define the global variables for pos, counts, QxQy, etc. 
    3434// 
    3535Function V_UpdateDisplayInformation(type) 
     
    4646        endif 
    4747         
    48         // TODO: update the information here  - in either case 
    49         // what isn't automatically picked up? What is "stale" on the display? 
     48        // DONE:  
     49        // faking clicks on the buttons updates the information 
    5050        String/G root:Packages:NIST:VSANS:Globals:gCurDispType = type 
    5151         
     
    126126 
    127127 
    128 // TODO 
     128// TODO_MEDIUM 
    129129// 
    130130// -- now that the sliders work, label them and move them to a better location 
     
    472472// 
    473473// 
    474 // TODO  
     474// TODO_LOW  
    475475//  -- add all of the controls of the VCALC panel (log scaling, adjusting the axes, etc.) 
    476476//  x- get the panel to be correctly populated first, rather than needing to click everywhere to fill in 
     
    915915 
    916916// 
    917 // TODO: 
    918 // -- simply calls the missing parameter dialog to do the average. 
     917// DONE: 
     918// x- simply calls the missing parameter dialog to do the average. 
    919919//  see the file V_IQ_Annular.ipf for all of the features yet to be added. 
    920920// 
     
    928928                        // click code here 
    929929                         
    930                         Execute "Annular_Binning()"                      
     930                        Execute "V_Annular_Binning()"                    
    931931 
    932932                        break 
     
    10061006 
    10071007 
    1008 // TODO: 
     1008// TODO_VERIFY: 
    10091009// x- link this to the preferences for the display. this is done in UpdateDisplayInformation (the main call) so that 
    10101010//     the panels are rescaled only once, rather than toggled three times (F, M, B) if I call from the tabProc 
     
    10821082End 
    10831083 
    1084 // TODO 
    1085 // possibly function to "tag" files right here in the disaply with things 
     1084// TODO_LOW 
     1085// -- possibly use this function to "tag" files right here in the disaply with things 
    10861086// like their intent, or other values that reduction will need, kind of like a "quick patch" 
    10871087// with limited functionality (since full function would be a nightmare!)  
     
    11031103End 
    11041104 
    1105 // TODO 
     1105// TODO_LOW 
     1106// -- currently this button is NOT visible on the RAW data display. Any saving of data 
     1107//    must go through a protocol (RAW can't be saved) 
    11061108// -- fill in more functionality 
    11071109// -- currently a straight concatentation of all data, no options 
     
    11321134//                      binType = (V_flag == 0) ? 1 : V_flag            // if binType not defined, set binType == 1 
    11331135 
    1134                         String saveName="" 
     1136                        String saveName="",exten="" 
    11351137                // write out the data set to a file 
    11361138                        if(strlen(saveName)==0) 
     
    11401142                        endif 
    11411143                         
    1142                         V_Write1DData_ITX("root:Packages:NIST:VSANS:",type,saveName,binType) 
     1144//                      V_Write1DData_ITX("root:Packages:NIST:VSANS:",type,saveName,binType) 
     1145 
     1146                        V_Write1DData_Individual("root:Packages:NIST:VSANS:",type,saveName,exten,binType) 
    11431147         
    11441148                        Print "Saved file: "    +       saveName + ".itx"        
     
    11511155End 
    11521156 
    1153 //TODO 
     1157//TODO_LOW 
    11541158// 
    11551159//link this to the beam center finding panel 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_VSANS_Preferences.ipf

    r1237 r1239  
    2727                        Initialize_VSANSPreferences() 
    2828                endif 
     29                // these variables were recently created, so they may not exist if someone 
     30                // opens an old experiment -- then errors will result 
     31                if(exists("root:Packages:NIST:VSANS:Globals:gDoDownstreamWindowCor") != 2) 
     32                        V_InitializeWindowTrans()               //set up the globals (need to check in multiple places) 
     33                endif 
     34                 
    2935                VSANSPref_Panel() 
    3036        Endif 
     
    9096        Variable/G root:Packages:NIST:VSANS:Globals:gDoMonitorNormalization = 1 
    9197 
    92         val = NumVarOrDefault("root:Packages:NIST:VSANS:Globals:gDoDownstreamWindowCorPref", 1 ) 
    93         Variable/G root:Packages:NIST:VSANS:Globals:gDoDownstreamWindowCorPref = 0 
     98        val = NumVarOrDefault("root:Packages:NIST:VSANS:Globals:gDoDownstreamWindowCor", 1 ) 
     99        Variable/G root:Packages:NIST:VSANS:Globals:gDoDownstreamWindowCor = 1 
     100        V_InitializeWindowTrans()               //set up the globals (need to check in multiple places) 
    94101 
    95102        // Special global to prevent fake data from "B" detector from being written out 
     
    127134end 
    128135 
     136Function V_InitializeWindowTrans() 
     137 
     138        Variable/G root:Packages:NIST:VSANS:Globals:gDoDownstreamWindowCor = 1 
     139 
     140        // TODO -- when correcting this, search for all occurences!!! also in V_WorkFolderUtils !!! 
     141        // these global values need to be replaced with real numbers 
     142        // error is currently set to zero 
     143        Variable/G root:Packages:NIST:VSANS:Globals:gDownstreamWinTrans = 1 
     144        Variable/G root:Packages:NIST:VSANS:Globals:gDownstreamWinTransErr = 0 
     145 
     146end 
     147 
    129148Function V_LogScalePrefCheck(ctrlName,checked) : CheckBoxControl 
    130149        String ctrlName 
     
    239258        Variable checked 
    240259         
    241         NVAR gVal = root:Packages:NIST:VSANS:Globals:gDoDownstreamWindowCorPref 
     260        NVAR gVal = root:Packages:NIST:VSANS:Globals:gDoDownstreamWindowCor 
    242261        gVal = checked 
    243262End 
     
    284303 
    285304//on tab(1) - VSANS - initially visible 
    286         CheckBox PrefCtrl_1a,pos={21,100},size={171,14},proc=V_LogScalePrefCheck,title="Use Log scaling for 2D data display" 
     305        CheckBox PrefCtrl_1a,pos={21,80},size={171,14},proc=V_LogScalePrefCheck,title="Use Log scaling for 2D data display" 
    287306        CheckBox PrefCtrl_1a,help={"Checking this will display 2D VSANS data with a logarithmic color scale of neutron counts. If not checked, the color mapping will be linear."} 
    288307        CheckBox PrefCtrl_1a,value= root:Packages:NIST:VSANS:Globals:gLogScalingAsDefault 
     
    290309//      CheckBox PrefCtrl_1b,help={"Checking this will allow DRK correction to be used in reduction protocols. You will need to re-draw the protocol panel for this change to be visible."} 
    291310//      CheckBox PrefCtrl_1b,value= root:Packages:NIST:VSANS:Globals:gAllowDRK 
    292         CheckBox PrefCtrl_1c,pos={21,140},size={137,14},proc=V_UnityTransPref,title="Check for Transmission = 1" 
     311        CheckBox PrefCtrl_1c,pos={21,100},size={137,14},proc=V_UnityTransPref,title="Check for Transmission = 1" 
    293312        CheckBox PrefCtrl_1c,help={"Checking this will check for SAM or EMP Trans = 1 during data correction"} 
    294313        CheckBox PrefCtrl_1c,value= root:Packages:NIST:VSANS:Globals:gDoTransCheck 
    295         SetVariable PrefCtrl_1d,pos={21,170},size={200,15},title="Averaging Bin Width (pixels)" 
     314        SetVariable PrefCtrl_1d,pos={21,130},size={200,15},title="Averaging Bin Width (pixels)" 
    296315        SetVariable PrefCtrl_1d,limits={1,100,1},value= root:Packages:NIST:VSANS:Globals:gBinWidth 
    297         SetVariable PrefCtrl_1e,pos={21,195},size={200,15},title="# Phi Steps (annular avg)" 
     316        SetVariable PrefCtrl_1e,pos={21,155},size={200,15},title="# Phi Steps (annular avg)" 
    298317        SetVariable PrefCtrl_1e,limits={1,360,1},value= root:Packages:NIST:VSANS:Globals:gNPhiSteps 
     318        SetVariable PrefCtrl_1p,pos={21,180},size={200,15},title="Window Transmission" 
     319        SetVariable PrefCtrl_1p,limits={0.01,1,0.001},value= root:Packages:NIST:VSANS:Globals:gDownstreamWinTrans 
     320 
    299321         
    300322        CheckBox PrefCtrl_1f title="Do Transmssion Correction?",size={140,14},value=root:Packages:NIST:VSANS:Globals:gDoTransmissionCor,proc=V_DoTransCorrPref 
     
    314336        CheckBox PrefCtrl_1l value=root:Packages:NIST:VSANS:Globals:gDoNonLinearCor,pos={255,180},help={"Non-linear correction can't be turned off"} 
    315337        CheckBox PrefCtrl_1m title="Do Downstream Window Corr?",size={140,14},proc=V_DoDownstreamWindowCorPref 
    316         CheckBox PrefCtrl_1m value=root:Packages:NIST:VSANS:Globals:gDoDownstreamWindowCorPref,pos={255,200},help={"TURN OFF ONLY FOR DEBUGGING."} 
     338        CheckBox PrefCtrl_1m value=root:Packages:NIST:VSANS:Globals:gDoDownstreamWindowCor,pos={255,200},help={"TURN OFF ONLY FOR DEBUGGING."} 
    317339//      CheckBox PrefCtrl_1n title="Do Monitor Normalization?",size={140,14},proc=V_DoMonitorNormPref 
    318340//      CheckBox PrefCtrl_1n value=root:Packages:NIST:VSANS:Globals:gDoMonitorNormalization,pos={255,220},help={"TURN OFF ONLY FOR DEBUGGING."} 
     
    329351//      CheckBox PrefCtrl_1h,disable=1 
    330352//      CheckBox PrefCtrl_1g,value=0,disable=2          // angle dependent efficiency not done yet 
    331         CheckBox PrefCtrl_1m,value=0,disable=2          // downstream window transmission no done yet 
     353//      CheckBox PrefCtrl_1m,value=0,disable=2          // downstream window transmission no done yet 
    332354 
    333355//on tab(2) - Analysis 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_WhiteBeamSmear.ipf

    r1100 r1239  
    66// testing routines to compare various integration methods and approximations 
    77// for calculating the resolution smearing from the white beam wavelength distribution 
     8// 
     9// none of these functions are used in the final version of the resolution smearing 
     10// for white beam or super white beam. Functions and definitions of WB and SWB are contatined 
     11// in the file: V_WhiteBeamDistribution.ipf 
     12// 
     13// 
    814// 
    915// 
     
    2733// writing fitting functions for all of these cases. The built-in Integrate may be limited 
    2834//  
    29 // TODO -- beware what might happen to the calculations since there is a single global string 
     35// NOTE: -- beware what might happen to the calculations since there is a single global string 
    3036//   containing the function name. 
    3137// 
    32 // TODO: 
     38// NOTE: 
    3339// -- a significant problem with using the coef waves that are used in the wrapper are that 
    3440//   they are set up with a dependency, so doing the WB calculation also does the "regular" 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_WorkFolderUtils.ipf

    r1236 r1239  
    810810                Print "Tube efficiency+shadowing correction NOT DONE" 
    811811        endif    
    812                  
    813         // (6) angle dependent transmission correction 
     812 
     813        // (6) Downstream window angle dependent transmission correction 
     814        // TODO: 
     815        // -- HARD WIRED value 
     816        // x- find a temporary way to pass this value into the function (global?) 
     817        // 
     818        // -- currently the transmission is set as a global (in V_VSANS_Preferences.ipf) 
     819        // -- need a permanent location in the file header to store the transmission value 
     820        // 
     821        NVAR/Z gDoWinTrans = root:Packages:NIST:VSANS:Globals:gDoDownstreamWindowCor 
     822        if(NVAR_Exists(gDoWinTrans) != 1) 
     823                V_InitializeWindowTrans()               //set up the globals (need to check in multiple places) 
     824        endif 
     825                 
     826        if (gDoWinTrans == 1) 
     827                Print "Doing Large-angle Downstream window transmission correction"// for "+ detStr 
     828         
     829                for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
     830                        detStr = StringFromList(ii, ksDetectorListAll, ";") 
     831                         
     832                        if(cmpstr(detStr,"B") == 0  && gIgnoreDetB == 1) 
     833                                // do nothing 
     834                        else 
     835                                Wave w = V_getDetectorDataW(fname,detStr) 
     836                                Wave w_err = V_getDetectorDataErrW(fname,detStr) 
     837                                 
     838                                V_DownstreamWindowTransmission(w,w_err,fname,detStr,destPath) 
     839                        endif 
     840                endfor 
     841        else 
     842                Print "Downstream Window Transmission correction NOT DONE" 
     843        endif    
     844                 
     845        // (7) angle dependent transmission correction 
    814846        // TODO: 
    815847        // x- this still needs to be filled in 
     
    822854        NVAR gDoTrans = root:Packages:NIST:VSANS:Globals:gDoTransmissionCor 
    823855        if (gDoTrans == 1) 
    824                 Print "Doing Large-angle transmission correction"// for "+ detStr 
     856                Print "Doing Large-angle sample transmission correction"// for "+ detStr 
    825857                for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
    826858                        detStr = StringFromList(ii, ksDetectorListAll, ";") 
     
    839871        endif    
    840872         
    841         // (7) normalize to default monitor counts 
     873         
     874        // (8) normalize to default monitor counts 
    842875        // TODO(DONE) x- each detector is rescaled separately, but the rescaling factor is global (only one monitor!) 
    843876        // TODO -- but there are TWO monitors - so how to switch? 
     
    893926                Print "Monitor Normalization correction NOT DONE" 
    894927        endif 
    895          
    896          
    897         // (not done) angle dependent efficiency correction 
    898         // -- efficiency and shadowing are now done together (step 5) 
    899         NVAR doEfficiency = root:Packages:NIST:VSANS:Globals:gDoDetectorEffCor 
     928 
     929 
     930// flag to allow adding raw data files with different attenuation (normally not done)    
     931// -- yet to be implemented as a prefrence panel item 
     932//      NVAR gAdjustRawAtten = root:Packages:NIST:VSANS:Globals:gDoAdjustRAW_Atten       
     933         
     934         
     935//      // (not done) angle dependent efficiency correction 
     936//      // -- efficiency and shadowing are now done together (step 5) 
     937//      NVAR doEfficiency = root:Packages:NIST:VSANS:Globals:gDoDetectorEffCor 
    900938 
    901939//       
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Write_VSANS_QIS.ipf

    r1192 r1239  
    121121        fprintf refnum, "COLLIMATION=%s\r\n",proto[9] 
    122122 
    123 // TODO 
     123// DONE 
    124124// x- make this work for 6-columns (or??) 
    125125        formatStr = "%15.4g %15.4g %15.4g %15.4g %15.4g %15.4g\r\n"      
     
    347347 
    348348 
    349 // TODO: 
    350 // -- this is a temporary solution before a real writer is created 
    351 // -- resolution is not generated here (and it shouldn't be) since resolution is not known yet. 
    352 // -- but a real writer will need to be aware of resolution, and there may be different forms 
     349// DONE: 
     350// - this is a temporary solution before a real writer is created 
     351// -- it has been replaced with V_Write1DData_Individual 
     352// - resolution is not generated here (and it shouldn't be) since resolution is not known yet. 
     353// - but a real writer will need to be aware of resolution, and there may be different forms 
    353354// 
    354355// This saves the data in Igor Text format, an ASCII format, but NOT standard SANS columns 
Note: See TracChangeset for help on using the changeset viewer.