Changeset 308


Ignore:
Timestamp:
Apr 14, 2008 4:33:17 PM (14 years ago)
Author:
srkline
Message:

Modified USANS Slope input to:
1- thicker line that starts at the fitted point
2- re-calculates the line based on the entered slope value - not fitted, but calculated and rescaled so that the user can see if that slope is "better" than the fitted slope, especially if the fit is having trouble.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v4.00/USANS_SlitSmearing_v40.ipf

    r306 r308  
    9191        SetVariable setvar_Slope,pos={160,310},size={90,19},title="Slope",fSize=13 
    9292        SetVariable setvar_Slope,limits={-inf,inf,0},value= USANS_m 
     93        SetVariable setvar_slope, proc=USANS_ManualSlope 
     94         
    9395        Display/W=(9,6,402,305)/HOST=USANS_Slope $(basestr+"_i") vs $(basestr+"_q") 
    9496        RenameWindow #,SlopePlot 
     
    9698        ModifyGraph log=1 
    9799        ModifyGraph mode=3,msize=3,marker=1,rgb=(0,0,0) 
     100//      legend 
    98101        SetActiveSubwindow ## 
    99102         
     
    103106         
    104107        PauseForUser  USANS_Slope        
     108         
     109         
    105110//      return slope 
    106111         
     
    131136        qmax=6*qw[num-1] 
    132137         
    133         extr_hqq = qw[num-1] + x * (qmax-qw[num-1])/num_extr 
     138        // num-1-nend puts the extrapolation over the data set, as well as extending it 
     139        extr_hqq = qw[num-1-nend] + x * (qmax-qw[num-1-nend])/num_extr 
    134140                 
    135141         
     
    157163         
    158164                AppendToGraph/W=USANS_Slope#SlopePlot extr_hqi vs extr_hqq 
     165                ModifyGraph/W=USANS_Slope#SlopePlot lsize(extr_hqi)=2 
    159166         
    160167                Printf "Smeared Power law exponent = %g\r",P_coef[2] 
     
    166173End 
    167174 
     175// adjust the slope manually on the graph (not fitted!!) just for visualization 
     176// 
     177// can be turned off by removing the action proc in the setVariable 
     178// 
     179Function USANS_ManualSlope(ctrlName,varNum,varStr,varName) : SetVariableControl 
     180        String ctrlName 
     181        Variable varNum  
     182        String varStr            
     183        String varName 
     184                 
     185        SVAR baseStr = root:Packages:NIST:USANS_basestr 
     186        NVAR nFit = $("root:"+baseStr+":USANS_slope_numpnts") 
     187        NVAR USANS_m = $("root:"+baseStr+":USANS_m") 
     188        WAVE/Z extr_hqq = $("root:"+baseStr+":extr_hqq") 
     189        WAVE/Z extr_hqi = $("root:"+baseStr+":extr_hqi") 
     190         
     191        if(waveExists(extr_hqq)==0 || waveExists(extr_hqi)==0) 
     192                return(0)               // encourage the user to try to fit first... 
     193        endif 
     194         
     195        Wave iw = $("root:"+basestr+":"+basestr+"_i") 
     196        Wave qw = $("root:"+basestr+":"+basestr+"_q") 
     197 
     198        Variable matchPt,num=numpnts(iw),correctedSlope 
     199        correctedSlope = USANS_m + 1 
     200         
     201        matchPt = iw[num-1-nFit]/(qw[num-1-nFit]^correctedSlope) 
     202         
     203        extr_hqi=matchPt*extr_hqq^correctedSlope 
     204         
     205        return(0) 
     206End 
    168207 
    169208Function USANS_Slope_ButtonProc(ctrlName) : ButtonControl 
Note: See TracChangeset for help on using the changeset viewer.