Changeset 700


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

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

Location:
trunk
Files:
2 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       
  • trunk/GSASIIpwdGUI.py

    r699 r700  
    18601860        if len(data) > 1:
    18611861            G2frame.dataFrame.SelectPhase.Enable(True)
    1862         refList = [refl[:11] for refl in data[G2frame.RefList]]
     1862        refList = np.array([refl[:11] for refl in data[G2frame.RefList]])
     1863        Icorr = np.array([refl[13] for refl in data[G2frame.RefList]])
     1864        I100 = refList.T[8]*Icorr
     1865        I100 *= 100.0/np.max(I100)
     1866        refList = np.vstack((refList.T,I100)).T
    18631867    for i in range(len(refList)): rowLabels.append(str(i))
    18641868    if HKLF:
    18651869        colLabels = ['H','K','L','mul','d','Fosq','sig','Fcsq','FoTsq','FcTsq','phase',]
    18661870    else:
    1867         colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase',]
    1868     Types = 4*[wg.GRID_VALUE_LONG,]+4*[wg.GRID_VALUE_FLOAT+':10,4',]+2*[wg.GRID_VALUE_FLOAT+':10,2',]+[wg.GRID_VALUE_FLOAT+':10,3',]
     1871        colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','I100',]
     1872    Types = 4*[wg.GRID_VALUE_LONG,]+4*[wg.GRID_VALUE_FLOAT+':10,4',]+ \
     1873        2*[wg.GRID_VALUE_FLOAT+':10,2',]+[wg.GRID_VALUE_FLOAT+':10,3',]+ \
     1874        [wg.GRID_VALUE_FLOAT+':10,2',]
    18691875    G2frame.PeakTable = G2gd.Table(refList,rowLabels=rowLabels,colLabels=colLabels,types=Types)
    18701876    G2frame.dataFrame.SetLabel('Reflection List for '+phaseName)
     
    18741880    G2frame.dataDisplay.SetMargins(0,0)
    18751881    G2frame.dataDisplay.AutoSizeColumns(False)
    1876     G2frame.dataFrame.setSizePosLeft([555,350])
    1877 
     1882    G2frame.dataDisplay.Fit()
     1883    size = G2frame.dataDisplay.GetSize()
     1884    G2frame.dataFrame.setSizePosLeft([size[0]+32,350])
    18781885################################################################################
    18791886#####  PDF controls
Note: See TracChangeset for help on using the changeset viewer.