Changeset 432


Ignore:
Timestamp:
Dec 5, 2011 4:00:00 PM (12 years ago)
Author:
vondreele
Message:

remove test prints from GSASIIIO
new Gmat2AB routine
work on the DData GUI bug - doesn't crash but bad GUI shown
work on ellipsoidal crystallites - all now work.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r430 r432  
    439439    File = open(filename,'Ur')
    440440    cons = Bank.split()
    441     print cons
    442441    Nch = int(cons[2])
    443442    if DataType[2] == 'C':
     
    468467                y.append(yi)
    469468                w.append(1.0/vi)
    470             print '%8.3f %8.0f %d %8g'%(xi,yi,ni,1./vi)
    471469        S = File.readline()
    472470    File.close()
    473471    N = len(x)
    474     print N
    475472    return [np.array(x),np.array(y),np.array(w),np.zeros(N),np.zeros(N),np.zeros(N)]
    476473   
  • trunk/GSASIIlattice.py

    r395 r432  
    190190    G,g = A2Gmat(A)
    191191    return Gmat2cell(G)
     192   
     193def Gmat2AB(G):
     194    """Computes orthogonalization matrix from reciprocal metric tensor G
     195    returns tuple of two 3x3 numpy arrays (A,B)
     196       A for crystal to Cartesian transformations A*x = np.inner(A,x) = X
     197       B (= inverse of A) for Cartesian to crystal transformation B*X = np.inner(B,X) = x
     198    """
     199    cellstar = Gmat2cell(G)
     200    g = nl.inv(G)
     201    cell = Gmat2cell(g)
     202    A = np.zeros(shape=(3,3))
     203    # from Giacovazzo (Fundamentals 2nd Ed.) p.75
     204    A[0][0] = cell[0]                # a
     205    A[0][1] = cell[1]*cosd(cell[5])  # b cos(gamma)
     206    A[0][2] = cell[2]*cosd(cell[4])  # c cos(beta)
     207    A[1][1] = cell[1]*sind(cell[5])  # b sin(gamma)
     208    A[1][2] = -cell[2]*cosd(cellstar[3])*sind(cell[4]) # - c cos(alpha*) sin(beta)
     209    A[2][2] = 1/cellstar[2]         # 1/c*
     210    B = nl.inv(A)
     211    return A,B
     212   
    192213
    193214def cell2AB(cell):
     
    196217    returns tuple of two 3x3 numpy arrays (A,B)
    197218       A for crystal to Cartesian transformations A*x = np.inner(A,x) = X
    198        B (= inverse of A) for Cartesian to crystal transformation B*X = np.inner(B*x) = x
     219       B (= inverse of A) for Cartesian to crystal transformation B*X = np.inner(B,X) = x
    199220    """
    200221    G,g = cell2Gmat(cell)
  • trunk/GSASIIphsGUI.py

    r430 r432  
    20302030        pfType.Bind(wx.EVT_COMBOBOX,OnPfType)
    20312031        PTSizer.Add(pfType,0,wx.ALIGN_CENTER_VERTICAL)
    2032         PTSizer.Add(wx.StaticText(dataDisplay,-1,' Projection type: '),0,wx.ALIGN_CENTER_VERTICAL)
    2033         projSel = wx.ComboBox(dataDisplay,-1,value=self.Projection,choices=['equal area','stereographic'],
    2034             style=wx.CB_READONLY|wx.CB_DROPDOWN)
    2035         projSel.Bind(wx.EVT_COMBOBOX,OnProjSel)
    2036         PTSizer.Add(projSel,0,wx.ALIGN_CENTER_VERTICAL)
     2032        if 'Axial' not in textureData['PlotType']:
     2033            PTSizer.Add(wx.StaticText(dataDisplay,-1,' Projection type: '),0,wx.ALIGN_CENTER_VERTICAL)
     2034            projSel = wx.ComboBox(dataDisplay,-1,value=self.Projection,choices=['equal area','stereographic','3D display'],
     2035                style=wx.CB_READONLY|wx.CB_DROPDOWN)
     2036            projSel.Bind(wx.EVT_COMBOBOX,OnProjSel)
     2037            PTSizer.Add(projSel,0,wx.ALIGN_CENTER_VERTICAL)
    20372038        if textureData['PlotType'] in ['Pole figure','Axial pole distribution']:
    20382039            PTSizer.Add(wx.StaticText(dataDisplay,-1,' Pole figure HKL: '),0,wx.ALIGN_CENTER_VERTICAL)
     
    20462047        pfVal.Bind(wx.EVT_KILL_FOCUS,OnPFValue)
    20472048        PTSizer.Add(pfVal,0,wx.ALIGN_CENTER_VERTICAL)
    2048         PTSizer.Add(wx.StaticText(dataDisplay,-1,' Color scheme'),0,wx.ALIGN_CENTER_VERTICAL)
    2049         choice = [m for m in mpl.cm.datad.keys() if not m.endswith("_r")]
    2050         choice.sort()
    2051         colorSel = wx.ComboBox(dataDisplay,-1,value=self.ContourColor,choices=choice,
    2052             style=wx.CB_READONLY|wx.CB_DROPDOWN)
    2053         colorSel.Bind(wx.EVT_COMBOBOX,OnColorSel)
    2054         PTSizer.Add(colorSel,0,wx.ALIGN_CENTER_VERTICAL)       
     2049        if 'Axial' not in textureData['PlotType']:
     2050            PTSizer.Add(wx.StaticText(dataDisplay,-1,' Color scheme'),0,wx.ALIGN_CENTER_VERTICAL)
     2051            choice = [m for m in mpl.cm.datad.keys() if not m.endswith("_r")]
     2052            choice.sort()
     2053            colorSel = wx.ComboBox(dataDisplay,-1,value=self.ContourColor,choices=choice,
     2054                style=wx.CB_READONLY|wx.CB_DROPDOWN)
     2055            colorSel.Bind(wx.EVT_COMBOBOX,OnColorSel)
     2056            PTSizer.Add(colorSel,0,wx.ALIGN_CENTER_VERTICAL)       
    20552057        mainSizer.Add(PTSizer,0,wx.ALIGN_CENTER_VERTICAL)
    20562058        mainSizer.Add((0,5),0)
     
    21872189            hist = Indx[Obj.GetId()]
    21882190            UseList[hist]['Size'][0] = Obj.GetValue()
     2191            G2plt.PlotSizeStrainPO(self,data)
    21892192            UpdateDData()
    21902193           
     
    21982201           
    21992202        def OnSizeVal(event):
     2203            print 'new val event'
    22002204            Obj = event.GetEventObject()
    22012205            hist,pid = Indx[Obj.GetId()]
     
    22042208                    size = float(Obj.GetValue())
    22052209                    if pid < 3 and size <= 0.01:            #10A lower limit!
    2206                         raise ValueError                   
     2210                        raise ValueError
     2211                    UseList[hist]['Size'][4][pid] = size                   
    22072212                except ValueError:
    22082213                    pass
     2214                Obj.SetValue("%.3f"%(UseList[hist]['Size'][4][pid]))          #reset in case of error
    22092215            else:
    22102216                try:
     
    22152221                except ValueError:
    22162222                    pass
    2217             Obj.SetValue("%.3f"%(UseList[hist]['Size'][1][pid]))          #reset in case of error
     2223                Obj.SetValue("%.3f"%(UseList[hist]['Size'][1][pid]))          #reset in case of error
     2224            G2plt.PlotSizeStrainPO(self,data)
    22182225           
    22192226        def OnSizeAxis(event):           
     
    22352242            hist = Indx[Obj.GetId()]
    22362243            UseList[hist]['Mustrain'][0] = Obj.GetValue()
     2244            G2plt.PlotSizeStrainPO(self,data)
    22372245            UpdateDData()
    2238             G2plt.PlotSizeStrainPO(self,data)
    22392246           
    22402247        def OnStrainRef(event):
     
    26012608            return extSizer
    26022609                                   
    2603         DData.DestroyChildren()
    2604         dataDisplay = wx.Panel(DData)
    2605         mainSizer = wx.BoxSizer(wx.VERTICAL)
     2610        if DData.GetChildren():
     2611            dataDisplay = DData.GetChildren()[0]
     2612            mainSizer = dataDisplay.GetSizer()
     2613            mainSizer.Clear()
     2614        else:
     2615            dataDisplay = wx.Panel(DData)
     2616            mainSizer = wx.BoxSizer(wx.VERTICAL)
    26062617        mainSizer.Add(wx.StaticText(dataDisplay,-1,'Histogram data for '+PhaseName+':'),0,wx.ALIGN_CENTER_VERTICAL)
    26072618        mainSizer.Add(PlotSizer())           
     
    26292640               
    26302641            if item[:4] == 'PWDR' and UseList[item]['Show']:
    2631                 sizeSizer = wx.BoxSizer(wx.VERTICAL)
    26322642                if UseList[item]['Size'][0] == 'isotropic':
    26332643                    isoSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    26362646                    isoSizer.Add(IsoSizer(u' Cryst. size(\xb5m): ','Size','%.3f',
    26372647                        OnSizeVal,OnSizeRef),0,wx.ALIGN_CENTER_VERTICAL)
    2638                     sizeSizer.Add(isoSizer)
     2648                    mainSizer.Add(isoSizer)
    26392649                elif UseList[item]['Size'][0] == 'uniaxial':
    26402650                    uniSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    26422652                        'Size',OnSizeType),0,wx.ALIGN_CENTER_VERTICAL)
    26432653                    uniSizer.Add(UniSizer('Size',OnSizeAxis),0,wx.ALIGN_CENTER_VERTICAL)
    2644                     sizeSizer.Add(uniSizer)
    2645                     sizeSizer.Add(UniDataSizer(u'size(\xb5m): ','Size','%.3f',OnSizeVal,OnSizeRef))
     2654                    mainSizer.Add(uniSizer)
     2655                    mainSizer.Add(UniDataSizer(u'size(\xb5m): ','Size','%.3f',OnSizeVal,OnSizeRef))
    26462656                elif UseList[item]['Size'][0] == 'ellipsoidal':
    26472657                    ellSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    26492659                        'Size',OnSizeType),0,wx.ALIGN_CENTER_VERTICAL)
    26502660                    ellSizer.Add(wx.StaticText(dataDisplay,-1,u' Coefficients(\xb5m): '),0,wx.ALIGN_CENTER_VERTICAL)
    2651                     sizeSizer.Add(ellSizer)
    2652                     sizeSizer.Add(EllSizeDataSizer())
    2653                 mainSizer.Add(sizeSizer)
     2661                    mainSizer.Add(ellSizer)
     2662                    mainSizer.Add(EllSizeDataSizer())
    26542663                mainSizer.Add((0,5),0)                   
    26552664               
    2656                 strainSizer = wx.BoxSizer(wx.VERTICAL)
    26572665                if UseList[item]['Mustrain'][0] == 'isotropic':
    26582666                    isoSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    26612669                    isoSizer.Add(IsoSizer(' microstrain: ','Mustrain','%.1f',
    26622670                        OnStrainVal,OnStrainRef),0,wx.ALIGN_CENTER_VERTICAL)                   
    2663                     strainSizer.Add(isoSizer)
     2671                    mainSizer.Add(isoSizer)
     2672                    mainSizer.Add((0,5),0)
    26642673                elif UseList[item]['Mustrain'][0] == 'uniaxial':
    26652674                    uniSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    26672676                        'Mustrain',OnStrainType),0,wx.ALIGN_CENTER_VERTICAL)
    26682677                    uniSizer.Add(UniSizer('Mustrain',OnStrainAxis),0,wx.ALIGN_CENTER_VERTICAL)
    2669                     sizeSizer.Add(uniSizer)
    2670                     sizeSizer.Add(UniDataSizer('mustrain: ','Mustrain','%.1f',OnStrainVal,OnStrainRef))
     2678                    mainSizer.Add(uniSizer)
     2679                    mainSizer.Add(UniDataSizer('mustrain: ','Mustrain','%.1f',OnStrainVal,OnStrainRef))
    26712680                elif UseList[item]['Mustrain'][0] == 'generalized':
    26722681                    genSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    26742683                        'Mustrain',OnStrainType),0,wx.ALIGN_CENTER_VERTICAL)
    26752684                    genSizer.Add(wx.StaticText(dataDisplay,-1,' Coefficients: '),0,wx.ALIGN_CENTER_VERTICAL)
    2676                     strainSizer.Add(genSizer)
    2677                     strainSizer.Add(GenStrainDataSizer())                       
    2678                 mainSizer.Add(strainSizer)
     2685                    mainSizer.Add(genSizer)
     2686                    mainSizer.Add(GenStrainDataSizer())                       
    26792687                mainSizer.Add((0,5),0)
    26802688               
     
    27612769                        UseList[histoName] = {'Histogram':histoName,'Show':False,
    27622770                            'Scale':[1.0,False],'Pref.Ori.':['MD',1.0,False,[0,0,1],0,{}],
    2763                             'Size':['isotropic',[4.,4.,],[False,False],[0,0,1],6*[0.0,],6*[False,]],
     2771                            'Size':['isotropic',[4.,4.,],[False,False],[0,0,1],[4.,4.,4.,0.,0.,0.],6*[False,]],
    27642772                            'Mustrain':['isotropic',[1000.0,1000.0],[False,False],[0,0,1],
    27652773                                NShkl*[0.01,],NShkl*[False,]],
  • trunk/GSASIIplot.py

    r431 r432  
    12201220                    axes /= nl.norm(axes)
    12211221                    Shkl = np.array(coeff[1])
    1222                     Shape = X.shape[0]
    12231222                    XYZ = np.dstack((X,Y,Z))
    12241223                    XYZ = np.nan_to_num(np.apply_along_axis(uniaxCalc,2,XYZ,iso,aniso,axes))
     
    12281227                    Z = Z[:,:,0]
    12291228               
     1229                elif coeff[0] == 'ellipsoidal':
     1230                   
     1231                    def ellipseCalc(xyz,E,R):
     1232                        XYZ = xyz*E.T
     1233                        return np.inner(XYZ.T,R)
     1234                       
     1235                    S6 = coeff[4]
     1236                    Sij = G2lat.U6toUij(S6)
     1237                    E,R = nl.eigh(Sij)
     1238                    XYZ = np.dstack((X,Y,Z))
     1239                    XYZ = np.nan_to_num(np.apply_along_axis(ellipseCalc,2,XYZ,E,R))
     1240                    X,Y,Z = np.dsplit(XYZ,3)
     1241                    X = X[:,:,0]
     1242                    Y = Y[:,:,0]
     1243                    Z = Z[:,:,0]
     1244                   
    12301245                elif coeff[0] == 'generalized':
    12311246                   
     
    12401255                    Shkl = np.array(coeff[4])
    12411256                    if np.any(Shkl):
    1242                         Shape = X.shape[0]
    12431257                        XYZ = np.dstack((X,Y,Z))
    12441258                        XYZ = np.nan_to_num(np.apply_along_axis(genMustrain,2,XYZ,SGData,A,Shkl))
     
    12481262                        Z = Z[:,:,0]
    12491263                           
    1250                 elif coeff[0] == 'ellipsoidal':
    1251                     print 'ellipsoid plot'
    1252                    
    12531264                if np.any(X) and np.any(Y) and np.any(Z):
     1265                    errFlags = np.seterr(all='ignore')
    12541266                    Plot.plot_surface(X,Y,Z,rstride=1,cstride=1,color='g',linewidth=1)
     1267                    np.seterr(all='ignore')
     1268                    xyzlim = np.array([Plot.get_xlim3d(),Plot.get_ylim3d(),Plot.get_zlim3d()]).T
     1269                    XYZlim = [min(xyzlim[0]),max(xyzlim[1])]
     1270                    Plot.set_xlim3d(XYZlim)
     1271                    Plot.set_ylim3d(XYZlim)
     1272                    Plot.set_zlim3d(XYZlim)
     1273                    Plot.set_aspect('equal')
    12551274                if plotType == 'Size':
    12561275                    Plot.set_title('Crystallite size for '+phase+'\n'+coeff[0]+' model')
     
    12581277                    Plot.set_ylabel(r'Y, $\mu$m')
    12591278                    Plot.set_zlabel(r'Z, $\mu$m')
    1260                     Plot.set_aspect('equal')
    12611279                else:   
    12621280                    Plot.set_title(r'$\mu$strain for '+phase+'\n'+coeff[0]+' model')
     
    12641282                    Plot.set_ylabel(r'Y, $\mu$strain')
    12651283                    Plot.set_zlabel(r'Z, $\mu$strain')
    1266                     Plot.set_aspect('equal')
    12671284            else:
    12681285                h,k,l = generalData['POhkl']
     
    12881305   
    12891306def PlotTexture(self,data,newPlot=False,Start=False):
    1290     '''Pole figure, inverse pole figure(?), 3D pole distribution and 3D inverse pole distribution(?)
    1291     plotting; Need way to select 
    1292     pole figure or pole distribution to be displayed - do in key enter menu
     1307    '''Pole figure, inverse pole figure, 3D pole distribution and 3D inverse pole distribution
     1308    plotting.
    12931309    dict generalData contains all phase info needed which is in data
    12941310    '''
     
    13461362                    pf = G2lat.polfcal(ODFln,SamSym[textureData['Model']],np.array([r,]),np.array([p,]))
    13471363                    self.G2plotNB.status.SetFields(['','phi =%9.3f, gam =%9.3f, MRD =%9.3f'%(r,p,pf)])
    1348                    
    1349     Plot = self.G2plotNB.addMpl('Texture').gca()
     1364   
     1365    if self.Projection == '3D display' and 'Axial'  not in SHData['PlotType']:               
     1366        Plot = mp3d.Axes3D(self.G2plotNB.add3D('Texture'))
     1367    else:
     1368        Plot = self.G2plotNB.addMpl('Texture').gca()
    13501369    plotNum = self.G2plotNB.plotList.index('Texture')
    13511370    Page = self.G2plotNB.nb.GetPage(plotNum)
    1352     Page.canvas.mpl_connect('motion_notify_event', OnMotion)
     1371    if self.Projection == '3D display':
     1372        pass
     1373    else:
     1374        Page.canvas.mpl_connect('motion_notify_event', OnMotion)
    13531375
    13541376    Page.SetFocus()
  • trunk/GSASIIpwd.py

    r429 r432  
    708708    sumDf = np.sum(Df)
    709709    return Df,dFdp,dFds,dFdg,dFdsh
    710    
     710
     711def ellipseSize(H,Sij,GB):
     712    HX = np.inner(H.T,GB)
     713    lenHX = np.sqrt(np.sum(HX**2))
     714    Esize,Rsize = nl.eigh(G2lat.U6toUij(Sij))           
     715    R = np.inner(HX/lenHX,Rsize)*Esize         #want column length for hkl in crystal
     716    lenR = np.sqrt(np.sum(R**2))
     717    return lenR
     718
     719def ellipseSizeDerv(H,Sij,GB):
     720    lenR = ellipseSize(H,Sij,GB)
     721    delt = 0.001
     722    dRdS = np.zeros(6)
     723    for i in range(6):
     724        dSij = Sij[:]
     725        dSij[i] += delt
     726        dRdS[i] = (ellipseSize(H,dSij,GB)-lenR)/delt
     727    return lenR,dRdS
    711728
    712729def getPeakProfile(parmDict,xdata,varyList,bakType):
  • trunk/GSASIIstruct.py

    r429 r432  
    18951895    return dIdsh,dIdsp,dIdPola,dIdPO,dFdODF,dFdSA
    18961896       
    1897 def GetSampleGam(refl,wave,G,phfx,calcControls,parmDict,sizeEllipse):
     1897def GetSampleGam(refl,wave,G,GB,phfx,calcControls,parmDict):
    18981898    costh = cosd(refl[5]/2.)
    18991899    #crystallite size
     
    19061906        gam = (1.8*wave/np.pi)/(parmDict[phfx+'Size:0']*parmDict[phfx+'Size:1']*costh)
    19071907        gam *= np.sqrt((cosP*parmDict[phfx+'Size:1'])**2+(sinP*parmDict[phfx+'Size:0'])**2)
    1908     else:           #ellipsoidal crystallites - wrong not make sense
     1908    else:           #ellipsoidal crystallites
     1909        Sij =[parmDict[phfx+'Size:%d'%(i)] for i in range(6)]
    19091910        H = np.array(refl[:3])
    1910         gam += 1.8*wave/(np.pi*costh*np.inner(H,np.inner(sizeEllipse,H)))
     1911        lenR = G2pwd.ellipseSize(H,Sij,GB)
     1912        gam = 1.8*wave/(np.pi*costh*lenR)
    19111913    #microstrain               
    19121914    if calcControls[phfx+'MustrainType'] == 'isotropic':
     
    19271929    return gam
    19281930       
    1929 def GetSampleGamDerv(refl,wave,G,phfx,calcControls,parmDict,sizeEllipse):
     1931def GetSampleGamDerv(refl,wave,G,GB,phfx,calcControls,parmDict):
    19301932    gamDict = {}
    19311933    costh = cosd(refl[5]/2.)
     
    19401942        Si = parmDict[phfx+'Size:0']
    19411943        Sa = parmDict[phfx+'Size:1']
    1942         gami = (1.80*wave/np.pi)/(Si*Sa)
     1944        gami = (1.8*wave/np.pi)/(Si*Sa)
    19431945        sqtrm = np.sqrt((cosP*Sa)**2+(sinP*Si)**2)
    19441946        gam = gami*sqtrm/costh           
    19451947        gamDict[phfx+'Size:0'] = gami*Si*sinP**2/(sqtrm*costh)-gam/Si
    19461948        gamDict[phfx+'Size:1'] = gami*Sa*cosP**2/(sqtrm*costh)-gam/Sa         
    1947     else:           #ellipsoidal crystallites - do numerically? - not right not make sense
     1949    else:           #ellipsoidal crystallites
     1950        const = 1.8*wave/(np.pi*costh)
     1951        Sij =[parmDict[phfx+'Size:%d'%(i)] for i in range(6)]
    19481952        H = np.array(refl[:3])
    1949         gam = 1.8*wave/(np.pi*costh*np.inner(H,np.inner(sizeEllipse,H)))
     1953        R,dRdS = G2pwd.ellipseSizeDerv(H,Sij,GB)
     1954        for i,item in enumerate([phfx+'Size:%d'%(j) for j in range(6)]):
     1955            gamDict[item] = -(const/R**2)*dRdS[i]
    19501956    #microstrain derivatives               
    19511957    if calcControls[phfx+'MustrainType'] == 'isotropic':
     
    20822088def getPowderProfile(parmDict,x,varylist,Histogram,Phases,calcControls,pawleyLookup):
    20832089   
    2084     def GetReflSIgGam(refl,wave,G,hfx,phfx,calcControls,parmDict,sizeEllipse):
     2090    def GetReflSIgGam(refl,wave,G,GB,hfx,phfx,calcControls,parmDict):
    20852091        U = parmDict[hfx+'U']
    20862092        V = parmDict[hfx+'V']
     
    20912097        sig = U*tanPos**2+V*tanPos+W        #save peak sigma
    20922098        sig = max(0.001,sig)
    2093         gam = X/cosd(refl[5]/2.0)+Y*tanPos+GetSampleGam(refl,wave,G,phfx,calcControls,parmDict,sizeEllipse) #save peak gamma
     2099        gam = X/cosd(refl[5]/2.0)+Y*tanPos+GetSampleGam(refl,wave,G,GB,phfx,calcControls,parmDict) #save peak gamma
    20942100        gam = max(0.001,gam)
    20952101        return sig,gam
     
    21242130        A = [parmDict[pfx+'A%d'%(i)] for i in range(6)]
    21252131        G,g = G2lat.A2Gmat(A)       #recip & real metric tensors
     2132        GA,GB = G2lat.Gmat2AB(G)    #Orthogonalization matricies
    21262133        Vst = np.sqrt(nl.det(G))    #V*
    21272134        if 'Pawley' not in Phase['General']['Type']:
    21282135            refList = StructureFactor(refList,G,hfx,pfx,SGData,calcControls,parmDict)
    2129         sizeEllipse = []
    2130         if calcControls[phfx+'SizeType'] == 'ellipsoidal':
    2131             sizeEllipse = G2lat.U6toUij([parmDIct[phfx+'Size:%d'%(i)] for i in range(6)])
    21322136        for refl in refList:
    21332137            if 'C' in calcControls[hfx+'histType']:
     
    21362140                Lorenz = 1./(2.*sind(refl[5]/2.)**2*cosd(refl[5]/2.))           #Lorentz correction
    21372141                refl[5] += GetHStrainShift(refl,SGData,phfx,parmDict)               #apply hydrostatic strain shift
    2138                 refl[6:8] = GetReflSIgGam(refl,wave,G,hfx,phfx,calcControls,parmDict,sizeEllipse)    #peak sig & gam
     2142                refl[6:8] = GetReflSIgGam(refl,wave,G,GB,hfx,phfx,calcControls,parmDict)    #peak sig & gam
    21392143                GetIntensityCorr(refl,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict)    #puts corrections in refl[13]
    21402144                refl[13] *= Vst*Lorenz
     
    22912295        A = [parmDict[pfx+'A%d'%(i)] for i in range(6)]
    22922296        G,g = G2lat.A2Gmat(A)       #recip & real metric tensors
     2297        GA,GB = G2lat.Gmat2AB(G)    #Orthogonalization matricies
    22932298        if 'Pawley' not in Phase['General']['Type']:
    22942299            dFdvDict = StructureFactorDerv(refList,G,hfx,pfx,SGData,calcControls,parmDict)
    2295         sizeEllipse = []
    2296         if calcControls[phfx+'SizeType'] == 'ellipsoidal':
    2297             sizeEllipse = G2lat.U6toUij([parmDIct[phfx+'Size:%d'%(i)] for i in range(6)])
    22982300        for iref,refl in enumerate(refList):
    22992301            if 'C' in calcControls[hfx+'histType']:        #CW powder
     
    23842386                    elif name in dependentVars:
    23852387                        depDerivDict[name] += dDijDict[name]*dervDict['pos']
    2386                 gamDict = GetSampleGamDerv(refl,wave,G,phfx,calcControls,parmDict,sizeEllipse)
     2388                gamDict = GetSampleGamDerv(refl,wave,G,GB,phfx,calcControls,parmDict)
    23872389                for name in gamDict:
    23882390                    if name in varylist:
     
    25952597    SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,covData)
    25962598#for testing purposes!!!
    2597 #    file = open('structTestdata.dat','wb')
    2598 #    cPickle.dump(parmDict,file,1)
    2599 #    cPickle.dump(varyList,file,1)
    2600 #    for histogram in Histograms:
    2601 #        if 'PWDR' in histogram[:4]:
    2602 #            Histogram = Histograms[histogram]
    2603 #    cPickle.dump(Histogram,file,1)
    2604 #    cPickle.dump(Phases,file,1)
    2605 #    cPickle.dump(calcControls,file,1)
    2606 #    cPickle.dump(pawleyLookup,file,1)
    2607 #    file.close()
     2599    file = open('structTestdata.dat','wb')
     2600    cPickle.dump(parmDict,file,1)
     2601    cPickle.dump(varyList,file,1)
     2602    for histogram in Histograms:
     2603        if 'PWDR' in histogram[:4]:
     2604            Histogram = Histograms[histogram]
     2605    cPickle.dump(Histogram,file,1)
     2606    cPickle.dump(Phases,file,1)
     2607    cPickle.dump(calcControls,file,1)
     2608    cPickle.dump(pawleyLookup,file,1)
     2609    file.close()
    26082610
    26092611def SeqRefine(GPXfile,dlg):
Note: See TracChangeset for help on using the changeset viewer.