Changeset 292 for trunk/GSASIIpwd.py
- Timestamp:
- May 17, 2011 4:45:20 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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):
Note: See TracChangeset
for help on using the changeset viewer.