Ignore:
Timestamp:
Feb 25, 2016 4:30:38 PM (7 years ago)
Author:
srkline
Message:

more changes and additons to display VSANS data

adding functions for IvsQ plotting

coverted much of VCALC to have similar folder structure as HDF to allow re-use of the Q-binning procedures from VCALC with real data in work files.

re-working the beam center finder to get it to work with work file data rather then only VCALC.

new plotting routines for the panels to rescale to the beam center (still in pixels, though)

File:
1 edited

Legend:

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

    r981 r982  
    382382        // TODO 
    383383        // -- currently only redimensioning the data and linear_data_error - What else??? 
    384         // 
     384        // -- ?? some of this is done at load time for RAW data 
    385385        for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
    386386                detStr = StringFromList(ii, ksDetectorListAll, ";") 
     
    400400                // if not in DIV folder, load. 
    401401                // if unable to load, skip correction and report error (Alert?) (Ask to Load?) 
    402                  
     402                Print "Doing DIV correction"// for "+ detStr 
    403403                for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
    404404                        detStr = StringFromList(ii, ksDetectorListAll, ";") 
    405405                        Wave w = V_getDetectorDataW(fname,detStr) 
    406406                        Wave w_err = V_getDetectorDataErrW(fname,detStr) 
    407                         Print "Doing DIV correction for "+ detStr 
     407                         
    408408                        DIVCorrection(w,w_err,detStr,newType) 
    409409                endfor 
     
    413413         
    414414        // (2) non-linear correction     
     415        // TODO: 
     416        // -- currently, the "B" detector is skipped 
     417        // -- document what is generated here: 
     418        //    **in each detector folder: data_realDistX and data_realDistY (2D waves of the mm? position of the pixel) 
     419        // -- still not sure whether to duplicate these calculations as the RAW data is loaded. It would allow the RAW 
     420        //    data to be properly displayed, but without all of the (complete) set of corrections 
     421        // * the corrected distances are calculated into arrays, but nothing is done with them yet 
     422        // * there is enough information now to calculate the q-arrays -other corrections modify the data 
    415423        NVAR gDoNonLinearCor = root:Packages:NIST:VSANS:Globals:gDoNonLinearCor 
    416424        // generate a distance matrix for each of the detectors 
    417425        if (gDoNonLinearCor == 1) 
    418                 for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
    419                         detStr = StringFromList(ii, ksDetectorListAll, ";") 
     426                Print "Doing Non-linear correction"// for "+ detStr 
     427                for(ii=0;ii<ItemsInList(ksDetectorListNoB);ii+=1) 
     428                        detStr = StringFromList(ii, ksDetectorListNoB, ";") 
    420429                        Wave w = V_getDetectorDataW(fname,detStr) 
    421                         Wave w_err = V_getDetectorDataErrW(fname,detStr) 
     430//                      Wave w_err = V_getDetectorDataErrW(fname,detStr) 
    422431                        Wave w_calib = V_getDetTube_spatialCalib(fname,detStr) 
    423                         Print "Doing Non-linear correction for "+ detStr 
    424 //                      NonLinearCorrection(fill this in) 
     432                        Variable tube_width = V_getDet_tubeWidth(fname,detStr) 
     433                        NonLinearCorrection(w,w_calib,tube_width,detStr,destPath) 
     434                         
     435                        // (2.5) Calculate the q-values 
     436                        // calculating q-values can't be done unless the non-linear corrections are calculated 
     437                        // so go ahead and put it in this loop. 
     438                        // TODO :  
     439                        // -- make sure that everything is present before the calculation 
     440                        // -- beam center must be properly defined in terms of real distance 
     441                        // -- distances/zero location/ etc. must be clearly documented for each detector 
     442                        //      ** this assumes that NonLinearCorrection() has been run to generate data_RealDistX and Y 
     443                        // ** this routine Makes the waves QTot, qx, qy, qz in each detector folder. 
     444                        // 
     445                        V_Detector_CalcQVals(fname,detStr,destPath) 
    425446                         
    426447                endfor 
     
    428449                Print "Non-linear correction not done" 
    429450        endif 
    430          
     451 
    431452        // (3) solid angle correction 
    432453        NVAR gDoSolidAngleCor = root:Packages:NIST:VSANS:Globals:gDoSolidAngleCor 
    433454        if (gDoSolidAngleCor == 1) 
     455                Print "Doing Solid Angle correction"// for "+ detStr 
    434456                for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
    435457                        detStr = StringFromList(ii, ksDetectorListAll, ";") 
     
    437459                        Wave w_err = V_getDetectorDataErrW(fname,detStr) 
    438460                        Wave w_dt = V_getDetector_deadtime(fname,detStr) 
    439                         Print "Doing Solid Angle correction for "+ detStr 
    440461//                      SolidAngleCorrection(fill this in) 
    441462                         
     
    453474        ctTime = V_getCount_time(fname) 
    454475        if (gDoDeadTimeCor == 1) 
     476                Print "Doing DeadTime correction"// for "+ detStr 
    455477                for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
    456478                        detStr = StringFromList(ii, ksDetectorListAll, ";") 
     
    458480                        Wave w_err = V_getDetectorDataErrW(fname,detStr) 
    459481                        Wave w_dt = V_getDetector_deadtime(fname,detStr) 
    460                         Print "Doing DeadTime correction for "+ detStr 
    461482//                      DeadTimeCorrectionTubes(w,w_err,w_dt,ctTime) 
    462483                                //deadtime corrections 
     
    488509        NVAR gDoTrans = root:Packages:NIST:VSANS:Globals:gDoTransmissionCor 
    489510        if (gDoTrans == 1) 
     511                Print "Doing Large-angle transmission correction"// for "+ detStr 
    490512                for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
    491513                        detStr = StringFromList(ii, ksDetectorListAll, ";") 
     
    493515                        Wave w_err = V_getDetectorDataErrW(fname,detStr) 
    494516                        Wave w_dt = V_getDetector_deadtime(fname,detStr) 
    495                         Print "Doing Large-angle transmission correction for "+ detStr 
    496517//                      TransmissionCorrection(fill this in) 
    497518                         
     
    505526        // TODO -- but there are TWO monitors - so how to switch? 
    506527        // TODO -- what do I really need to save? 
     528        Print "Doing monitor normalization"// for "+ detStr 
     529 
    507530        defmon=1e8                      //default monitor counts 
    508531        for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
     
    511534                Wave w_err = V_getDetectorDataErrW(fname,detStr) 
    512535                Variable monCt = V_getBeamMonNormData(fname) 
    513                 Print "Doing monitor normalization for "+ detStr 
    514536//                      MonitorNormalization(fill this in) 
    515537        //scale the data to the default montor counts 
Note: See TracChangeset for help on using the changeset viewer.