Changeset 72


Ignore:
Timestamp:
Jun 1, 2010 2:35:42 PM (12 years ago)
Author:
vondreel
Message:

add "Integrate all" option for integrating a set of images

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIcomp.py

    r70 r72  
    473473def GenHBravais(dmin,Bravais,A):
    474474    '''Generate the positionally unique powder diffraction reflections
    475     for a lattice and Bravais type'''
    476 # dmin - minimum d-spacing
    477 # Bravais in range(14) to indicate Bravais lattice; 0-2 cubic, 3,4 - hexagonal/trigonal,
    478 # 5,6 - tetragonal, 7-10 - orthorhombic, 11,12 - monoclinic, 13 - triclinic
    479 # A - as defined in calc_rDsq
    480 # returns HKL = [h,k,l,d,0] sorted so d largest first
     475    for a lattice and Bravais type
     476    dmin - minimum d-spacing
     477    Bravais in range(14) to indicate Bravais lattice; 0-2 cubic, 3,4 - hexagonal/trigonal,
     478    5,6 - tetragonal, 7-10 - orthorhombic, 11,12 - monoclinic, 13 - triclinic
     479    A - as defined in calc_rDsq
     480    returns HKL = [h,k,l,d,0] sorted so d largest first'''
    481481    import math
    482482    if Bravais in [9,11]:
     
    597597    '''Generate the crystallographically unique powder diffraction reflections
    598598    for a lattice and Bravais type
     599    dmin - minimum d-spacing
     600    Laue - Laue group symbol = '-1','2/m','mmmm','4/m','6/m','4/mmm','6/mmm',
     601                             '3m1', '31m', '3', '3R', '3mR', 'm3', 'm3m'
     602    Cent - lattice centering = 'P','A','B','C','I','F'
     603    Axis - code for unique monoclinic axis = 'a','b','c'
     604    A - 6 terms as defined in calc_rDsq
     605    returns - HKL = list of [h,k,l,d] sorted with largest d first and is unique
     606    part of reciprocal space ignoring anomalous dispersion
    599607    '''
    600 # dmin - minimum d-spacing
    601 # Laue - Laue group symbol = '-1','2/m','mmmm','4/m','6/m','4/mmm','6/mmm',
    602 #                            '3m1', '31m', '3', '3R', '3mR', 'm3', 'm3m'
    603 # Cent - lattice centering = 'P','A','B','C','I','F'
    604 # Axis - code for unique monoclinic axis = 'a','b','c'
    605 # A - 6 terms as defined in calc_rDsq
    606 # returns - HKL = list of [h,k,l,d] sorted with largest d first and is unique
    607 # part of reciprocal space ignoring anomalous dispersion
    608608    import math
    609609    Hmax = MaxIndex(dmin,A)
  • trunk/GSASIIgrid.py

    r65 r72  
    13231323    def OnIntegrateAll(event):
    13241324        print 'integrate all'
     1325        TextList = []
     1326        Names = []
     1327        if self.PatternTree.GetCount():
     1328            id, cookie = self.PatternTree.GetFirstChild(self.root)
     1329            while id:
     1330                name = self.PatternTree.GetItemText(id)
     1331                Names.append(name)
     1332                if 'IMG' in name:
     1333                    TextList.append([False,name,id])
     1334                id, cookie = self.PatternTree.GetNextChild(self.root, cookie)
     1335            if not len(TextList):
     1336                self.ErrorDialog('Nothing to integrate','There must some "IMG" patterns')
     1337                return
     1338            dlg = self.CopyDialog(self,'Image integration controls','Select images to integrate:',TextList)
     1339            try:
     1340                if dlg.ShowModal() == wx.ID_OK:
     1341                    result = dlg.GetData()
     1342                    for item in result:
     1343                        ifintegrate,name,id = item
     1344                        if ifintegrate:
     1345                            id = GetPatternTreeItemId(self, self.root, name)
     1346                            size,imagefile = self.PatternTree.GetItemPyData(id)
     1347                            self.ImageZ = G2IO.GetImageData(imagefile,imageOnly=True)
     1348                            Id = GetPatternTreeItemId(self,id, 'Image Controls')
     1349                            Data = self.PatternTree.GetItemPyData(Id)
     1350                            G2cmp.ImageIntegrate(self,Data)
     1351                            G2plt.PlotIntegration(self,newPlot=True)
     1352                            self.dataFrame.ImageEdit.Enable(id=wxID_SAVEINTG,enable=True)
     1353                            G2IO.SaveIntegration(self,Id,Data)
     1354            finally:
     1355                dlg.Destroy()
    13251356       
    13261357    def OnSaveIntegrate(event):
  • trunk/GSASIIplot.py

    r68 r72  
    510510    Z = []
    511511    W = []
     512    V = []
    512513    sig = lambda Th,U,V,W: 1.17741*math.sqrt(U*tand(Th)**2+V*tand(Th)+W)*math.pi/18000.
    513514    gam = lambda Th,X,Y: (X/cosd(Th)+Y*tand(Th))*math.pi/18000.
    514     gamFW = lambda s,g: math.exp(math.log(g**5+2.69269*g**4*s+2.42843*g**3*s**2+4.47163*g**2*s**3+0.07842*g*s**4+s**5)/5.)
     515    gamFW = lambda s,g: math.exp(math.log(s**5+2.69269*s**4*g+2.42843*s**3*g**2+4.47163*s**2*g**3+0.07842*s*g**4+g**5)/5.)
     516    gamFW2 = lambda s,g: math.sqrt(s**2+(0.4654996*g)**2)+.5345004*g  #Ubaldo Bafile - private communication
    515517    for theta in thetas:
    516518        X.append(4.0*math.pi*sind(theta)/lam)              #q
     
    518520        g = gam(theta,LX,LY)
    519521        G = gamFW(g,s)
     522        H = gamFW2(g,s)
    520523        Y.append(s/tand(theta))
    521524        Z.append(g/tand(theta))
    522525        W.append(G/tand(theta))
     526        V.append(H/tand(theta))
    523527    Plot.set_title('Instrument and sample peak widths')
    524528    Plot.set_ylabel(r'$\Delta q/q, \Delta d/d$',fontsize=14)
     
    527531    Plot.plot(X,Z,color='g',label='Lorentzian')
    528532    Plot.plot(X,W,color='b',label='G+L')
     533    Plot.plot(X,V,color='k',label='G+L2')
    529534    X = []
    530535    Y = []
    531536    Z = []
    532537    W = []
     538    V = []
    533539    for peak in peaks:
    534540        X.append(4.0*math.pi*sind(peak[0]/2.0)/lam)
     
    536542        g = peak[6]*math.pi/18000.
    537543        G = gamFW(g,s)
     544        H = gamFW2(g,s)
    538545        Y.append(s/tand(peak[0]/2.))
    539546        Z.append(g/tand(peak[0]/2.))
    540547        W.append(G/tand(peak[0]/2.))
     548        V.append(H/tand(peak[0]/2.))
    541549    Plot.plot(X,Y,'+',color='r',label='G peak')
    542550    Plot.plot(X,Z,'+',color='g',label='L peak')
    543551    Plot.plot(X,W,'+',color='b',label='G+L peak')
     552    Plot.plot(X,V,'+',color='k',label='G+L2 peak')
    544553    Plot.legend(loc='best')
    545554    Page.canvas.draw()
Note: See TracChangeset for help on using the changeset viewer.