Changeset 1193


Ignore:
Timestamp:
Jan 13, 2014 8:46:26 AM (9 years ago)
Author:
vondreele
Message:

true vs conventional strain stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r1189 r1193  
    879879    phi = StrSta['Sample phi']
    880880    wave = Controls['wavelength']
     881    StaType = StrSta['Type']
    881882    StaControls['distance'] += StrSta['Sample z']*cosd(phi)
    882883
     
    887888            ring.update(R)
    888889            p0 = ring['Emat']
    889             val,esd = FitStrain(Ring,p0,dset,wave,phi)
     890            val,esd = FitStrain(Ring,p0,dset,wave,phi,StaType)
    890891            ring['Emat'] = val
    891892            ring['Esig'] = esd
     
    897898    phi = StrSta['Sample phi']
    898899    E = StrSta['strain']
     900    StaType = StrSta['Type']
    899901    for ring in StrSta['d-zero']:
    900902        Eij = ring['Emat']
     
    902904        th,azm = ring['ImtaObs']
    903905        th0 = np.ones_like(azm)*npasind(wave/(2.*ring['Dset']))
    904         V = 1.+np.sum(np.sum(E*calcFij(90.,phi,azm,th0).T/1.e6,axis=2),axis=1)
    905         ring['ImtaCalc'] = np.array([V*ring['Dset'],azm])
     906        V = np.sum(np.sum(E*calcFij(90.,phi,azm,th0).T/1.e6,axis=2),axis=1)
     907        if StaType == 'True':
     908            ring['ImtaCalc'] = np.array([np.exp(V)*ring['Dset'],azm])
     909        else:
     910            ring['ImtaCalc'] = np.array([(V+1.)*ring['Dset'],azm])
    906911        ring['Dcalc'] = np.mean(ring['ImtaCalc'][0])
    907912
     
    928933    return -Fij*nptand(th)
    929934
    930 def FitStrain(rings,p0,dset,wave,phi):
     935def FitStrain(rings,p0,dset,wave,phi,StaType):
    931936    'Needs a doc string'
    932937    def StrainPrint(ValSig,dset):
     
    946951        print sigstr
    947952       
    948     def strainCalc(p,xyd,dset,wave,phi):
     953    def strainCalc(p,xyd,dset,wave,phi,StaType):
    949954        E = np.array([[p[0],p[1],0],[p[1],p[2],0],[0,0,0]])
    950955        dspo,azm,dsp = xyd
    951956        th = npasind(wave/(2.0*dspo))
    952         V = 1.+np.sum(np.sum(E*calcFij(90.,phi,azm,th).T/1.e6,axis=2),axis=1)
    953         dspc = dset*V
     957        V = np.sum(np.sum(E*calcFij(90.,phi,azm,th).T/1.e6,axis=2),axis=1)
     958        if StaType == 'True':
     959            dspc = dset*np.exp(V)
     960        else:
     961            dspc = dset*(V+1.)
    954962        return dspo-dspc
    955963       
    956964    names = ['e11','e12','e22']
    957965    fmt = ['%12.2f','%12.2f','%12.2f']
    958     result = leastsq(strainCalc,p0,args=(rings,dset,wave,phi),full_output=True)
     966    result = leastsq(strainCalc,p0,args=(rings,dset,wave,phi,StaType),full_output=True)
    959967    vals = list(result[0])
    960968    chisq = np.sum(result[2]['fvec']**2)/(rings.shape[1]-3)     #reduced chi^2 = M/(Nobs-Nvar)
Note: See TracChangeset for help on using the changeset viewer.