Changeset 1394
 Timestamp:
 Jun 24, 2014 2:13:11 PM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIimage.py
r1393 r1394 365 365 def GetTthAzmDsp(x,y,data): #expensive 366 366 'Needs a doc string  checked OK for ellipses & hyperbola' 367 wave = data['wavelength'] 368 cent = data['center'] 369 tilt = data['tilt'] 370 dist = data['distance']/cosd(tilt) 371 x0 = data['distance']*tand(tilt) 372 phi = data['rotation'] 373 dep = data['DetDepth'] 374 LRazim = data['LRazimuth'] 375 azmthoff = data['azmthOff'] 376 dx = np.array(xcent[0],dtype=np.float32) 377 dy = np.array(ycent[1],dtype=np.float32) 378 D = ((dxx0)**2+dy**2+data['distance']**2) #sample to pixel distance 379 X = np.array(([dx,dy,np.zeros_like(dx)]),dtype=np.float32).T 380 X = np.dot(X,makeMat(phi,2)) 381 Z = np.dot(X,makeMat(tilt,0)).T[2] 382 tth = npatand(np.sqrt(dx**2+dy**2Z**2)/(distZ)) 383 dxy = peneCorr(tth,dep,tilt,npatan2d(dy,dx)) 384 DX = distZ+dxy 385 DY = np.sqrt(dx**2+dy**2Z**2) 386 tth = npatan2d(DY,DX) 387 dsp = wave/(2.*npsind(tth/2.)) 388 azm = (npatan2d(dy,dx)+azmthoff+720.)%360. 389 G = D/data['distance']**2 #for geometric correction = 1/cos(2theta)^2 if tilt=0. 390 return np.array([tth,azm,G,dsp]) 391 392 def GetTth(x,y,data): 393 'Give 2theta value for detector x,y position; calibration info in data' 394 return GetTthAzmDsp(x,y,data)[0] 395 396 def GetTthAzm(x,y,data): 397 'Give 2theta, azimuth values for detector x,y position; calibration info in data' 398 return GetTthAzmDsp(x,y,data)[0:2] 399 400 def GetTthAzmG(x,y,data): 401 '''Give 2theta, azimuth & geometric corr. values for detector x,y position; 402 calibration info in data  only used in integration 403 ''' 404 'Needs a doc string  checked OK for ellipses & hyperbola' 367 405 tilt = data['tilt'] 368 406 dist = data['distance']/npcosd(tilt) 369 407 x0 = data['distance']*nptand(tilt) 408 MN = np.inner(makeMat(data['rotation'],2),makeMat(tilt,0)) 409 distsq = data['distance']**2 370 410 dx = xdata['center'][0] 371 411 dy = ydata['center'][1] 372 D = ((dxx0)**2+dy**2+data['distance']**2) #sample to pixel distance412 G = ((dxx0)**2+dy**2+distsq)/distsq #for geometric correction = 1/cos(2theta)^2 if tilt=0. 373 413 X = np.dstack([dx.T,dy.T,np.zeros_like(dx.T)]) 374 MN = np.inner(makeMat(data['rotation'],2),makeMat(tilt,0))375 414 Z = np.dot(X,MN).T[2] 376 415 tth = npatand(np.sqrt(dx**2+dy**2Z**2)/(distZ)) 377 416 dxy = peneCorr(tth,data['DetDepth'],tilt,npatan2d(dy,dx)) 378 DX = distZ+dxy 379 DY = np.sqrt(dx**2+dy**2Z**2) 380 tth = npatan2d(DY,DX) 381 dsp = data['wavelength']/(2.*npsind(tth/2.)) 417 tth = npatan2d(np.sqrt(dx**2+dy**2Z**2),distZ+dxy) 382 418 azm = (npatan2d(dy,dx)+data['azmthOff']+720.)%360. 383 G = D/data['distance']**2 #for geometric correction = 1/cos(2theta)^2 if tilt=0. 384 return tth,azm,G,dsp 385 386 def GetTth(x,y,data): 387 'Give 2theta value for detector x,y position; calibration info in data' 388 return GetTthAzmDsp(x,y,data)[0] 389 390 def GetTthAzm(x,y,data): 391 'Give 2theta, azimuth values for detector x,y position; calibration info in data' 392 return GetTthAzmDsp(x,y,data)[0:2] 393 394 def GetTthAzmG(x,y,data): 395 '''Give 2theta, azimuth & geometric corr. values for detector x,y position; 396 calibration info in data 397 ''' 398 return GetTthAzmDsp(x,y,data)[0:3] 419 return tth,azm,G 399 420 400 421 def GetDsp(x,y,data):
Note: See TracChangeset
for help on using the changeset viewer.