Changeset 1148 for trunk/GSASIIIO.py


Ignore:
Timestamp:
Nov 23, 2013 5:29:28 PM (8 years ago)
Author:
vondreele
Message:

major changes to 2-D detector calibration; now works for strongly tilted detectors & short sample to detector distances.
Distance is now defined as sample to detector plane. Previously it was sample to intercept of detector plane with incident beam (Bragg cone axis).
The "penetration" parameter is still suspect.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r1147 r1148  
    410410    File = open(filename,'rb')
    411411    dataType = 5
     412    center = [None,None]
     413    wavelength = None
     414    distance = None
    412415    try:
    413416        Meta = open(filename+'.metadata','Ur')
     
    464467        pixy = (marFrame.pixelsizeX/1000.0,marFrame.pixelsizeY/1000.0)
    465468        head = marFrame.outputHead()
     469# extract resonable wavelength from header
     470        wavelength = marFrame.sourceWavelength*1e-5
     471        wavelength = (marFrame.opticsWavelength > 0) and marFrame.opticsWavelength*1e-5 or wavelength
     472        wavelength = (wavelength <= 0) and None or wavelength
     473# extract resonable distance from header
     474        distance = (marFrame.startXtalToDetector+marFrame.endXtalToDetector)*5e-4
     475        distance = (distance <= 0) and marFrame.xtalToDetector*1e-3 or distance
     476        distance = (distance <= 0) and None or distance
     477# extract resonable center from header
     478        center = [marFrame.beamX*marFrame.pixelsizeX*1e-9,marFrame.beamY*marFrame.pixelsizeY*1e-9]
     479        center = (center[0] != 0 and center[1] != 0) and center or [None,None]
     480#print head,tifType,pixy
    466481    elif 272 in IFD:
    467482        ifd = IFD[272]
     
    561576       
    562577    image = np.reshape(image,(sizexy[1],sizexy[0]))
    563     center = [pixy[0]*sizexy[0]/2000,pixy[1]*sizexy[1]/2000]
    564     data = {'pixelSize':pixy,'wavelength':0.10,'distance':100.0,'center':center,'size':sizexy}
     578    center = (not center[0]) and [pixy[0]*sizexy[0]/2000,pixy[1]*sizexy[1]/2000] or center
     579    wavelength = (not wavelength) and 0.10 or wavelength
     580    distance = (not distance) and 100.0 or distance
     581    data = {'pixelSize':pixy,'wavelength':wavelength,'distance':distance,'center':center,'size':sizexy}
    565582    File.close()   
    566583    if imageOnly:
Note: See TracChangeset for help on using the changeset viewer.