Changeset 292
- Timestamp:
- May 17, 2011 4:45:20 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r289 r292 452 452 Data['cutoff'] = 10 453 453 Data['pixLimit'] = 20 454 Data['edgemin'] = 100000000 454 455 Data['calibdmin'] = 0.5 455 456 Data['calibskip'] = 0 … … 468 469 Data['calibdmin'] = 0.5 469 470 Data['calibskip'] = 0 471 Data['edgemin'] = 100000000 470 472 Data['ellipses'] = [] 471 473 Data['calibrant'] = '' -
trunk/GSASIIIO.py
r281 r292 80 80 else: 81 81 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]) 84 84 File.close() 85 85 finally: -
trunk/GSASIIimage.py
r282 r292 170 170 return xpix,ypix,np.ravel(Z)[Zmax],np.ravel(Z)[Zmin] 171 171 else: 172 return 0,0,0,0 172 return 0,0,0,0 173 173 174 174 def makeRing(dsp,ellipse,pix,reject,scalex,scaley,image): … … 326 326 return abs(avg-curr)/avg < .02 327 327 328 def 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 328 343 def ImageCalibrate(self,data): 329 344 import copy … … 373 388 skip = data['calibskip'] 374 389 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) 377 397 wave = data['wavelength'] 378 398 cent = data['center'] 379 399 elcent,phi,radii = ellipse 380 HKL = G2lat.GenHBravais(dmin,Bravais,A)[skip:]381 400 dsp = HKL[0][3] 382 401 tth = 2.0*asind(wave/(2.*dsp)) -
trunk/GSASIIpwd.py
r289 r292 55 55 Parameters 56 56 ----------------------------------------- 57 x: array like 2-theta positions57 x: array like 2-theta steps (-1 to 1) 58 58 t: 2-theta position of peak 59 59 s: sum(S/L,H/L); S: sample height, H: detector opening, 60 60 L: sample to detector opening distance 61 dx: 2-theta step size in deg 61 62 Result for fcj.pdf 62 63 ----------------------------------------- 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: 66 71 fcj.pdf = 0 67 72 """ 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 70 76 bx = npcosd(t)**2 71 77 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 74 81 # def _cdf(self, x): 75 82 # def _ppf(self, q): … … 90 97 Parameters 91 98 ----------------------------------------- 92 x: array like 2-theta positions99 x: array like 2-theta step numbers (-1 to 1) 93 100 t: 2-theta position of peak 94 101 h: detector opening height/sample to detector opening distance 95 102 s: sample height/sample to detector opening distance 103 dx: 2-theta step size in deg 96 104 Result for fcj2.pdf 97 105 ----------------------------------------- 106 if t < 90: 107 X = dx*x+t 108 else: 109 X = 180.-dx*x-t 98 110 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 106 115 for 2phi >= 2th 107 116 """ 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 112 122 bx = npcosd(t)**2 113 123 bx = np.where(ax>bx,bx,ax) … … 115 125 W1 = h+s-H 116 126 W2 = np.where ((h > s),2.*s,2.*h) 117 fx = 2.*h*np.sqrt((ax/bx)-1.)*np cosd(x)127 fx = 2.*h*np.sqrt((ax/bx)-1.)*np.sqrt(ax) 118 128 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) 120 130 return np.where((fx > 0.),fx,0.0) 121 131 # def _cdf(self, x): … … 133 143 """ 134 144 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) 137 162 138 163 for 2phi < 2tth & shl = S/L+H/L … … 142 167 for 2phi >= 2th 143 168 """ 144 def _argcheck(self,t,s,d ):169 def _argcheck(self,t,s,d,dx): 145 170 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 150 176 bx = npcosd(t)**2 151 177 bx = np.where(ax>bx,bx,ax) … … 153 179 W1 = s-H 154 180 W2 = np.where ((d > 0),s-d,s+d) 155 fx = np.where(ax>bx,1./((s+d)*np.sqrt((ax/bx)-1.)*np cosd(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) 157 183 return np.where((fx > 0.),fx,0.0) 158 184 # def _cdf(self, x): -
trunk/ImageCalibrants.py
r267 r292 4 4 #Useful Bravais nos.: F-cubic=0,I-cubic=1,P-cubic=2,R3/m(hex)=3, P6=4, P4mmm=6 5 5 Calibrants={ 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.