Changeset 1394


Ignore:
Timestamp:
Jun 24, 2014 2:13:11 PM (7 years ago)
Author:
vondreele
Message:

restore old GetTthAzmDsp? for calibration & strain fitting & use new GetTthAzmG for integration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r1393 r1394  
    365365def GetTthAzmDsp(x,y,data): #expensive
    366366    '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(x-cent[0],dtype=np.float32)
     377    dy = np.array(y-cent[1],dtype=np.float32)
     378    D = ((dx-x0)**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**2-Z**2)/(dist-Z))
     383    dxy = peneCorr(tth,dep,tilt,npatan2d(dy,dx))
     384    DX = dist-Z+dxy
     385    DY = np.sqrt(dx**2+dy**2-Z**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   
     392def GetTth(x,y,data):
     393    'Give 2-theta value for detector x,y position; calibration info in data'
     394    return GetTthAzmDsp(x,y,data)[0]
     395   
     396def GetTthAzm(x,y,data):
     397    'Give 2-theta, azimuth values for detector x,y position; calibration info in data'
     398    return GetTthAzmDsp(x,y,data)[0:2]
     399   
     400def GetTthAzmG(x,y,data):
     401    '''Give 2-theta, 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'
    367405    tilt = data['tilt']
    368406    dist = data['distance']/npcosd(tilt)
    369407    x0 = data['distance']*nptand(tilt)
     408    MN = -np.inner(makeMat(data['rotation'],2),makeMat(tilt,0))
     409    distsq = data['distance']**2
    370410    dx = x-data['center'][0]
    371411    dy = y-data['center'][1]
    372     D = ((dx-x0)**2+dy**2+data['distance']**2)      #sample to pixel distance
     412    G = ((dx-x0)**2+dy**2+distsq)/distsq       #for geometric correction = 1/cos(2theta)^2 if tilt=0.
    373413    X = np.dstack([dx.T,dy.T,np.zeros_like(dx.T)])
    374     MN = -np.inner(makeMat(data['rotation'],2),makeMat(tilt,0))
    375414    Z = np.dot(X,MN).T[2]
    376415    tth = npatand(np.sqrt(dx**2+dy**2-Z**2)/(dist-Z))
    377416    dxy = peneCorr(tth,data['DetDepth'],tilt,npatan2d(dy,dx))
    378     DX = dist-Z+dxy
    379     DY = np.sqrt(dx**2+dy**2-Z**2)
    380     tth = npatan2d(DY,DX)
    381     dsp = data['wavelength']/(2.*npsind(tth/2.))
     417    tth = npatan2d(np.sqrt(dx**2+dy**2-Z**2),dist-Z+dxy)
    382418    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 2-theta 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 2-theta, 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 2-theta, 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
    399420
    400421def GetDsp(x,y,data):
Note: See TracChangeset for help on using the changeset viewer.