Changeset 742 for sans/Dev


Ignore:
Timestamp:
Sep 16, 2010 11:30:35 AM (12 years ago)
Author:
srkline
Message:

fix for ticket #279: calculation of the slope when desmearing.

Now the behavior is for the desmearing panel to use the slope as found when loading the .cor data. For a fresh file, it proceeds as usual. For a previously-loaded file, be sure to NOT re-load the file (<no> from the dialog) so that the slope is not recalculated, and the data is simply plotted. Then the slope information is copied along with the data to the desmearing folder.

The changed behavior is when selecting the "Extrapolate" tab. Now the extrapolation is automatically calculated from the loading parameters (not re-fit) and displayed on the graph. If the extrapolation is good, nothing needs to be done. In fact, since the extrapolation (slope) should be acceptable from the load, the mask, extrapolate, and smooth tabs can all be skipped, proceeding directly to the desmear tab.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/LakeDesmearing_JB.ipf

    r665 r742  
    9090        Variable/G gMaxSlowIter = 10000 
    9191         
    92         Variable/G gNptsExtrap = 10             //points for high q extrapolation 
     92        Variable/G gNptsExtrap = 15             //points for high q extrapolation 
    9393        Variable/G gChi2Target = 1              //chi^2 target 
    9494        Variable/G gPowerM = -4 
     
    744744        Variable num=numpnts(iw),retVal 
    745745         
     746         
     747        /////////for the fit 
    746748        Make/O/D P_coef={0,1,-4}                        //input 
    747 //      Make/O/T Constr={"K2<0","K2 > -20"} 
     749        Make/O/T Constr={"K2<0","K2 > -8"} 
    748750        //(set background to zero and hold fixed) 
    749         CurveFit/H="100" Power kwCWave=P_coef  iw[(num-1-nend),(num-1)] /X=qw /W=sw /D  
     751         
     752        // initial guess  
     753        P_coef[1] = iw[num-1]/qw[num-1]^P_coef[2] 
     754                 
     755        CurveFit/H="100" Power kwCWave=P_coef  iw[(num-1-nend),(num-1)] /X=qw /W=sw /I=1 /C=constr 
    750756        extr_hqi=P_coef[0]+P_coef[1]*extr_hqq^P_coef[2] 
    751757         
     
    756762//      CurveFit Power kwCWave=P_coef  iw[(num-1-nend),(num-1)] /X=qw /W=sw /D  
    757763//      extr_hqi=P_coef[0]+P_coef[1]*extr_hqq^P_coef[2] 
     764         
     765//      if(checked && if(not already displayed)) 
     766//              AppendToGraph extr_hqi vs extr_hqq 
     767//              ModifyGraph lsize(extr_hqi)=2 
     768//      endif 
    758769         
    759770         
     
    949960        endif 
    950961         
     962        if(tab == 2) 
     963                //calculate the extrapolation when the tab is selected - this re-fits the data, what we want to avoid 
     964//              DSM_ExtrapolateButtonProc("") 
     965                 
     966                // OR 
     967                // use the coefficients from when it was loaded 
     968                SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder         
     969                WAVE P_coef = $(USANSFolder+":DSM:P_coef") 
     970                wave Qw = $(USANSFolder+":DSM:Q_exp") 
     971                 
     972                DSM_SetExtrWaves(Qw) 
     973                Wave extr_hqi=$(USANSFolder+":DSM:extr_hqi") 
     974                Wave extr_hqq=$(USANSFolder+":DSM:extr_hqq") 
     975                extr_hqi=P_coef[0]+P_coef[1]*extr_hqq^P_coef[2] 
     976 
     977                AppendExtrapolation() 
     978                 
     979        endif 
     980         
    951981        return 0 
    952982End 
     
    10921122        String DFStr= CleanupName(fname,0) 
    10931123         
    1094         Duplicate/O $("root:"+DFStr+":"+qStr) $(USANSFolder+":DSM:Q_exp ")               
     1124        Duplicate/O $("root:"+DFStr+":"+qStr) $(USANSFolder+":DSM:Q_exp")                
    10951125        Duplicate/O $("root:"+DFStr+":"+iStr) $(USANSFolder+":DSM:I_exp")                
    1096         Duplicate/O $("root:"+DFStr+":"+sStr) $(USANSFolder+":DSM:S_exp ")       
     1126        Duplicate/O $("root:"+DFStr+":"+sStr) $(USANSFolder+":DSM:S_exp")        
    10971127        wave Q_exp = $(USANSFolder+":DSM:Q_exp") 
    10981128        Wave I_exp = $(USANSFolder+":DSM:I_exp") 
    10991129        Wave S_exp = $(USANSFolder+":DSM:S_exp") 
     1130         
     1131        // copy over the high q extrapolation information 
     1132        Duplicate/O $("root:"+DFStr+":P_coef") $(USANSFolder+":DSM:P_coef")      
     1133        NVAR slope = $("root:"+DFStr+":USANS_m") 
     1134        NVAR powerM = $(USANSFolder+":DSM:gPowerM") 
     1135        powerM = slope 
    11001136         
    11011137        // remove any negative q-values (and q=0 values!)(and report this) 
Note: See TracChangeset for help on using the changeset viewer.