Changeset 292


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

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

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r289 r292  
    452452                            Data['cutoff'] = 10
    453453                            Data['pixLimit'] = 20
     454                            Data['edgemin'] = 100000000
    454455                            Data['calibdmin'] = 0.5
    455456                            Data['calibskip'] = 0
     
    468469                            Data['calibdmin'] = 0.5
    469470                            Data['calibskip'] = 0
     471                            Data['edgemin'] = 100000000
    470472                            Data['ellipses'] = []
    471473                            Data['calibrant'] = ''
  • trunk/GSASIIIO.py

    r281 r292  
    8080            else:
    8181                Comments.append(S[:-1])
    82                 if 'Temp' in S:
    83                     Temperature = float(S[:-1].split()[-1])
     82                if 'Temp' in S.split('=')[0]:
     83                    Temperature = float(S.split('=')[1])
    8484        File.close()
    8585    finally:
  • trunk/GSASIIimage.py

    r282 r292  
    170170        return xpix,ypix,np.ravel(Z)[Zmax],np.ravel(Z)[Zmin]
    171171    else:
    172         return 0,0,0,0
     172        return 0,0,0,0     
    173173   
    174174def makeRing(dsp,ellipse,pix,reject,scalex,scaley,image):
     
    326326    return abs(avg-curr)/avg < .02
    327327
     328def EdgeFinder(image,data):          #this makes list of all x,y where I>edgeMin suitable for an ellipse search?
     329    import numpy.ma as ma
     330    Nx,Ny = data['size']
     331    pixelSize = data['pixelSize']
     332    edgemin = data['edgemin']
     333    scalex = pixelSize[0]/1000.
     334    scaley = pixelSize[1]/1000.   
     335    tay,tax = np.mgrid[0:Nx,0:Ny]
     336    tax = np.asfarray(tax*scalex,dtype=np.float32)
     337    tay = np.asfarray(tay*scaley,dtype=np.float32)
     338    tam = ma.getmask(ma.masked_less(image.flatten(),edgemin))
     339    tax = ma.compressed(ma.array(tax.flatten(),mask=tam))
     340    tay = ma.compressed(ma.array(tay.flatten(),mask=tam))
     341    return zip(tax,tay)
     342           
    328343def ImageCalibrate(self,data):
    329344    import copy
     
    373388    skip = data['calibskip']
    374389    dmin = data['calibdmin']
    375     Bravais,cell = calFile.Calibrants[data['calibrant']][:2]
    376     A = G2lat.cell2A(cell)
     390    Bravais,Cells = calFile.Calibrants[data['calibrant']][:2]
     391    HKL = []
     392    for bravais,cell in zip(Bravais,Cells):
     393        A = G2lat.cell2A(cell)
     394        hkl = G2lat.GenHBravais(dmin,bravais,A)[skip:]
     395        HKL += hkl
     396    HKL = G2lat.sortHKLd(HKL,True,False)
    377397    wave = data['wavelength']
    378398    cent = data['center']
    379399    elcent,phi,radii = ellipse
    380     HKL = G2lat.GenHBravais(dmin,Bravais,A)[skip:]
    381400    dsp = HKL[0][3]
    382401    tth = 2.0*asind(wave/(2.*dsp))
  • 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):
  • trunk/ImageCalibrants.py

    r267 r292  
    44#Useful Bravais nos.: F-cubic=0,I-cubic=1,P-cubic=2,R3/m(hex)=3, P6=4, P4mmm=6
    55Calibrants={
    6 '':(0,(0,0,0,0,0,0),0,(0,0,0)),
    7 'LaB6  SRM660a':(2,(4.1569162,4.1569162,4.1569162,90,90,90),0,(0.5,20,10)),
    8 'LaB6  SRM660a skip 1':(2,(4.1569162,4.1569162,4.1569162,90,90,90),1,(0.5,20,10)),
    9 'LaB6  SRM660': (2,(4.15695,4.15695,4.15695,90,90,90),0,(0.5,20,10)),
    10 'Si    SRM640c':(0,(5.4311946,5.4311946,5.4311946,90,90,90),0,(0.5,20,10)),
    11 'CeO2  SRM674b':(0,(5.411651,5.411651,5.411651,90,90,90),0,(0.5,2,1)),
    12 'Al2O3 SRM676a':(3,(4.759091,4.759091,12.991779,90,90,120),0,(0.75,5,5)),
    13 'Ni   @ 298K':(0,(3.52475,3.52475,3.52475,90,90,90),0,(0.5,20,10)),
    14 'NaCl @ 298K':(0,(5.6402,5.6402,5.6402,90,90,90),0,(0.5,20,10)),
    15 'NaCl even hkl only':(2,(2.8201,2.8201,2.8201,90,90,90),0,(0.5,20,10)),
    16 'Ag behenate':(6,(1.0,1.0,58.380,90,90,90),0,(7.0,5,1)),
    17 'Spun Si grating':(6,(1.0,1.0,2777.78,90,90,90),2,(200.,5,1)),
    18 'Pt   @ 298K':(0,(3.9231,3.9231,3.9231,90,90,90),0,(0.5,5,1)),
    19     }
     6'':([0,],[(0,0,0,0,0,0),],0,(0,0,0)),
     7'LaB6  SRM660a':([2,],[(4.1569162,4.1569162,4.1569162,90,90,90),],0,(0.5,20,10)),
     8'LaB6  SRM660a skip 1':([2,],[(4.1569162,4.1569162,4.1569162,90,90,90),],1,(0.5,20,10)),
     9'LaB6  SRM660': ([2,],[(4.15695,4.15695,4.15695,90,90,90),],0,(0.5,20,10)),
     10'Si    SRM640c':([0,],[(5.4311946,5.4311946,5.4311946,90,90,90),],0,(0.5,20,10)),
     11'CeO2  SRM674b':([0,],[(5.411651,5.411651,5.411651,90,90,90),],0,(0.5,2,1)),
     12'Al2O3 SRM676a':([3,],[(4.759091,4.759091,12.991779,90,90,120),],0,(0.75,5,5)),
     13'Ni   @ 298K':([0,],[(3.52475,3.52475,3.52475,90,90,90),],0,(0.5,20,10)),
     14'NaCl @ 298K':([0,],[(5.6402,5.6402,5.6402,90,90,90),],0,(0.5,20,10)),
     15'NaCl even hkl only':([2,],[(2.8201,2.8201,2.8201,90,90,90),],0,(0.5,20,10)),
     16'Ag behenate':([6,],[(1.0,1.0,58.380,90,90,90),],0,(7.0,5,1)),
     17'Spun Si grating':([6,],[(1.0,1.0,2777.78,90,90,90),],2,(200.,5,1)),
     18'Pt   @ 298K':([0,],[(3.9231,3.9231,3.9231,90,90,90),],0,(0.5,5,1)),
     19'LaB6 & CeO2':([2,0],[(4.1569162,4.1569162,4.1569162,90,90,90),(5.411651,5.411651,5.411651,90,90,90)],0,(0.5,2,1)),
     20}
     21   
Note: See TracChangeset for help on using the changeset viewer.