Changeset 4587 for trunk/GSASIIimage.py
 Timestamp:
 Oct 8, 2020 9:59:00 AM (12 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIimage.py
r4586 r4587 522 522 return GetDetectorXY(dsp,Azm,data) 523 523 524 def GetTthAzmDsp (x,y,data): #expensive524 def GetTthAzmDsp2(x,y,data): #expensive 525 525 '''Computes a 2theta, etc. from a detector position and calibration constants  checked 526 526 OK for ellipses & hyperbola. … … 553 553 return np.array([tth,azm,G,dsp]) 554 554 555 def GetTthAzmDsp(x,y,data): #expensive 556 '''Computes a 2theta, etc. from a detector position and calibration constants  checked 557 OK for ellipses & hyperbola. 558 559 :returns: np.array(tth,azm,G,dsp) where tth is 2theta, azm is the azimutal angle, 560 G is ? and dsp is the dspace 561 ''' 562 563 def costth(xyz): 564 u = xyz/nl.norm(xyz,axis=1)[:,:,nxs] 565 return np.dot(u,np.array([0.,0.,1.])) 566 567 #zero detector 2theta: tested with tilted images  perfect integrations 568 wave = data['wavelength'] 569 dx = xdata['center'][0] 570 dy = ydata['center'][1] 571 tilt = data['tilt'] 572 dist = data['distance']/npcosd(tilt) #samplebeam intersection point 573 T = makeMat(tilt,0) 574 R = makeMat(data['rotation'],2) 575 MN = np.inner(R,np.inner(R,T)) 576 dxyz0 = np.inner(np.dstack([dx,dy,np.zeros_like(dx)]),MN) #correct for 45 deg tilt 577 dxyz0 += np.array([0.,0.,dist]) 578 if data['DetDepth']: 579 ctth0 = costth(dxyz0) 580 tth0 = npacosd(ctth0) 581 dzp = peneCorr(tth0,data['DetDepth'],dist) 582 dxyz0[:,:,2] += dzp 583 #non zero detector 2theta: 584 if data['det2theta']: 585 tthMat = makeMat(data['det2theta'],1) 586 dxyz = np.inner(dxyz0,tthMat.T) 587 else: 588 dxyz = dxyz0 589 ctth = costth(dxyz) 590 tth = npacosd(ctth) 591 dsp = wave/(2.*npsind(tth/2.)) 592 azm = (npatan2d(dxyz[:,:,1],dxyz[:,:,0])+data['azmthOff']+720.)%360. 593 # Gcalculation 594 x0 = data['distance']*nptand(tilt) 595 x0x = x0*npcosd(data['rotation']) 596 x0y = x0*npsind(data['rotation']) 597 distsq = data['distance']**2 598 G = ((dxx0x)**2+(dyx0y)**2+distsq)/distsq #for geometric correction = 1/cos(2theta)^2 if tilt=0. 599 return np.array([tth,azm,G,dsp]) 600 555 601 def GetTth(x,y,data): 556 602 'Give 2theta value for detector x,y position; calibration info in data' … … 589 635 calibration info in data  only used in integration 590 636 checked OK for ellipses & hyperbola 591 '''592 637 This is the slow step in image integration 638 ''' 593 639 def costth(xyz): 594 640 u = xyz/nl.norm(xyz,axis=1)[:,:,nxs] … … 610 656 dzp = peneCorr(tth0,data['DetDepth'],dist) 611 657 dxyz0[:,:,2] += dzp 612 #non zero detector 2theta: 613 tthMat = makeMat(data['det2theta'],1) 614 dxyz = np.inner(dxyz0,tthMat.T) 658 #non zero detector 2theta: 659 if data['det2theta']: 660 tthMat = makeMat(data['det2theta'],1) 661 dxyz = np.inner(dxyz0,tthMat.T) 662 else: 663 dxyz = dxyz0 615 664 ctth = costth(dxyz) 616 665 tth = npacosd(ctth) 617 azm = (npatan2d(dxyz[:,:,1],dxyz[:,:,0])+data['azmthOff']+720.)%360. 666 azm = (npatan2d(dxyz[:,:,1],dxyz[:,:,0])+data['azmthOff']+720.)%360. 618 667 # Gcalculation 619 668 x0 = data['distance']*nptand(tilt)
Note: See TracChangeset
for help on using the changeset viewer.