Changeset 700 for trunk/GSASIIimage.py


Ignore:
Timestamp:
Aug 8, 2012 2:46:15 PM (9 years ago)
Author:
vondreele
Message:

implement I100 column in Reflection Lists
a bit more of strain fitting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r699 r700  
    1313import numpy as np
    1414import numpy.linalg as nl
     15import copy
    1516import GSASIIpath
    1617GSASIIpath.SetVersionNumber("$Revision$")
     
    386387   
    387388def ImageRecalibrate(self,data):
    388     import copy
    389389    import ImageCalibrants as calFile
    390390    print 'Image recalibration:'
     
    420420        Ring,delt = makeRing(dsp,ellipse,pixLimit,cutoff,scalex,scaley,self.ImageZ)
    421421        if Ring:
    422             numZ = len(Ring)
     422#            numZ = len(Ring)
    423423            data['rings'].append(np.array(Ring))
    424424            data['ellipses'].append(copy.deepcopy(ellipse+('r',)))
     
    750750   
    751751#    print 'Masks:',Masks
    752     wave = Controls['wavelength']
    753     dist = Controls['distance']
    754     center = Controls['center']
    755     rot = Controls['rotation']
    756     tilt = Controls['tilt']
    757     imSize = Controls['size']
    758     pixSize = Controls['pixelSize']
    759     azmOff = Controls['azmthOff']
     752    StaControls = copy.deepcopy(Controls)
     753    StaControls['distance'] += StrSta['Sample z']*cosd(StrSta['Sample phi'])
     754    pixSize = StaControls['pixelSize']
    760755    scalex = 1000./pixSize[0]
    761756    scaley = 1000./pixSize[1]
    762757
    763758    for ring in StrSta['d-zero']:
    764         ellipse = GetEllipse(ring['Dset'],Controls)
     759        ellipse = GetEllipse(ring['Dset'],StaControls)
    765760        Ring,delt = makeRing(ring['Dset'],ellipse,ring['pixLimit'],ring['cutoff'],scalex,scaley,Image)
    766761        Ring = np.array(Ring).T
    767762        ring['ImxyObs'] = np.array(Ring[:2])      #need to apply masks to this to eliminate bad points
    768763        [x,y] = np.array(makeIdealRing(ellipse)).T
    769         Tth,azm = GetTthAzm(x,y,Controls)
    770         th = Tth/2.
    771         th += np.sum(StrSta['strain']*calcFij(StrAta['phi'],0.,azm,th))
    772         Tth = th*2.
     764        if len(x):
     765            Tth,azm = GetTthAzm(x,y,StaControls)
     766            azm += Controls['azmthOff']     #account for detector rotation
     767            th = Tth/2.
     768            th += 180.*np.sum(StrSta['strain']*calcFij(StrSta['Sample phi'],0.,azm,th))/(np.pi*1.e6) #in degrees
     769            Tth = th*2.
    773770       
    774771
     
    791788        [c*d,c*e,c**2]])
    792789    return -Fij*nptand(th)
    793        
     790
     791def FitStrain(rings,p0,wave):
     792    from scipy.optimize import leastsq
     793
     794    def StrainPrint(ValSig):
     795        print 'Strain tensor:'
     796        ptlbls = 'names :'
     797        ptstr =  'values:'
     798        sigstr = 'esds  :'
     799        for name,fmt,value,sig in ValSig:
     800            ptlbls += "%s" % (name.rjust(12))
     801            ptstr += fmt % (value)
     802            if sig:
     803                sigstr += fmt % (sig)
     804            else:
     805                sigstr += 12*' '
     806        print ptlbls
     807        print ptstr
     808        print sigstr
     809       
     810    def strainCalc(E,xyd,wave):
     811        x,y,dsp = xyd
     812        tth = 2.0*npasind(wave/(2.*dsp))
     813       
Note: See TracChangeset for help on using the changeset viewer.