Changeset 292 for trunk/GSASIIpwd.py


Ignore:
Timestamp:
May 17, 2011 4:45:20 PM (11 years ago)
Author:
vondreele
Message:

allow more than one phase for calibration
fix temperature reading from 11BM header

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r289 r292  
    5555    Parameters
    5656    -----------------------------------------
    57     x: array like 2-theta positions
     57    x: array like 2-theta steps (-1 to 1)
    5858    t: 2-theta position of peak
    5959    s: sum(S/L,H/L); S: sample height, H: detector opening,
    6060        L: sample to detector opening distance
     61    dx: 2-theta step size in deg
    6162    Result for fcj.pdf
    6263    -----------------------------------------
    63     if x < t & s = S/L+H/L:
    64         fcj.pdf = [1/sqrt({cos(x)**2/cos(t)**2}-1) - 1/s]/cos(x)   
    65     if x >= t:
     64    if t < 90:
     65        X = dx*x+t
     66    else:
     67        X = 180.-dx*x-t
     68    if X < t & s = S/L+H/L:
     69        fcj.pdf = [1/sqrt({cos(x)**2/cos(t)**2}-1) - 1/s]/|cos(X)|   
     70    if X >= t:
    6671        fcj.pdf = 0   
    6772    """
    68     def _pdf(self,x,t,s):
    69         ax = npcosd(x)**2
     73    def _pdf(self,x,t,s,dx):
     74        T = np.where(t<=90.,dx*x+t,180.-dx*x-t)
     75        ax = npcosd(T)**2
    7076        bx = npcosd(t)**2
    7177        bx = np.where(ax>bx,bx,ax)
    72         fx = np.where(ax>bx,(1./np.sqrt((ax/bx)-1.)-1./s)/npcosd(x),0.0)
    73         return np.where(((x < t) & (fx > 0)),fx,0.0)
     78        fx = np.where(ax>bx,(np.sqrt(bx/(ax-bx))-1./s)/np.sqrt(ax),0.0)
     79        fx = np.where(fx > 0,fx,0.0)
     80        return fx
    7481#    def _cdf(self, x):
    7582#    def _ppf(self, q):
     
    9097    Parameters
    9198    -----------------------------------------
    92     x: array like 2-theta positions
     99    x: array like 2-theta step numbers (-1 to 1)
    93100    t: 2-theta position of peak
    94101    h: detector opening height/sample to detector opening distance
    95102    s: sample height/sample to detector opening distance
     103    dx: 2-theta step size in deg
    96104    Result for fcj2.pdf
    97105    -----------------------------------------
     106    if t < 90:
     107        X = dx*x+t
     108    else:
     109        X = 180.-dx*x-t
    98110    infl = acos(cos(t)*sqrt((h-s)**2+1))
    99     if x < infl:   
    100         fcj.pdf = [1/sqrt({cos(x)**2/cos(t)**2}-1) - 1/shl]/cos(2phi)
    101    
    102     for 2phi < 2tth & shl = S/L+H/L
    103    
    104     fcj.pdf(x,tth,shl) = 0
    105    
     111    if X < infl:   
     112        fcj.pdf = [1/sqrt({cos(X)**2/cos(t)**2}-1) - 1/shl]/cos(X)   
     113    for X < t & s = S/L+H/L   
     114    fcj.pdf(x,t,s) = 0   
    106115    for 2phi >= 2th
    107116    """
    108     def _pdf(self,x,t,h,s):
    109         a = npcosd(t)*(np.sqrt((h-s)**2+1.))
    110         infl = np.where((a <= 1.),npacosd(a),t)
    111         ax = npcosd(x)**2
     117    def _pdf(self,x,t,h,s,dx):
     118        T = np.where(t<=90.,dx*x+t,180.-dx*x-t)
     119        a = np.abs(npcosd(t))*(np.sqrt((h-s)**2+1.))
     120        infl = np.where((a <= 1.),np.abs(npacosd(a)),T)
     121        ax = npcosd(T)**2
    112122        bx = npcosd(t)**2
    113123        bx = np.where(ax>bx,bx,ax)
     
    115125        W1 = h+s-H
    116126        W2 = np.where ((h > s),2.*s,2.*h)
    117         fx = 2.*h*np.sqrt((ax/bx)-1.)*npcosd(x)
     127        fx = 2.*h*np.sqrt((ax/bx)-1.)*np.sqrt(ax)
    118128        fx = np.where(fx>0.0,1./fx,0.0)
    119         fx = np.where((x < infl),fx*W1,fx*W2)
     129        fx = np.where((T < infl),fx*W1,fx*W2)
    120130        return np.where((fx > 0.),fx,0.0)
    121131#    def _cdf(self, x):
     
    133143    """
    134144    Finger-Cox-Jephcoat D(2phi,2th) function for S/L != H/L using sum & difference
    135    
    136     fcj.pdf(x,tth,shl) = [1/sqrt({cos(2phi)**2/cos(2th)**2}-1) - 1/shl]/cos(2phi)
     145    Ref: J. Appl. Cryst. (1994) 27, 892-900.
     146    Parameters
     147    -----------------------------------------
     148    x: array like 2-theta positions
     149    t: 2-theta position of peak
     150    s: sum(S/L,H/L); S: sample height, H: detector opening,
     151        L: sample to detector opening distance
     152    d: difference(S/L,H/L)
     153    dx: 2-theta step size in deg
     154    Result for fcj2.pdf
     155    -----------------------------------------
     156    if t < 90:
     157        X = dx*x+t
     158    else:
     159        X = 180.-dx*x-t
     160   
     161    fcj.pdf(x,t,s,d) = [1/sqrt({cos(X)**2/cos(t)**2}-1) - 1/shl]/cos(2phi)
    137162   
    138163    for 2phi < 2tth & shl = S/L+H/L
     
    142167    for 2phi >= 2th
    143168    """
    144     def _argcheck(self,t,s,d):
     169    def _argcheck(self,t,s,d,dx):
    145170        return (t > 0)&(s > 0)&(abs(d) < s)
    146     def _pdf(self,x,t,s,d):
    147         a = npcosd(t)*np.sqrt(d**2+1.)
    148         infl = np.where((a < 1.),npacosd(a),t)
    149         ax = npcosd(x)**2
     171    def _pdf(self,x,t,s,d,dx):
     172        T = np.where(t<=90.,dx*x+t,180.-dx*x-t)
     173        a = np.abs(npcosd(t))*np.sqrt(d**2+1.)
     174        infl = np.where((a < 1.),np.abs(npacosd(a)),T)
     175        ax = npcosd(T)**2
    150176        bx = npcosd(t)**2
    151177        bx = np.where(ax>bx,bx,ax)
     
    153179        W1 = s-H
    154180        W2 = np.where ((d > 0),s-d,s+d)
    155         fx = np.where(ax>bx,1./((s+d)*np.sqrt((ax/bx)-1.)*npcosd(x)),0.0)
    156         fx = np.where((x < infl),fx*W1,fx*W2)
     181        fx = np.where(ax>bx,1./((s+d)*np.sqrt((ax/bx)-1.)*np.sqrt(ax)),0.0)
     182        fx = np.where((T < infl),fx*W1,fx*W2)
    157183        return np.where((fx > 0.),fx,0.0)
    158184#    def _cdf(self, x):
Note: See TracChangeset for help on using the changeset viewer.