Changeset 3242


Ignore:
Timestamp:
Jan 24, 2018 9:35:01 AM (4 years ago)
Author:
vondreele
Message:

implement calc of mean mustrain from generalized mustrain coefficients

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIddataGUI.py

    r3233 r3242  
    209209        if UseList[G2frame.hist]['Mustrain'][0] == 'generalized':
    210210            Obj.SetValue("%.1f"%(UseList[G2frame.hist]['Mustrain'][4][pid]))          #reset in case of error
     211            wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL))
    211212        else:
    212213            Obj.SetValue("%.1f"%(UseList[G2frame.hist]['Mustrain'][1][pid]))          #reset in case of error
     
    412413       
    413414    def GenStrainDataSizer():
     415        muMean = G2spc.MuShklMean(SGData,Amat,UseList[G2frame.hist]['Mustrain'][4])
    414416        Snames = G2spc.MustrainNames(SGData)
    415417        numb = len(Snames)
     
    432434            strainVal.Bind(wx.EVT_KILL_FOCUS,OnStrainVal)
    433435            dataSizer.Add(strainVal,0,WACV)
     436        dataSizer.Add(wx.StaticText(DData,label=' Mean mustrain %.1f'%muMean),0,WACV)
    434437        return dataSizer
    435438
     
    995998    G2frame.dataWindow.HistsInPhase = [name for name in keyList if name in UseList]
    996999    generalData = data['General']
     1000    cell = generalData['Cell'][1:]
     1001    Amat,Bmat = G2lat.cell2AB(cell[:6])
    9971002    PhaseName = generalData['Name']       
    9981003    SGData = generalData['SGData']
  • trunk/GSASIIspc.py

    r3239 r3242  
    26932693        Strm.append(4.0*k*h*l**2)
    26942694    return Strm
     2695
     2696def MuShklMean(SGData,Amat,Shkl):
     2697   
     2698    def genMustrain(xyz,Shkl):
     2699        uvw = np.inner(Amat.T,xyz)
     2700        Strm = np.array(MustrainCoeff(uvw,SGData))
     2701        Sum = np.sum(np.multiply(Shkl,Strm))
     2702        Sum = np.where(Sum > 0.01,Sum,0.01)
     2703        Sum = np.sqrt(Sum)
     2704        return Sum*xyz
     2705       
     2706    PHI = np.linspace(0.,360.,30,True)
     2707    PSI = np.linspace(0.,180.,30,True)
     2708    X = np.outer(npcosd(PHI),npsind(PSI))
     2709    Y = np.outer(npsind(PHI),npsind(PSI))
     2710    Z = np.outer(np.ones(np.size(PHI)),npcosd(PSI))
     2711    XYZ = np.dstack((X,Y,Z))
     2712    XYZ = np.nan_to_num(np.apply_along_axis(genMustrain,2,XYZ,Shkl))
     2713    return np.sqrt(np.sum(XYZ**2)/900.)
     2714   
    26952715   
    26962716def Muiso2Shkl(muiso,SGData,cell):
Note: See TracChangeset for help on using the changeset viewer.