Ignore:
Timestamp:
May 4, 2011 9:47:33 AM (12 years ago)
Author:
srkline
Message:

Changed the 2D resolution calculation to include gravity. This seems to work, but will still require some testing. It requires no modifications to the smearing calculation, still using parallel and perpendicular directions.

Added a Fake Update feature to the RealTime? update. There are specific, separate instructions for how to set this up. Usef (possibly) for summer schools or demos.

Adjusted the 2D MonteCarlo? simulation to a corrected beam center. The Gauss Peak was not symmetric around the old beam center.

Corrected the AAO resolution smearing functions to work with cursors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Common/GaussUtils_v40.ipf

    r797 r800  
    419419        Variable nord                   //number of quadrature points to used 
    420420 
     421 
     422// special case of integral limits that are identical 
     423        if(upLim == loLim) 
     424                return( fcn(w,x, loLim)) 
     425        endif 
     426         
    421427// local variables 
    422428        Variable ii,va,vb,summ,yyy,zi 
     
    445451        // Using 5 Gauss points              
    446452        // remember to index from 0,size-1 
    447  
     453         
    448454        summ = 0.0              // initialize integral 
    449455        ii=0                    // loop counter 
     
    472478        Variable x      //x-value (q) for the calculation 
    473479 
     480 
     481// special case of integral limits that are identical 
     482        if(upLim == loLim) 
     483                return( fcn(w,x, loLim)) 
     484        endif 
     485         
    474486// local variables 
    475487        Variable nord,ii,va,vb,summ,yyy,zi 
     
    525537        Variable x      //x-value (q) for the calculation 
    526538 
     539// special case of integral limits that are identical 
     540        if(upLim == loLim) 
     541                return( fcn(w,x, loLim)) 
     542        endif 
     543         
    527544// local variables 
    528545        Variable nord,ii,va,vb,summ,yyy,zi 
     
    578595        Variable x      //x-value (q) for the calculation 
    579596 
     597// special case of integral limits that are identical 
     598        if(upLim == loLim) 
     599                return( fcn(w,x, loLim)) 
     600        endif 
     601         
    580602// local variables 
    581603        Variable nord,ii,va,vb,summ,yyy,zi 
     
    631653 
    632654//**** The coefficient wave is passed into this function and straight through to the unsmeared model function 
    633  
     655// special case of integral limits that are identical 
     656        if(upLim == loLim) 
     657                return( fcn(w,x, loLim)) 
     658        endif 
     659         
    634660// local variables 
    635661        Variable nord,ii,va,vb,summ,yyy,zi 
     
    906932                endif 
    907933         
    908                 answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
    909 //              Smear_Model_N_AAO(fcn,w,x,resW,weightW,abscissW,nord,answer) 
     934//              answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
     935                Smear_Model_N_AAO(fcn,w,x,resW,weightW,abscissW,nord,answer) 
    910936                 
    911937                Return (0) 
     
    956982                endif 
    957983         
    958                 answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
    959 //              Smear_Model_N_AAO(fcn,w,x,resW,weightW,abscissW,nord,answer) 
     984//              answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
     985                Smear_Model_N_AAO(fcn,w,x,resW,weightW,abscissW,nord,answer) 
    960986 
    961987                Return (0) 
     
    9821008        String weightStr,zStr 
    9831009        Variable nord=20 
     1010 
    9841011         
    9851012        if (dimsize(resW,1) > 4 && useTrap != 1) 
     
    10121039                endif 
    10131040         
    1014                 answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
    1015 //              Smear_Model_N_AAO(fcn,w,x,resW,weightW,abscissW,nord,answer) 
     1041//              answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
     1042                Smear_Model_N_AAO(fcn,w,x,resW,weightW,abscissW,nord,answer) 
    10161043 
    10171044                Return (0) 
     
    10601087                endif 
    10611088         
    1062                 answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
    1063 //              Smear_Model_N_AAO(fcn,w,x,resW,weightW,abscissW,nord,answer) 
     1089//              answer = Smear_Model_N(fcn,w,x,resW,weightW,abscissW,nord) 
     1090                Smear_Model_N_AAO(fcn,w,x,resW,weightW,abscissW,nord,answer) 
    10641091 
    10651092                Return (0) 
     
    16121639// provides some speedup. 
    16131640// 
    1614 //// APRIL 2011 *** this function is NOT YET CURSOR-AWARE. This needs to be addressed before it can be used 
     1641//// APRIL 2011 *** this function is now cursor aware. The whole input x-wave is interpolated 
    16151642// 
    16161643// 
     
    16531680        // returned from the interpolation (as expected) 
    16541681 
    1655         Make/O/D/N=(DimSize(resW, 0)) sigQ,qbar,shad,qvals,va,vb 
    1656         sigq = resW[p][0]               //std dev of resolution fn 
    1657         qbar = resW[p][1]               //mean q-value 
    1658         shad = resW[p][2]               //beamstop shadow factor 
    1659         qvals = resW[p][3]      //q-values where R(q) is known 
    1660  
    1661         //SKIP the interpolation, points passed in ARE (MUST) be the experimental q-values 
    1662          
     1682        Make/O/D/N=(numpnts(x)) sigQ,qbar,shad,qvals,va,vb 
     1683        Make/O/D/N=(DimSize(resW, 0)) tmpsigQ,tmpqbar,tmpshad,tmpqvals 
     1684        tmpsigq = resW[p][0]            //std dev of resolution fn 
     1685        tmpqbar = resW[p][1]            //mean q-value 
     1686        tmpshad = resW[p][2]            //beamstop shadow factor 
     1687        tmpqvals = resW[p][3]   //q-values where R(q) is known 
     1688 
     1689        //interpolate the whole input x-wave to make sure that the resolution and input x are in sync if cursors are used 
     1690        shad = interp(x,tmpqvals,tmpshad) 
     1691        qbar = interp(x,tmpqvals,tmpqbar) 
     1692        sigq = interp(x,tmpqvals,tmpsigq) 
    16631693         
    16641694        // if USANS data, handle separately 
     
    17551785        sm_ans /= normalize 
    17561786         
     1787        KillWaves/Z tmpsigQ,tmpqbar,tmpshad,tmpqvals 
     1788         
    17571789        return(0) 
    17581790         
Note: See TracChangeset for help on using the changeset viewer.