Changeset 264 for trunk


Ignore:
Timestamp:
Mar 31, 2011 4:41:13 PM (14 years ago)
Author:
vondreele
Message:

begin implementation of pdf generation - work in progress
modify image to have azimuth=0 as vertical "up"
add textctrls for max and min image intensity
fix to some lattice parameter defaults for some Laue groups

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/GSASII.py

    r260 r264  
    5454] = [wx.NewId() for _init_ctrls in range(1)]
    5555
    56 [wxID_FILECLOSE, wxID_FILEEXIT, wxID_FILEOPEN,
    57  wxID_FILESAVE, wxID_FILESAVEAS, wxID_REFINE, wxID_SOLVE,
    58 ] = [wx.NewId() for _init_coll_File_Items in range(7)]
     56[wxID_FILECLOSE, wxID_FILEEXIT, wxID_FILEOPEN,  wxID_FILESAVE, wxID_FILESAVEAS,
     57wxID_REFINE, wxID_SOLVE, wxID_MAKEPDFS,
     58] = [wx.NewId() for _init_coll_File_Items in range(8)]
    5959
    6060[wxID_PWDRREAD,wxID_SNGLREAD,wxID_ADDPHASE,wxID_DELETEPHASE,
     
    6868
    6969[wxID_EXPORT, wxID_EXPORTPATTERN, wxID_EXPORTHKL, wxID_EXPORTPHASE,
    70 wxID_EXPORTCIF, wxID_EXPORTPEAKLIST
    71 ] = [wx.NewId() for _init_coll_Export_Items in range(6)]
     70wxID_EXPORTCIF, wxID_EXPORTPEAKLIST, wxID_EXPORTPDF,
     71] = [wx.NewId() for _init_coll_Export_Items in range(7)]
    7272
    7373[wxID_HELPABOUT, wxID_HELPHELP,
     
    8787        parent.Append(help='Open a gsasii project file (*.gpx)', id=wxID_FILEOPEN,
    8888             kind=wx.ITEM_NORMAL,text='Open project...')
    89         parent.Append(help='SAve project to old file', id=wxID_FILESAVE,
     89        parent.Append(help='Save project to old file', id=wxID_FILESAVE,
    9090            kind=wx.ITEM_NORMAL,text='Save project')
    9191        parent.Append(help='Save project to new file', id=wxID_FILESAVEAS,
     
    134134               
    135135    def _init_coll_Calculate_Items(self,parent):
     136        self.MakePDF = parent.Append(help='Make new PDFs from selected powder patterns',
     137            id=wxID_MAKEPDFS, kind=wx.ITEM_NORMAL,text='Make new PDFs')
     138        self.Bind(wx.EVT_MENU, self.OnMakePDFs, id=wxID_MAKEPDFS)
    136139        self.Refine = parent.Append(help='', id=wxID_REFINE, kind=wx.ITEM_NORMAL,
    137140            text='Refine')
     
    167170        self.ExportHKL = parent.Append(help='',id=wxID_EXPORTHKL, kind=wx.ITEM_NORMAL,
    168171            text='Export HKLs...')
     172        self.ExportPDF = parent.Append(help='Select PDF item to enable',id=wxID_EXPORTPDF, kind=wx.ITEM_NORMAL,
     173            text='Export PDF...')
    169174        self.ExportPhase = parent.Append(help='',id=wxID_EXPORTPHASE, kind=wx.ITEM_NORMAL,
    170175            text='Export Phase...')
     
    174179        self.ExportPeakList.Enable(True)
    175180        self.ExportHKL.Enable(False)
     181        self.ExportPDF.Enable(False)
    176182        self.ExportPhase.Enable(False)
    177183        self.ExportCIF.Enable(False)
     
    179185        self.Bind(wx.EVT_MENU, self.OnExportPeakList, id=wxID_EXPORTPEAKLIST)
    180186        self.Bind(wx.EVT_MENU, self.OnExportHKL, id=wxID_EXPORTHKL)
     187        self.Bind(wx.EVT_MENU, self.OnExportPDF, id=wxID_EXPORTPDF)
    181188        self.Bind(wx.EVT_MENU, self.OnExportPhase, id=wxID_EXPORTPHASE)
    182189        self.Bind(wx.EVT_MENU, self.OnExportCIF, id=wxID_EXPORTCIF)
     
    717724                            if dlg2.ShowModal() == wx.ID_OK:
    718725                                Id = G2gd.GetPatternTreeItemId(self,self.root,name)
     726                                self.PatternTree.Delete(Id)
    719727                        finally:
    720728                            dlg2.Destroy()
    721                     else:
    722                         Id = self.PatternTree.AppendItem(parent=self.root,text=outname)
     729                    Id = self.PatternTree.AppendItem(parent=self.root,text=outname)
    723730                    if Id:
    724731                        Sample = {'Scale':[1.0,True],'Type':'Debye-Scherrer','Absorption':[0.0,False],'DisplaceX':[0.0,False],
     
    904911                dlg.Destroy()
    905912       
     913    def GetFileList(fileType,skip=None):        #potentially useful?
     914        fileList = []
     915        Source = ''
     916        id, cookie = self.PatternTree.GetFirstChild(self.root)
     917        while id:
     918            name = self.PatternTree.GetItemText(id)
     919            if fileType in name:
     920                if id == skip:
     921                    Source = name
     922                else:
     923                    fileList.append([False,name,id])
     924            id, cookie = self.PatternTree.GetNextChild(self.root, cookie)
     925        if skip:
     926            return fileList,Source
     927        else:
     928            return fileList
     929           
    906930    def OnDataDelete(self, event):
    907931        TextList = ['All Data']
     
    911935        ifIMG = False
    912936        ifHKLF = False
     937        ifPDF = False
    913938        if self.PatternTree.GetCount():
    914939            item, cookie = self.PatternTree.GetFirstChild(self.root)
    915940            while item:
    916941                name = self.PatternTree.GetItemText(item)
    917                 if 'PWDR' in name or 'HKLF' in name or 'IMG' in name:
     942                if 'PWDR' in name or 'HKLF' in name or 'IMG' or 'PDF' in name:
    918943                    if 'PWDR' in name: ifPWDR = True
    919944                    if 'IMG' in name: ifIMG = True
    920945                    if 'HKLF' in name: ifHKLF = True
     946                    if 'PDF' in name: ifPDF = True
    921947                    TextList.append(name)
    922948                item, cookie = self.PatternTree.GetNextChild(self.root, cookie)
    923949            if ifPWDR: TextList.insert(1,'All PWDR')
    924950            if ifIMG: TextList.insert(1,'All IMG')
    925             if ifHKLF: TextList.insert(1,'All HKLF')               
     951            if ifHKLF: TextList.insert(1,'All HKLF')
     952            if ifPDF: TextList.insert(1,'All PDF')               
    926953            dlg = wx.MultiChoiceDialog(self, 'Which data to delete?', 'Delete data', TextList, wx.CHOICEDLG_STYLE)
    927954            try:
     
    937964                    elif 'All HKLF' in DelList:
    938965                        DelList = [item for item in TextList if item[:4] == 'HKLF']
     966                    elif 'All PDF' in DelList:
     967                        DelList = [item for item in TextList if item[:3] == 'PDF']
    939968                    item, cookie = self.PatternTree.GetFirstChild(self.root)
    940969                    while item:
     
    9811010                    while item and not Id:
    9821011                        name = self.PatternTree.GetItemText(item)
    983                         if name[:4] in ['PWDR','HKLF','IMG']:
     1012                        if name[:4] in ['PWDR','HKLF','IMG','PDF']:
    9841013                            Id = item
    9851014                        elif name == 'Controls':
     
    12011230        event.Skip()
    12021231       
     1232    def OnExportPDF(self,event):
     1233        event.Skip()
     1234       
    12031235    def OnExportPhase(self,event):
    12041236        event.Skip()
     
    12061238    def OnExportCIF(self,event):
    12071239        event.Skip()
    1208        
     1240
     1241    def OnMakePDFs(self,event):
     1242        TextList = []
     1243        Names = []
     1244        if self.PatternTree.GetCount():
     1245            id, cookie = self.PatternTree.GetFirstChild(self.root)
     1246            while id:
     1247                name = self.PatternTree.GetItemText(id)
     1248                Names.append(name)
     1249                if 'PWDR' in name:
     1250                    TextList.append([False,name,id])
     1251                id, cookie = self.PatternTree.GetNextChild(self.root, cookie)
     1252            if not len(TextList):
     1253                self.ErrorDialog('Nothing to make PDFs for','There must be at least one "PWDR" pattern')
     1254                return
     1255            dlg = self.CopyDialog(self,'Make PDF controls','Make PDF controls for:',TextList)
     1256            try:
     1257                if dlg.ShowModal() == wx.ID_OK:
     1258                    result = dlg.GetData()
     1259                    for i,item in enumerate(result):
     1260                        ifmake,name,id = item
     1261                        if ifmake:
     1262                            PWDRname = name[4:]
     1263                            Id = self.PatternTree.AppendItem(parent=self.root,text='PDF '+PWDRname)
     1264                            Data = {
     1265                                'Sample':{'Name':name,'Mult':1.0,'Add':0.0},
     1266                                'Sample Bkg.':{'Name':'','Mult':-1.0,'Add':0.0},
     1267                                'Container':{'Name':'','Mult':-1.0,'Add':0.0},
     1268                                'Container Bkg.':{'Name':'','Mult':-1.0,'Add':0.0},'ElList':{},
     1269                                'Geometry':'Cylinder','Diam':1.0,'Pack':0.50,'Form Vol':10.0}
     1270                            self.PatternTree.SetItemPyData(self.PatternTree.AppendItem(Id,text='PDF Controls'),Data)
     1271                            self.PatternTree.SetItemPyData(self.PatternTree.AppendItem(Id,text='S(Q)'+PWDRname),[])       
     1272                            self.PatternTree.SetItemPyData(self.PatternTree.AppendItem(Id,text='G(R)'+PWDRname),[])       
     1273            finally:
     1274                dlg.Destroy()
     1275       
    12091276    def OnRefine(self,event):
    12101277        #works - but it'd be better if it could restore plots
  • TabularUnified trunk/GSASIIElem.py

    r230 r264  
    1414import sys
    1515import os.path
    16 import  wx.lib.colourselect as wscs
     16import wx.lib.colourselect as wscs
    1717import GSASIIpath
    1818import numpy as np
     
    224224    t = -fb*SQ
    225225    return np.sum(fa*np.exp(t))+FormFac['fc']
     226   
     227def ComptonFac(ComptonCoeff,SQ):
     228    """compute Compton scattering factor
     229    @param ComptonCoeff: list [Z, a1:a5, b1:b5]
     230    @param SQ: (sin-theta/lambda)**2
     231    @return: comp: compton scattering factor
     232    """   
     233    ca = np.array(ComptonCoeff[1:6])
     234    cb = np.array(ComptonCoeff[6:11])
     235    t = -cb*SQ
     236    return ComptonCoeff[0]-np.sum(ca*np.exp(t))
    226237           
    227238def FPcalc(Orbs, KEv):
     
    314325    "Makes periodic table widget for picking element - caller maintains element list"
    315326    Elem=None
    316     def _init_ctrls(self, prnt):
     327    def _init_ctrls(self, prnt,oneOnly):
    317328        wx.Dialog.__init__(self, id=-1, name='PickElement',
    318329              parent=prnt, pos=wx.DefaultPosition,
     
    323334        i=0
    324335        for E in ET.ElTable:
     336            if oneOnly:
     337                color=E[4]
     338            else:
     339                color=E[6]
    325340            PickElement.ElButton(self,name=E[0],
    326 #            pos=wx.Point(E[1]*40+25,E[2]*24+24),tip=E[3],color=E[4])
    327             pos=wx.Point(E[1]*40+25,E[2]*24+24),tip=E[3],color=E[6])
     341               pos=wx.Point(E[1]*40+25,E[2]*24+24),tip=E[3],color=color,oneOnly=oneOnly)
    328342            i+=1
    329343
    330     def __init__(self, parent):
    331         self._init_ctrls(parent)
    332        
    333     def ElButton(self, name, pos, tip, color):
     344    def __init__(self, parent,oneOnly=False):
     345        self._init_ctrls(parent,oneOnly)
     346       
     347    def ElButton(self, name, pos, tip, color, oneOnly):
    334348        Black = wx.Colour(0,0,0)
    335         El = wx.ComboBox(choices=name, parent=self, pos=pos, size=wx.Size(40,23),
    336             style=wx.CB_READONLY, value=name[0])
     349        if oneOnly:
     350            El = wscs.ColourSelect(label=name[0], parent=self,colour=color,
     351                pos=pos, size=wx.Size(40,23), style=wx.RAISED_BORDER)
     352#            El.SetLabel(name)
     353            El.Bind(wx.EVT_BUTTON, self.OnElButton)
     354        else:
     355            El = wx.ComboBox(choices=name, parent=self, pos=pos, size=wx.Size(40,23),
     356                style=wx.CB_READONLY, value=name[0])
     357            El.Bind(wx.EVT_COMBOBOX,self.OnElButton)
     358       
    337359        El.SetBackgroundColour(color)
    338360        El.SetToolTipString(tip)
    339         El.Bind(wx.EVT_COMBOBOX, self.OnElButton)
    340361
    341362    def OnElButton(self, event):
    342363        El = event.GetEventObject().GetLabel()
    343         self.Elem = (El)
     364        self.Elem = El
    344365        self.EndModal(wx.ID_OK)       
    345366       
  • TabularUnified trunk/GSASIIgrid.py

    r254 r264  
    5252] = [wx.NewId() for _init_coll_INDEX_Items in range(4)]
    5353
     54[ wxID_PDFCOPYCONTROLS, wxID_PDFSAVECONTROLS, wxID_PDFLOADCONTROLS,
     55    wxID_PDFCOMPUTE, wxID_PDFCOMPUTEALL, wxID_PDFADDELEMENT, wxID_PDFDELELEMENT,
     56] = [wx.NewId() for _init_coll_PDF_Items in range(7)]
     57
    5458VERY_LIGHT_GREY = wx.Colour(235,235,235)
    5559
     
    8892        parent.Append(menu=self.IndexEdit, title='Cell Index/Refine')
    8993       
     94    def _init_coll_PDFMenu(self,parent):
     95        parent.Append(menu=self.PDFEdit, title='PDF Controls')
     96
    9097    def _init_coll_Atom_Items(self,parent):
    9198        parent.Append(id=wxID_ATOMSEDITADD, kind=wx.ITEM_NORMAL,text='Append atom',
     
    190197        self.MakeNewPhase = parent.Append( id=wxID_MAKENEWPHASE, kind=wx.ITEM_NORMAL,
    191198            text='Make new phase',help='Make new phase from selected unit cell')
     199           
     200    def _init_coll_PDF_Items(self,parent):
     201        parent.Append(help='Copy PDF controls', id=wxID_PDFCOPYCONTROLS, kind=wx.ITEM_NORMAL,
     202            text='Copy controls')
     203        parent.Append(help='Save PDF controls to file', id=wxID_PDFSAVECONTROLS, kind=wx.ITEM_NORMAL,
     204            text='Save controls')
     205        parent.Append(help='Load PDF controls from file',id=wxID_PDFLOADCONTROLS, kind=wx.ITEM_NORMAL,
     206            text='Load Controls')
     207        parent.Append(help='Add element to sample composition',id=wxID_PDFADDELEMENT, kind=wx.ITEM_NORMAL,
     208            text='Add element')
     209        parent.Append(help='Delete element from sample composition',id=wxID_PDFDELELEMENT, kind=wx.ITEM_NORMAL,
     210            text='Delete element')
     211        self.PDFCompute = parent.Append(help='Compute PDF', id=wxID_PDFCOMPUTE, kind=wx.ITEM_NORMAL,
     212            text='Compute PDF')
     213        self.PDFCompute = parent.Append(help='Compute all PDFs', id=wxID_PDFCOMPUTEALL, kind=wx.ITEM_NORMAL,
     214            text='Compute all PDFs')
     215       
    192216
    193217    def _init_utils(self):
     
    204228        self.IndPeaksMenu = wx.MenuBar()
    205229        self.IndexMenu = wx.MenuBar()
     230        self.PDFMenu = wx.MenuBar()
    206231        self.AtomEdit = wx.Menu(title='')
    207232        self.DataEdit = wx.Menu(title='')
     
    214239        self.IndPeaksEdit = wx.Menu(title='')
    215240        self.IndexEdit = wx.Menu(title='')
     241        self.PDFEdit = wx.Menu(title='')
    216242        self._init_coll_AtomsMenu(self.AtomsMenu)
    217243        self._init_coll_Atom_Items(self.AtomEdit)
     
    234260        self._init_coll_IndexMenu(self.IndexMenu)
    235261        self._init_coll_Index_Items(self.IndexEdit)
     262        self._init_coll_PDFMenu(self.PDFMenu)
     263        self._init_coll_PDF_Items(self.PDFEdit)
    236264        self.UnDo.Enable(False)
    237265        self.PeakFit.Enable(False)
     
    655683def MovePatternTreeToGrid(self,item):
    656684   
     685#    print self.PatternTree.GetItemText(item)
     686   
    657687    oldPage = 0
    658688    if self.dataFrame:
     
    674704        self.dataFrame.SetLabel('')
    675705    else:
    676        self.dataFrame = DataFrame(parent=self.mainPanel)
     706        self.dataFrame = DataFrame(parent=self.mainPanel)
    677707
    678708    self.dataFrame.Raise()           
     
    712742        elif 'PKS' in self.PatternTree.GetItemText(item):
    713743            G2plt.PlotPowderLines(self)
    714         elif 'PWDR' in self.PatternTree.GetItemText(item):           
     744        elif 'PWDR' in self.PatternTree.GetItemText(item):
    715745            self.ExportPattern.Enable(True)
    716746            G2plt.PlotPatterns(self,newPlot=True)
     
    718748            self.Sngl = item
    719749            G2plt.PlotSngl(self,newPlot=True)
    720            
     750        elif 'PDF' in self.PatternTree.GetItemText(item):
     751            self.PatternId = item
     752            G2plt.PlotSofQ(self)
     753            G2plt.PlotGofR(self)
     754           
     755    elif 'S(Q)' in self.PatternTree.GetItemText(item):
     756        self.PickId = item
     757        self.PatternId = self.PatternTree.GetItemParent(item)
     758        G2plt.PlotSofQ(self)
     759    elif 'G(R)' in self.PatternTree.GetItemText(item):
     760        self.PickId = item
     761        self.PatternId = self.PatternTree.GetItemParent(item)
     762        G2plt.PlotGofR(self)           
    721763    elif self.PatternTree.GetItemText(parentID) == 'Phases':
    722764        self.PickId = item
     
    749791        data = self.PatternTree.GetItemPyData(item)
    750792        UpdateHKLControls(self,data)
    751         G2plt.PlotSngl(self)               
     793        G2plt.PlotSngl(self)
     794    elif self.PatternTree.GetItemText(item) == 'PDF Controls':
     795        self.PatternId = self.PatternTree.GetItemParent(item)
     796        self.ExportPDF.Enable(True)
     797        self.PickId = item
     798        data = self.PatternTree.GetItemPyData(item)
     799        G2pdG.UpdatePDFGrid(self,data)
     800        G2plt.PlotSofQ(self)
     801        G2plt.PlotGofR(self)
    752802    elif self.PatternTree.GetItemText(item) == 'Peak List':
    753803        self.PatternId = self.PatternTree.GetItemParent(item)
     
    812862        else:
    813863            G2plt.PlotPatterns(self)
     864     
  • TabularUnified trunk/GSASIIimage.py

    r263 r264  
    119119    B = np.array(-(x**2+y**2))
    120120    bb,err = fel.fellipse(len(x),x,y,1.E-7)
     121#    print nl.lstsq(M.T,B)[0]
     122#    print bb
    121123    return err,makeParmsEllipse(bb)
    122124   
     
    202204    ring = []
    203205    if azm:
    204         aR = azm[0],azm[1],1
     206        aR = azm[0]-90,azm[1]-90,1
    205207        if azm[1]-azm[0] > 180:
    206208            aR[2] = 2
     
    297299    tth = npatand(np.sqrt(dx**2+dy**2-Z**2)/(dist-Z))
    298300    dsp = wave/(2.*npsind(tth/2.))
    299     azm = npatan2d(dy,dx)+azmthoff
     301    azm = npatan2d(dx,-dy)+azmthoff
    300302    return tth,azm,dsp
    301303   
     
    360362    data['center'] = copy.copy(ellipse[0])           #not right!! (but useful for now)
    361363    data['ellipses'].append(ellipse[:]+('r',))
    362     G2plt.PlotImage(self,newImage=False)
     364    G2plt.PlotImage(self,newImage=True)
    363365   
    364366    #setup for calibration
     
    428430            else:
    429431                ellipse = newellipse
    430 #                if abs((radii[1]/radii[0]-ratio)/ratio) > 0.1:
    431 #                    print 'Bad fit for ring # %i. Try reducing Pixel search range'%(i)
    432 #                    return False
    433432            zdis,cosB = calcZdisCosB(radius,tth,radii)
    434433            Tilt = acosd(cosB)          # 0 <= tilt <= 90
     
    451450                tiltSum += numZ*abs(Tilt)
    452451                if not np.all(checkEllipse(Zsum,distSum,xSum,ySum,dist,data['center'][0],data['center'][1])):
    453                     print 'Bad ellipse. Try reducing Pixel search range'
     452                    print 'Bad fit for ring # %i. Try reducing Pixel search range'%(i)
    454453            cent = data['center']
    455454            print ('for ring # %2i @ d-space %.4f: dist %.3f rotate %6.2f tilt %6.2f Xcent %.3f Ycent %.3f Npts %d'
    456                 %(i,dsp,dist,phi,Tilt,cent[0],cent[1],numZ))
     455                %(i,dsp,dist,phi-90.,Tilt,cent[0],cent[1],numZ))
    457456            data['ellipses'].append(copy.deepcopy(ellipse+('r',)))
    458457        else:
  • TabularUnified trunk/GSASIIimgGUI.py

    r261 r264  
    8989        cutOff.SetValue("%.1f"%(data['cutoff']))          #reset in case of error 
    9090       
     91    def OnMaxVal(event):
     92        try:
     93            value = min(data['range'][0][1],int(maxVal.GetValue()))
     94            if value < data['range'][1][0]+1:
     95                raise ValueError
     96            data['range'][1][1] = value
     97        except ValueError:
     98            pass
     99        maxVal.SetValue('%.0f'%(data['range'][1][1]))
     100        DeltOne = data['range'][1][1]-max(0.0,data['range'][0][0])
     101        sqrtDeltOne = math.sqrt(DeltOne)
     102        maxSel.SetValue(int(100*sqrtDeltOne/sqrtDeltZero))
     103        minSel.SetValue(int(100*(data['range'][1][0]/DeltOne)))
     104        G2plt.PlotExposedImage(self,event=event)
     105       
     106    def OnMinVal(event):
     107        try:
     108            value = int(minVal.GetValue())
     109            if value > data['range'][1][1]-1:
     110                raise ValueError
     111            data['range'][1][0] = value
     112        except ValueError:
     113            pass
     114        minVal.SetValue('%.0f'%(data['range'][1][0]))
     115        minSel.SetValue(int(100*(data['range'][1][0]-max(0.0,data['range'][0][0]))/DeltOne))
     116        G2plt.PlotExposedImage(self,event=event)
     117       
    91118    def OnMaxSlider(event):
    92119        sqrtDeltZero = math.sqrt(data['range'][0][1])
     
    96123        DeltOne = max(1.0,data['range'][1][1]-data['range'][1][0])
    97124        minSel.SetValue(int(100*(data['range'][1][0]/DeltOne)))
     125        maxVal.SetValue('%.0f'%(data['range'][1][1]))
    98126        G2plt.PlotExposedImage(self,event=event)
    99127       
     
    102130        imin = int(minSel.GetValue())*DeltOne/100.
    103131        data['range'][1][0] = max(0.0,min(data['range'][1][1]-1,imin))
     132        minVal.SetValue('%.0f'%(data['range'][1][0]))
    104133        G2plt.PlotExposedImage(self,event=event)
    105134       
     
    172201       
    173202    def OnLRazim(event):
    174         Lazm = int(self.Lazim.GetValue())
    175         Razm = int(self.Razim.GetValue())
     203        Lazm = min(180,int(self.Lazim.GetValue()))
     204        Razm = max(-180,int(self.Razim.GetValue()))
    176205        data['LRazimuth'] = [Lazm,Razm]
    177206        G2plt.PlotExposedImage(self,event=event)
    178            
    179207           
    180208    def OnClearCalib(event):
     
    187215    def OnCalibrate(event):       
    188216        self.dataFrame.ImageEdit.Enable(id=G2gd.wxID_IMCLEARCALIB,enable=True)   
    189         data['setRings'] = False
    190         setRings.SetValue(data['setRings'])
    191217        self.dataFrame.GetStatusBar().SetStatusText('Select > 4 points on 1st used ring; LB to pick, RB on point to delete else RB to finish')
    192218        self.ifGetRing = True
     
    196222        G2plt.PlotIntegration(self,newPlot=True)
    197223        G2IO.SaveIntegration(self,self.PickId,data)
     224        self.MakePDF.Enable(True)
    198225       
    199226    def OnIntegrateAll(event):
     
    387414    mainSizer.Add((5,5),0)
    388415           
    389     maxSizer = wx.FlexGridSizer(2,2,0,5)
     416    maxSizer = wx.FlexGridSizer(2,3,0,5)
    390417    maxSizer.AddGrowableCol(1,1)
    391418    maxSizer.SetFlexibleDirection(wx.HORIZONTAL)
     
    398425        value=int(100*sqrtDeltOne/sqrtDeltZero))
    399426    maxSizer.Add(maxSel,1,wx.EXPAND)
    400     maxSel.Bind(wx.EVT_SLIDER, OnMaxSlider)   
     427    maxSel.Bind(wx.EVT_SLIDER, OnMaxSlider)
     428    maxVal = wx.TextCtrl(parent=self.dataDisplay,value='%.0f'%(data['range'][1][1]))
     429    maxVal.Bind(wx.EVT_TEXT_ENTER,OnMaxVal)   
     430    maxVal.Bind(wx.EVT_KILL_FOCUS,OnMaxVal)
     431    maxSizer.Add(maxVal,0,wx.ALIGN_CENTER_VERTICAL)   
    401432    maxSizer.Add(wx.StaticText(parent=self.dataDisplay,label=' Min intensity'),0,
    402433        wx.ALIGN_CENTER_VERTICAL)
     
    405436    maxSizer.Add(minSel,1,wx.EXPAND)
    406437    minSel.Bind(wx.EVT_SLIDER, OnMinSlider)
     438    minVal = wx.TextCtrl(parent=self.dataDisplay,value='%.0f'%(data['range'][1][0]))
     439    minVal.Bind(wx.EVT_TEXT_ENTER,OnMinVal)   
     440    minVal.Bind(wx.EVT_KILL_FOCUS,OnMinVal)
     441    maxSizer.Add(minVal,0,wx.ALIGN_CENTER_VERTICAL)   
    407442    mainSizer.Add(maxSizer,0,wx.ALIGN_LEFT|wx.EXPAND)
    408443   
     
    498533    dataSizer.Add(wx.StaticText(parent=self.dataDisplay,label=' Tilt rotation'),0,
    499534        wx.ALIGN_CENTER_VERTICAL)
    500     rotSel = wx.TextCtrl(parent=self.dataDisplay,value=("%9.3f"%(data['rotation'])),style=wx.TE_READONLY)
     535    rotSel = wx.TextCtrl(parent=self.dataDisplay,value=("%9.3f"%(data['rotation']-90.)),style=wx.TE_READONLY)
    501536    rotSel.SetBackgroundColour(VERY_LIGHT_GREY)
    502537    dataSizer.Add(rotSel,0,wx.ALIGN_CENTER_VERTICAL)
  • TabularUnified trunk/GSASIIlattice.py

    r230 r264  
    200200    else:
    201201        return [0,0,0]
     202       
     203def CellAbsorption(ElList,Volume):
     204# ElList = dictionary of element contents including mu
     205    muT = 0
     206    for El in ElList:
     207        muT += ElList[El]['mu']*ElList[El]['FormulaNo']
     208    return muT/Volume
     209   
     210def qRebin(x,y,nQbins):
     211#Rebin data from x to qx
     212#   input:
     213#   X - array of q-values in increasing order
     214#   y - array of intensities for the x array
     215#   nQbins - number of q-bins desired
     216#   returns:
     217#   qx - array of q-values
     218#   qy - array of rebinned intensities
     219    dQ = (x[-1]-x[0])/nQbins
     220    dQ2 = dQ/2.
     221    Qmin = x[0]
     222    yf = y[0]
     223    frac = 0.0
     224    jch = 0
     225    kch = 0
     226    qy = []
     227    for i in range(nQbins):
     228        Q = Qmin+dQ*i
     229        rom = Q
     230        rop = rom+dQ
     231        sdq = (1.-frac)*dQ
     232        qy.append(1-frac)*yf*dQ
     233       
     234#      DELQ = (XT(NCHANS)-XT(1))/FLOAT(MCHANS)
     235#      DELQ2 = DELQ/2.0
     236#      QMIN = XT(1)
     237#      JCH = 1
     238#      KCH = 0
     239#      YF = YT(1)
     240#      FRAC = 0.0
     241#      DQ = XT(2)-QMIN
     242#      DO ICH = 1,MCHANS
     243#        Q = QMIN+DELQ*FLOAT(ICH-1) !Front end interpolation
     244#        ROM = Q
     245#        ROP = ROM+DELQ
     246#        SDQ = (1.0-FRAC)*DQ
     247#        RY(ICH) = (1.0-FRAC)*YF*DQ !Sum intervening channels
     248#        DO WHILE ( ROP.GT.XT(KCH+1) .AND. KCH.NE.NCHANS-1 )
     249#          KCH = MIN(KCH+1,NCHANS-1)
     250#        END DO
     251#        DO LCH=JCH+1,KCH
     252#          DQ = XT(LCH+1)-XT(LCH)
     253#          SDQ = SDQ+DQ
     254#          RY(ICH) = RY(ICH)+DQ*YT(LCH)
     255#        END DO !Tail end interpolation
     256#        XF = XT(MAX(1,KCH))
     257#        YF = YT(MAX(1,KCH))
     258#        DQ = XT(KCH+1)-XF
     259#        DY = YT(KCH+1)-YF
     260#        FRAC = (ROP-XF)/DQ
     261#        SDQ = SDQ+DQ*FRAC
     262#        RY(ICH) = RY(ICH)+YF*FRAC*DQ !Reset lower limit
     263#        JCH = KCH
     264#        RY(ICH) = RY(ICH)/SDQ
     265#      END DO
     266#      RETURN
     267#      END
     268
     269   
    202270
    203271#Permutations and Combinations
  • TabularUnified trunk/GSASIIpeak.py

    r243 r264  
    1 #GSASII peak fitting module
     1#GSASII powder calculation module
    22########### SVN repository information ###################
    33# $Date$
     
    7575            plist.append(p)
    7676    return plist
     77
     78def Transmission(Geometry,Abs,Diam):
     79#Calculate sample transmission
     80#   Geometry: one of 'Cylinder','Bragg-Brentano','Tilting Flat Plate in transmission','Fixed flat plate'
     81#   Abs: absorption coeff in cm-1
     82#   Diam: sample thickness/diameter in mm
     83    if 'Cylinder' in Geometry:      #Lobanov & Alte da Veiga for 2-theta = 0; beam fully illuminates sample
     84        MuR = Abs*Diam/5.0
     85        if MuR <= 3.0:
     86            T0 = 16/(3.*math.pi)
     87            T1 = -0.045780
     88            T2 = -0.02489
     89            T3 = 0.003045
     90            T = -T0*MuR-T1*MuR**2-T2*MuR**3-T3*MuR**4
     91            if T < -20.:
     92                return 2.06e-9
     93            else:
     94                return math.exp(T)
     95        else:
     96            T1 = 1.433902
     97            T2 = 0.013869+0.337894
     98            T3 = 1.933433+1.163198
     99            T4 = 0.044365-0.04259
     100            T = (T1-T4)/(1.0+T2*(MuR-3.0))**T3+T4
     101            return T/100.
     102
     103def Absorb(Geometry,Abs,Diam,Tth,Phi=0,Psi=0):
     104#Calculate sample absorption
     105#   Geometry: one of 'Cylinder','Bragg-Brentano','Tilting Flat Plate in transmission','Fixed flat plate'
     106#   Abs: absorption coeff in cm-1
     107#   Diam: sample thickness/diameter in mm
     108#   Tth: 2-theta scattering angle - can be numpy array
     109#   Phi: flat plate tilt angle - future
     110#   Psi: flat plate tilt axis - future
     111    MuR = Abs*Diam/5.0
     112    Sth2 = npsind(Tth/2.0)**2
     113    Cth2 = 1.-Sth2
     114    if 'Cylinder' in Geometry:      #Lobanov & Alte da Veiga for 2-theta = 0; beam fully illuminates sample
     115        if MuR < 3.0:
     116            T0 = 16.0/(3*np.pi)
     117            T1 = (25.99978-0.01911*Sth2**0.25)*np.exp(-0.024551*Sth2)+ \
     118                0.109561*np.sqrt(Sth2)-26.04556
     119            T2 = -0.02489-0.39499*Sth2+1.219077*Sth2**1.5- \
     120                1.31268*Sth2**2+0.871081*Sth2**2.5-0.2327*Sth2**3
     121            T3 = 0.003045+0.018167*Sth2-0.03305*Sth2**2
     122            Trns = -T0*MuR-T1*MuR**2-T2*MuR**3-T3*MuR**4
     123            return np.exp(Trns)
     124        else:
     125            T1 = 1.433902+11.07504*Sth2-8.77629*Sth2*Sth2+ \
     126                10.02088*Sth2**3-3.36778*Sth2**4
     127            T2 = (0.013869-0.01249*Sth2)*np.exp(3.27094*Sth2)+ \
     128                (0.337894+13.77317*Sth2)/(1.0+11.53544*Sth2)**1.555039
     129            T3 = 1.933433/(1.0+23.12967*Sth2)**1.686715- \
     130                0.13576*np.sqrt(Sth2)+1.163198
     131            T4 = 0.044365-0.04259/(1.0+0.41051*Sth2)**148.4202
     132            Trns = (T1-T4)/(1.0+T2*(MuR-3.0))**T3+T4
     133            return Trns/100.
     134    elif 'Bragg' in Geometry:
     135        return 1.0
     136    elif 'Fixed' in Geometry: #assumes sample plane is perpendicular to incident beam
     137        # and only defined for 2theta < 90
     138        T1 = np.exp(-MuR)
     139        T2 = np.exp(-MuR/(1.-2.*Sth2))
     140        Tb = -2.*Abs*Sth2
     141        return (T1-T2)/Tb
     142    elif 'Tilting' in Geometry: #assumes symmetric tilt so sample plane is parallel to diffraction vector
     143        cth = npcosd(Tth/2.0)
     144        return (Diam/cth)*np.exp(-MuR/cth)
     145       
     146def Polarization(Pola,Azm,Tth):
     147#   Calculate x-ray polarization correction
     148#   Pola: polarization coefficient e.g 1.0 fully polarized, 0.5 unpolarized
     149#   Azm: azimuthal angle e.g. 0.0 in plane of polarization(?)
     150#   Tth: 2-theta scattering angle - can be numpy array
     151    pass
     152   
     153       
    77154
    78155def ValEsd(value,esd=0,nTZ=False):                  #NOT complete - don't use
     
    328405    data = [x,y,w,yc,yb,yd]
    329406    return True,smin,Rwp,runtime,GoOn
     407
     408def ComputePDF(data,xydata):
     409    for key in data:
     410        print key,data[key]
     411    #subtract backgrounds - if any
     412    xydata['Sample corrected'] = xydata['Sample']
     413    if 'Sample Bkg.' in xydata:
     414        xydata['Sample corrected'][1][1] -= (xydata['Sample Bkg.'][1][1]+
     415            data['Sample Bkg.']['Add'])*data['Sample Bkg.']['Mult']
     416    if 'Container' in xydata:   
     417        xydata['Sample corrected'][1][1] -= (xydata['Container'][1][1]+
     418            data['Container']['Add'])*data['Container']['Mult']
     419    if 'Container Bkg.' in xydata:
     420        xydata['Sample corrected'][1][1] += (xydata['Container Bkg.'][1][1]+
     421            data['Container Bkg.']['Add'])*data['Container Bkg.']['Mult']
    330422   
    331423           
    332424       
     425    return xydata['Sample corrected'],[]
     426       
  • TabularUnified trunk/GSASIIphsGUI.py

    r242 r264  
    265265                    Obj.SetValue("%.5f"%(cell[4]))
    266266            elif laue in ['3','3m1','31m','6/m','6/mmm','4/m','4/mmm']:                   
     267                cell[4] = cell[5] = 90.
     268                cell[6] = 120.
    267269                if ObjId == 0:
    268270                    cell[1] = cell[2] = value
     
    273275            elif laue in ['mmm']:
    274276                cell[ObjId+1] = value
     277                cell[4] = cell[5] = cell[6] = 90.
    275278                Obj.SetValue("%.5f"%(cell[ObjId+1]))
    276279            elif laue in ['2/m'+'a']:
     280                cell[5] = cell[6] = 90.
    277281                if ObjId != 3:
    278282                    cell[ObjId+1] = value
     
    282286                    Obj.SetValue("%.3f"%(cell[4]))
    283287            elif laue in ['2/m'+'b']:
     288                cell[4] = cell[6] = 90.
    284289                if ObjId != 3:
    285290                    cell[ObjId+1] = value
     
    289294                    Obj.SetValue("%.3f"%(cell[5]))
    290295            elif laue in ['2/m'+'c']:
     296                cell[5] = cell[6] = 90.
    291297                if ObjId != 3:
    292298                    cell[ObjId+1] = value
  • TabularUnified trunk/GSASIIplot.py

    r261 r264  
    670670        Page.canvas.draw()
    671671    self.Pwdr = True
     672   
     673def PlotSofQ(self,newPlot=False):
     674    superMinusOne = unichr(0xaf)+unichr(0xb9)
     675   
     676    def OnPlotKeyPress(event):
     677        newPlot = False
     678        if event.key == 'u':
     679            if self.Contour:
     680                self.Cmax = min(1.0,self.Cmax*1.2)
     681            elif self.Offset < 100.:
     682                self.Offset += 1.
     683        elif event.key == 'd':
     684            if self.Contour:
     685                self.Cmax = max(0.0,self.Cmax*0.8)
     686            elif self.Offset > 0.:
     687                self.Offset -= 1.
     688        elif event.key == 'c':
     689            newPlot = True
     690            if self.Contour:
     691                self.Contour = False
     692            else:
     693                self.Contour = True
     694                self.SinglePlot = False
     695                self.Offset = 0
     696        elif event.key == 's':
     697            if self.Contour:
     698                choice = [m for m in mpl.cm.datad.keys() if not m.endswith("_r")]
     699                dlg = wx.SingleChoiceDialog(self,'Select','Color scheme',choice)
     700                if dlg.ShowModal() == wx.ID_OK:
     701                    sel = dlg.GetSelection()
     702                    self.ContourColor = choice[sel]
     703                else:
     704                    self.ContourColor = 'Paired'
     705                dlg.Destroy()
     706            else:               
     707                if self.SinglePlot:
     708                    self.SinglePlot = False
     709                else:
     710                    self.SinglePlot = True
     711        elif event.key == 'i':                  #for smoothing contour plot
     712            choice = ['nearest','bilinear','bicubic','spline16','spline36','hanning',
     713               'hamming','hermite','kaiser','quadric','catrom','gaussian','bessel',
     714               'mitchell','sinc','lanczos']
     715            dlg = wx.SingleChoiceDialog(self,'Select','Interpolation',choice)
     716            if dlg.ShowModal() == wx.ID_OK:
     717                sel = dlg.GetSelection()
     718                self.Interpolate = choice[sel]
     719            else:
     720                self.Interpolate = 'nearest'
     721            dlg.Destroy()
     722           
     723        PlotSofQ(self,newPlot=newPlot)
     724       
     725    def OnKeyBox(event):
     726        if self.G2plotNB.nb.GetSelection() == self.G2plotNB.plotList.index('S(Q)'):
     727            event.key = cb.GetValue()[0]
     728            cb.SetValue(' key press')
     729            OnPlotKeyPress(event)
     730                       
     731    def OnMotion(event):
     732        xpos = event.xdata
     733        if xpos:                                        #avoid out of frame mouse position
     734            ypos = event.ydata
     735            Page.canvas.SetCursor(wx.CROSS_CURSOR)
     736            try:
     737                if self.Contour:
     738                    self.G2plotNB.status.SetStatusText('Q =%9.3fA pattern ID =%5d'%(xpos,int(ypos)),1)
     739                else:
     740                    self.G2plotNB.status.SetStatusText('Q =%9.3fA S(q) =%9.1f'%(xpos,ypos),1)
     741
     742            except TypeError:
     743                self.G2plotNB.status.SetStatusText('Select S(Q) pattern first',1)
     744   
     745    xylim = []
     746    try:
     747        plotNum = self.G2plotNB.plotList.index('S(Q)')
     748        Page = self.G2plotNB.nb.GetPage(plotNum)
     749        if not newPlot:
     750            Plot = Page.figure.gca()          #get previous S(Q) plot & get limits
     751            xylim = Plot.get_xlim(),Plot.get_ylim()
     752        Page.figure.clf()
     753        Plot = Page.figure.gca()
     754    except ValueError,error:
     755        newPlot = True
     756        self.Cmax = 1.0
     757        Plot = self.G2plotNB.addMpl('S(Q)').gca()
     758        plotNum = self.G2plotNB.plotList.index('S(Q)')
     759        Page = self.G2plotNB.nb.GetPage(plotNum)
     760        Page.canvas.mpl_connect('key_press_event', OnPlotKeyPress)
     761        Page.canvas.mpl_connect('motion_notify_event', OnMotion)
     762   
     763    Page.SetFocus()
     764    self.G2plotNB.status.DestroyChildren()
     765    if self.Contour:
     766        Choice = (' key press','d: lower contour max','u: raise contour max',
     767            'i: interpolation method','s: color scheme','c: contour off')
     768    else:
     769        Choice = (' key press','d: offset down','u: offset up',
     770            'c: contour on','s: toggle single plot','+: no selection')
     771    cb = wx.ComboBox(self.G2plotNB.status,style=wx.CB_DROPDOWN|wx.CB_READONLY,
     772        choices=Choice)
     773    cb.Bind(wx.EVT_COMBOBOX, OnKeyBox)
     774    cb.SetValue(' key press')
     775    PatternId = self.PatternId
     776    PickId = self.PickId
     777    Plot.set_title('S(Q)')
     778    Plot.set_xlabel(r'$Q,\AA$'+superMinusOne,fontsize=14)
     779    Plot.set_ylabel(r'S(Q)',fontsize=14)
     780    colors=['b','g','r','c','m','k']
     781    name = self.PatternTree.GetItemText(PatternId)[4:]
     782    G2gd.GetPatternTreeItemId(self,PatternId, 'Instrument Parameters')
     783    Pattern = []   
     784    if self.SinglePlot:
     785        name = 'S(Q)'+self.PatternTree.GetItemText(PatternId)[4:]
     786        Id = G2gd.GetPatternTreeItemId(self,PatternId,name)
     787        if Pattern:
     788            Pattern = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,Id,name))
     789            Pattern.append(name)
     790        PlotList = [Pattern,]
     791    else:       
     792        PlotList = []
     793        item, cookie = self.PatternTree.GetFirstChild(self.root)
     794        while item:
     795            if 'PDF' in self.PatternTree.GetItemText(item):
     796                name = 'S(Q)'+self.PatternTree.GetItemText(item)[4:]
     797                print name
     798                Id = G2gd.GetPatternTreeItemId(self,item,name)
     799                Pattern = self.PatternTree.GetItemPyData(Id)
     800                if Pattern:
     801                    Pattern.append(name)
     802                    PlotList.append(Pattern)
     803            item, cookie = self.PatternTree.GetNextChild(self.root, cookie)
     804    Ymax = 1.0
     805    lenX = 0
     806    for Pattern in PlotList:
     807        xye = Pattern[1]
     808        Ymax = max(Ymax,max(xye[1]))
     809    offset = self.Offset*Ymax/100.0
     810    if self.Contour:
     811        ContourZ = []
     812        ContourY = []
     813        Nseq = 0
     814    for N,Pattern in enumerate(PlotList):
     815        xye = np.array(Pattern[1])
     816        if PickId:
     817            ifpicked = Pattern[2] == self.PatternTree.GetItemText(PatternId)
     818        X = xye[0]
     819        if not lenX:
     820            lenX = len(X)           
     821        Y = xye[1]+offset*N
     822        if self.Contour:
     823            if lenX == len(X):
     824                ContourY.append(N)
     825                ContourZ.append(Y)
     826                ContourX = X
     827                Nseq += 1
     828                Plot.set_ylabel('Data sequence',fontsize=12)
     829        else:
     830            if ifpicked:
     831                Plot.plot(X,Y,colors[N%6]+'+',picker=3.,clip_on=False)
     832                Page.canvas.SetToolTipString('')
     833            else:
     834                Plot.plot(X,Y,colors[N%6],picker=False)
     835    if self.Contour:
     836        acolor = mpl.cm.get_cmap(self.ContourColor)
     837        Img = Plot.imshow(ContourZ,cmap=acolor,vmin=0,vmax=Ymax*self.Cmax,interpolation=self.Interpolate,
     838            extent=[ContourX[0],ContourX[-1],ContourY[0],ContourY[-1]],aspect='auto',origin='lower')
     839        Page.figure.colorbar(Img)
     840    if not newPlot:
     841        Page.toolbar.push_current()
     842        Plot.set_xlim(xylim[0])
     843        Plot.set_ylim(xylim[1])
     844        xylim = []
     845        Page.toolbar.push_current()
     846        Page.toolbar.draw()
     847    else:
     848        Page.canvas.draw()
     849
     850def PlotGofR(self,newPlot=False):
     851   
     852    def OnPlotKeyPress(event):
     853        newPlot = False
     854        if event.key == 'u':
     855            if self.Contour:
     856                self.Cmax = min(1.0,self.Cmax*1.2)
     857            elif self.Offset < 100.:
     858                self.Offset += 1.
     859        elif event.key == 'd':
     860            if self.Contour:
     861                self.Cmax = max(0.0,self.Cmax*0.8)
     862            elif self.Offset > 0.:
     863                self.Offset -= 1.
     864        elif event.key == 'c':
     865            newPlot = True
     866            if self.Contour:
     867                self.Contour = False
     868            else:
     869                self.Contour = True
     870                self.SinglePlot = False
     871                self.Offset = 0
     872        elif event.key == 's':
     873            if self.Contour:
     874                choice = [m for m in mpl.cm.datad.keys() if not m.endswith("_r")]
     875                dlg = wx.SingleChoiceDialog(self,'Select','Color scheme',choice)
     876                if dlg.ShowModal() == wx.ID_OK:
     877                    sel = dlg.GetSelection()
     878                    self.ContourColor = choice[sel]
     879                else:
     880                    self.ContourColor = 'Paired'
     881                dlg.Destroy()
     882            else:               
     883                if self.SinglePlot:
     884                    self.SinglePlot = False
     885                else:
     886                    self.SinglePlot = True
     887        elif event.key == 'i':                  #for smoothing contour plot
     888            choice = ['nearest','bilinear','bicubic','spline16','spline36','hanning',
     889               'hamming','hermite','kaiser','quadric','catrom','gaussian','bessel',
     890               'mitchell','sinc','lanczos']
     891            dlg = wx.SingleChoiceDialog(self,'Select','Interpolation',choice)
     892            if dlg.ShowModal() == wx.ID_OK:
     893                sel = dlg.GetSelection()
     894                self.Interpolate = choice[sel]
     895            else:
     896                self.Interpolate = 'nearest'
     897            dlg.Destroy()
     898           
     899        PlotGofR(self,newPlot=newPlot)
     900       
     901    def OnKeyBox(event):
     902        if self.G2plotNB.nb.GetSelection() == self.G2plotNB.plotList.index('G(R)'):
     903            event.key = cb.GetValue()[0]
     904            cb.SetValue(' key press')
     905            OnPlotKeyPress(event)
     906                       
     907    def OnMotion(event):
     908        xpos = event.xdata
     909        if xpos:                                        #avoid out of frame mouse position
     910            ypos = event.ydata
     911            Page.canvas.SetCursor(wx.CROSS_CURSOR)
     912            try:
     913                if self.Contour:
     914                    self.G2plotNB.status.SetStatusText('r =%9.3fA pattern ID =%5d'%(xpos,int(ypos)),1)
     915                else:
     916                    self.G2plotNB.status.SetStatusText('r =%9.3fA G(r) =%9.1f'%(xpos,ypos),1)
     917
     918            except TypeError:
     919                self.G2plotNB.status.SetStatusText('Select G(R) pattern first',1)
     920   
     921    xylim = []
     922    try:
     923        plotNum = self.G2plotNB.plotList.index('G(r)')
     924        Page = self.G2plotNB.nb.GetPage(plotNum)
     925        if not newPlot:
     926            Plot = Page.figure.gca()          #get previous G(R) plot & get limits
     927            xylim = Plot.get_xlim(),Plot.get_ylim()
     928        Page.figure.clf()
     929        Plot = Page.figure.gca()
     930    except ValueError,error:
     931        newPlot = True
     932        self.Cmax = 1.0
     933        Plot = self.G2plotNB.addMpl('G(r)').gca()
     934        plotNum = self.G2plotNB.plotList.index('G(r)')
     935        Page = self.G2plotNB.nb.GetPage(plotNum)
     936        Page.canvas.mpl_connect('key_press_event', OnPlotKeyPress)
     937        Page.canvas.mpl_connect('motion_notify_event', OnMotion)
     938       
     939    Page.SetFocus()
     940    self.G2plotNB.status.DestroyChildren()
     941    if self.Contour:
     942        Choice = (' key press','d: lower contour max','u: raise contour max',
     943            'i: interpolation method','s: color scheme','c: contour off')
     944    else:
     945        Choice = (' key press','d: offset down','u: offset up',
     946            'c: contour on','s: toggle single plot','+: no selection')
     947    cb = wx.ComboBox(self.G2plotNB.status,style=wx.CB_DROPDOWN|wx.CB_READONLY,
     948        choices=Choice)
     949    cb.Bind(wx.EVT_COMBOBOX, OnKeyBox)
     950    cb.SetValue(' key press')
     951    PatternId = self.PatternId
     952    Pattern = []   
     953    if self.SinglePlot:
     954        Pattern = self.PatternTree.GetItemPyData(PatternId)
     955        Pattern.append(self.PatternTree.GetItemText(PatternId))
     956        PlotList = [Pattern,]
     957    else:       
     958        PlotList = []
     959        item, cookie = self.PatternTree.GetFirstChild(self.root)
     960        while item:
     961            if 'PDF' in self.PatternTree.GetItemText(item):
     962                Pattern = self.PatternTree.GetItemPyData(item)
     963                PlotList.append(Pattern)
     964            item, cookie = self.PatternTree.GetNextChild(self.root, cookie)               
     965    Plot.set_title('G(r)')
     966    Plot.set_xlabel(r'$r,\AA$',fontsize=14)
     967    Plot.set_ylabel(r'G(r)',fontsize=14)
     968    PatternId = self.PatternId
     969    Page.canvas.draw()
    672970
    673971def PlotPowderLines(self):
     
    9021200    Dsp = lambda tth,wave: wave/(2.*sind(tth/2.))
    9031201    global Data,Masks
    904     newImage = True
    9051202    colors=['b','g','r','c','m','k']
    9061203    Data = self.PatternTree.GetItemPyData(
     
    12421539                xyI = []
    12431540                for azm in Azm:
    1244                     xyI.append(G2img.GetDetectorXY(dspI,azm,Data))
     1541                    xyI.append(G2img.GetDetectorXY(dspI,azm-90.,Data))
    12451542                xyI = np.array(xyI)
    12461543                arcxI,arcyI = xyI.T
     
    12491546                xyO = []
    12501547                for azm in Azm:
    1251                     xyO.append(G2img.GetDetectorXY(dspO,azm,Data))
     1548                    xyO.append(G2img.GetDetectorXY(dspO,azm-90.,Data))
    12521549                xyO = np.array(xyO)
    12531550                arcxO,arcyO = xyO.T
  • TabularUnified trunk/GSASIIpwdGUI.py

    r250 r264  
    99import wx
    1010import wx.grid as wg
     11import numpy as np
    1112import math
    1213import time
     
    1920import GSASIIplot as G2plt
    2021import GSASIIgrid as G2gd
     22import GSASIIElem as G2elem
    2123
    2224VERY_LIGHT_GREY = wx.Colour(235,235,235)
     
    735737        volVal.SetValue("%.3f"%(controls[12]))
    736738       
     739    def OnHklShow(event):
     740        hklShow.SetValue(False)
     741        PatternId = self.PatternId
     742        PickId = self.PickId   
     743        limits = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, 'Limits'))[1]
     744        controls,bravais,cells,dmin = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, 'Unit Cells List'))
     745        cell = controls[6:12]
     746        A = G2lat.cell2A(cell)
     747        ibrav = bravaisSymb.index(controls[5])
     748        inst = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, 'Instrument Parameters'))
     749        inst = dict(zip(inst[3],inst[1]))
     750        if 'Lam' in inst:
     751            wave = inst['Lam']
     752        else:
     753            wave = inst['Lam1']
     754        dmin = wave/(2.0*sind(limits[1]/2.0))
     755        self.HKL = G2lat.GenHBravais(dmin,ibrav,A)
     756        for hkl in self.HKL:
     757            hkl.append(2.0*asind(wave/(2.*hkl[3])))             
     758        if 'PKS' in self.PatternTree.GetItemText(self.PatternId):
     759            G2plt.PlotPowderLines(self)
     760        else:
     761            G2plt.PlotPatterns(self)
     762       
     763       
    737764    def RefineCell(event):
    738765        def cellPrint(ibrav,A):
     
    955982    littleSizer = wx.FlexGridSizer(1,3,5,5)
    956983    littleSizer.Add(wx.StaticText(self.dataDisplay,label=" Zero offset"),0,wx.ALIGN_CENTER_VERTICAL)
    957     zero = wx.TextCtrl(self.dataDisplay,value=str(controls[1]),style=wx.TE_PROCESS_ENTER)
     984    zero = wx.TextCtrl(self.dataDisplay,value="%.2f"%(controls[1]),style=wx.TE_PROCESS_ENTER)
    958985    zero.Bind(wx.EVT_TEXT_ENTER,OnZero)
    959986    zero.Bind(wx.EVT_KILL_FOCUS,OnZero)
    960987    littleSizer.Add(zero,0,wx.ALIGN_CENTER_VERTICAL)
    961988    zeroVar = wx.CheckBox(self.dataDisplay,label="Vary? (not implemented)")
    962     zero.SetValue("%.2f"%(controls[1]))
    963989    zeroVar.Bind(wx.EVT_CHECKBOX,OnZeroVar)
    964990    littleSizer.Add(zeroVar,0,wx.ALIGN_CENTER_VERTICAL)
     
    967993    mainSizer.Add(wx.StaticText(parent=self.dataDisplay,label=' Cell Refinement: '),0,wx.ALIGN_CENTER_VERTICAL)
    968994    mainSizer.Add((5,5),0)
    969     littleSizer = wx.FlexGridSizer(1,2,5,5)
    970     littleSizer.Add(wx.StaticText(self.dataDisplay,label=" Bravais lattice"),0,wx.ALIGN_CENTER_VERTICAL)
     995    littleSizer = wx.FlexGridSizer(1,3,5,5)
     996    littleSizer.Add(wx.StaticText(self.dataDisplay,label=" Bravais lattice "),0,wx.ALIGN_CENTER_VERTICAL)
    971997    bravSel = wx.Choice(self.dataDisplay,choices=bravaisSymb)
    972998    bravSel.SetSelection(bravaisSymb.index(controls[5]))
    973999    bravSel.Bind(wx.EVT_CHOICE,OnBravSel)
    9741000    littleSizer.Add(bravSel,0,wx.ALIGN_CENTER_VERTICAL)
     1001    hklShow = wx.CheckBox(self.dataDisplay,label="Show starting hkl positions")
     1002    hklShow.Bind(wx.EVT_CHECKBOX,OnHklShow)
     1003    littleSizer.Add(hklShow,0,wx.ALIGN_CENTER_VERTICAL)
    9751004    mainSizer.Add(littleSizer,0)
    9761005    mainSizer.Add((5,5),0)
     
    10461075                    gridDisplay.SetReadOnly(r,c,isReadOnly=True)
    10471076        gridDisplay.SetSize(bottomSize)
     1077
     1078def UpdatePDFGrid(self,data):
     1079    dataFile = self.PatternTree.GetItemText(self.PatternId)
     1080    powName = 'PWDR'+dataFile[4:]
     1081    powId = G2gd.GetPatternTreeItemId(self,self.root, powName)
     1082    limits = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,powId, 'Limits'))[1]
     1083    inst = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,powId, 'Instrument Parameters'))
     1084    inst = dict(zip(inst[3],inst[1]))
     1085    if 'Lam' in inst:
     1086        keV = 12.397639/inst['Lam']
     1087    else:
     1088        keV = 12.397639/inst['Lam1']
     1089    wave = 12.397639/keV
     1090    polariz = inst['Polariz.']
     1091    itemDict = {}
     1092   
     1093    def FillFileSizer(fileSizer,key):
     1094        #fileSizer is a FlexGridSizer(3,6)
     1095       
     1096        def OnSelectFile(event):
     1097            Obj = event.GetEventObject()
     1098            fileKey,itemKey,fmt = itemDict[Obj.GetId()]
     1099            if itemKey == 'Name':
     1100                value = Obj.GetValue()
     1101            Obj.SetValue(fmt%(value))
     1102            data[fileKey][itemKey] = value
     1103       
     1104        def OnValueChange(event):
     1105            Obj = event.GetEventObject()
     1106            fileKey,itemKey,fmt = itemDict[Obj.GetId()]
     1107            try:
     1108                value = float(Obj.GetValue())
     1109            except ValueError:
     1110                value = -1.0
     1111            Obj.SetValue(fmt%(value))
     1112            data[fileKey][itemKey] = value
     1113            UpdatePDFGrid(self,data)
     1114           
     1115        item = data[key]
     1116        fileList = np.array(GetFileList('PWDR')).T[1]
     1117        fileSizer.Add(wx.StaticText(parent=self.dataDisplay,label=' '+key+' file:'),0,wx.ALIGN_CENTER_VERTICAL)
     1118        fileName = wx.ComboBox(self.dataDisplay,value=item['Name'],choices=fileList,
     1119            style=wx.CB_READONLY|wx.CB_DROPDOWN)
     1120        itemDict[fileName.GetId()] = [key,'Name','%s']
     1121        fileName.Bind(wx.EVT_COMBOBOX,OnSelectFile)       
     1122        fileSizer.Add(fileName,0,)
     1123        fileSizer.Add(wx.StaticText(parent=self.dataDisplay,label='Multiplier:'),0,wx.ALIGN_CENTER_VERTICAL)
     1124        mult = wx.TextCtrl(self.dataDisplay,value='%.3f'%(item['Mult']),style=wx.TE_PROCESS_ENTER)
     1125        itemDict[mult.GetId()] = [key,'Mult','%.3f']
     1126        mult.Bind(wx.EVT_TEXT_ENTER,OnValueChange)       
     1127        mult.Bind(wx.EVT_KILL_FOCUS,OnValueChange)
     1128        fileSizer.Add(mult,0,)
     1129        fileSizer.Add(wx.StaticText(parent=self.dataDisplay,label='Add:'),0,wx.ALIGN_CENTER_VERTICAL)
     1130        add = wx.TextCtrl(self.dataDisplay,value='%.0f'%(item['Add']),style=wx.TE_PROCESS_ENTER)
     1131        itemDict[add.GetId()] = [key,'Add','%.0f']
     1132        add.Bind(wx.EVT_TEXT_ENTER,OnValueChange)       
     1133        add.Bind(wx.EVT_KILL_FOCUS,OnValueChange)
     1134        fileSizer.Add(add,0,)
     1135       
     1136    def SumElementVolumes():
     1137        sumVol = 0.
     1138        ElList = data['ElList']
     1139        for El in ElList:
     1140            Avol = (4.*math.pi/3.)*ElList[El]['Drad']**3
     1141            sumVol += Avol*ElList[El]['FormulaNo']
     1142        return sumVol
     1143       
     1144    def FillElemSizer(elemSizer,ElData):
     1145       
     1146        def OnFractionChange(event):
     1147            try:
     1148                value = max(0.0,float(num.GetValue()))
     1149            except ValueError:
     1150                value = 0.0
     1151            num.SetValue('%.3f'%(value))
     1152            ElData['FormulaNo'] = value
     1153            data['Form Vol'] = max(10.0,SumElementVolumes())
     1154            formVol.SetValue('%.2f'%(data['Form Vol']))
     1155            UpdatePDFGrid(self,data)
     1156       
     1157        elemSizer.Add(wx.StaticText(parent=self.dataDisplay,
     1158            label=' Element: '+'%2s'%(ElData['Symbol'])+' * '),0,wx.ALIGN_CENTER_VERTICAL)
     1159        num = wx.TextCtrl(self.dataDisplay,value='%.3f'%(ElData['FormulaNo']),style=wx.TE_PROCESS_ENTER)
     1160        num.Bind(wx.EVT_TEXT_ENTER,OnFractionChange)       
     1161        num.Bind(wx.EVT_KILL_FOCUS,OnFractionChange)
     1162        elemSizer.Add(num,0,wx.ALIGN_CENTER_VERTICAL)
     1163        elemSizer.Add(wx.StaticText(parent=self.dataDisplay,
     1164            label="f': %.3f"%(ElData['fp'])+' f": %.3f'%(ElData['fpp'])+' mu: %.2f barns'%(ElData['mu']) ),
     1165            0,wx.ALIGN_CENTER_VERTICAL)
     1166           
     1167    def OnGeometry(event):
     1168        data['Geometry'] = geometry.GetValue()
     1169        UpdatePDFGrid(self,data)
     1170       
     1171    def OnFormVol(event):
     1172        try:
     1173            value = float(formVol.GetValue())
     1174            if value <= 0.0:
     1175                raise ValueError
     1176        except ValueError:
     1177            value = data['Form Vol']
     1178        data['Form Vol'] = value
     1179        UpdatePDFGrid(self,data)
     1180       
     1181    def OnDiameter(event):
     1182        try:
     1183            value = float(diam.GetValue())
     1184            if value <= 0.0:
     1185                raise ValueError
     1186        except ValueError:
     1187            value = data['Diam']
     1188        data['Diam'] = value
     1189        UpdatePDFGrid(self,data)
     1190       
     1191    def OnPacking(event):
     1192        try:
     1193            value = float(pack.GetValue())
     1194            if value <= 0.0:
     1195                raise ValueError
     1196        except ValueError:
     1197            value = data['Pack']
     1198        data['Pack'] = value
     1199        UpdatePDFGrid(self,data)
     1200               
     1201
     1202    def GetFileList(fileType,skip=None):
     1203        fileList = [] #[[False,'',0]]
     1204        Source = ''
     1205        id, cookie = self.PatternTree.GetFirstChild(self.root)
     1206        while id:
     1207            name = self.PatternTree.GetItemText(id)
     1208            if fileType in name:
     1209                if id == skip:
     1210                    Source = name
     1211                else:
     1212                    fileList.append([False,name,id])
     1213            id, cookie = self.PatternTree.GetNextChild(self.root, cookie)
     1214        if skip:
     1215            return fileList,Source
     1216        else:
     1217            return fileList
     1218       
     1219    def OnCopyPDFControls(event):
     1220        import copy
     1221        TextList,Source = GetFileList('PDF',skip=self.PatternId)
     1222        if not len(TextList):
     1223            self.ErrorDialog('Nothing to copy controls to','There must be more than one "PDF" pattern')
     1224            return
     1225        dlg = self.CopyDialog(self,'Copy PDF controls','Copy controls from '+Source+' to:',TextList)
     1226        try:
     1227            if dlg.ShowModal() == wx.ID_OK:
     1228                result = dlg.GetData()
     1229                for i,item in enumerate(result):
     1230                    ifcopy,name,id = item
     1231                    if ifcopy:
     1232                        olddata = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,id, 'PDF Controls'))
     1233                        sample = olddata['Sample']
     1234                        olddata.update(data)
     1235                        olddata['Sample'] = sample
     1236                        self.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(self,id, 'PDF Controls'),olddata)
     1237        finally:
     1238            dlg.Destroy()
     1239               
     1240    def OnSavePDFControls(event):
     1241        print 'save PDF controls?'
     1242       
     1243    def OnLoadPDFControls(event):
     1244        print 'Load PDF controls?'
     1245       
     1246    def OnAddElement(event):
     1247        ElList = data['ElList']
     1248        PE = G2elem.PickElement(self,oneOnly=True)
     1249        if PE.ShowModal() == wx.ID_OK:
     1250            El = PE.Elem
     1251            if El not in ElList:
     1252                ElemSym = El.strip().upper()               
     1253                FpMu = G2elem.FPcalc(G2elem.GetXsectionCoeff(ElemSym), keV)
     1254                ElData = G2elem.GetFormFactorCoeff(ElemSym)[0]
     1255                ElData['FormulaNo'] = 0.0
     1256                ElData.update(G2elem.GetAtomInfo(ElemSym))
     1257                ElData.update(dict(zip(['fp','fpp','mu'],FpMu)))
     1258                data['ElList'][El] = ElData
     1259            data['Form Vol'] = max(10.0,SumElementVolumes())
     1260        PE.Destroy()
     1261        UpdatePDFGrid(self,data)
     1262       
     1263    def OnDeleteElement(event):
     1264        print 'Delete element'
     1265       
     1266    def OnComputePDF(event):
     1267        xydata = {}
     1268        for key in ['Sample','Sample Bkg.','Container','Container Bkg.']:
     1269            name = data[key]['Name']
     1270            if name:
     1271                xydata[key] = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,self.root,name))
     1272        SofQ,GofR = G2pk.ComputePDF(data,xydata)
     1273        if SofQ:
     1274            self.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(self,self.PatternId,'S(Q)'+dataFile[4:]),SofQ)
     1275            G2plt.PlotSofQ(self,newPlot=True)
     1276        if GofR:
     1277            self.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(self,self.PatternId,'G(R)'+dataFile[4:]),GofR)
     1278            G2plt.PlotGofR(self,newPlot=True)
     1279       
     1280    def OnComputeAllPDF(event):
     1281        print 'doing all PDFs here'
     1282       
     1283    def OnShowTip(self,tip):
     1284        print tip
     1285   
     1286               
     1287    if self.dataDisplay:
     1288        self.dataFrame.Clear()
     1289    self.dataFrame.SetMenuBar(self.dataFrame.PDFMenu)
     1290    if not self.dataFrame.GetStatusBar():
     1291        Status = self.dataFrame.CreateStatusBar()   
     1292    self.dataDisplay = wx.Panel(self.dataFrame)
     1293    self.dataFrame.Bind(wx.EVT_MENU, OnCopyPDFControls, id=G2gd.wxID_PDFCOPYCONTROLS)
     1294    self.dataFrame.Bind(wx.EVT_MENU, OnSavePDFControls, id=G2gd.wxID_PDFSAVECONTROLS)
     1295    self.dataFrame.Bind(wx.EVT_MENU, OnLoadPDFControls, id=G2gd.wxID_PDFLOADCONTROLS)
     1296    self.dataFrame.Bind(wx.EVT_MENU, OnAddElement, id=G2gd.wxID_PDFADDELEMENT)
     1297    self.dataFrame.Bind(wx.EVT_MENU, OnDeleteElement, id=G2gd.wxID_PDFDELELEMENT)
     1298    self.dataFrame.Bind(wx.EVT_MENU, OnComputePDF, id=G2gd.wxID_PDFCOMPUTE)
     1299    self.dataFrame.Bind(wx.EVT_MENU, OnComputeAllPDF, id=G2gd.wxID_PDFCOMPUTEALL)
     1300    mainSizer = wx.BoxSizer(wx.VERTICAL)
     1301    mainSizer.Add(wx.StaticText(parent=self.dataDisplay,label=' PDF data files: '),0,wx.ALIGN_CENTER_VERTICAL)
     1302    mainSizer.Add((5,5),0)
     1303    str = ' Sample file: PWDR %s   Wavelength, A: %.5f  Energy, keV: %.3f  Polariz.: %.2f '%(dataFile[3:],wave,keV,polariz)
     1304    mainSizer.Add(wx.StaticText(parent=self.dataDisplay,label=str),0,wx.ALIGN_CENTER_VERTICAL)
     1305    mainSizer.Add((5,5),0)
     1306    fileSizer = wx.FlexGridSizer(3,6,5,1)
     1307    for key in ['Sample Bkg.','Container','Container Bkg.']:
     1308        FillFileSizer(fileSizer,key)
     1309    mainSizer.Add(fileSizer,0)
     1310    mainSizer.Add((5,5),0)
     1311    mainSizer.Add(wx.StaticText(self.dataDisplay,label=' Sample information: '),0,wx.ALIGN_CENTER_VERTICAL)
     1312    mainSizer.Add((5,5),0)   
     1313
     1314    ElList = data['ElList']
     1315    Abs = G2lat.CellAbsorption(ElList,data['Form Vol'])
     1316    Trans = G2pk.Transmission(data['Geometry'],Abs*data['Pack'],data['Diam'])
     1317    elemSizer = wx.FlexGridSizer(3,3,5,1)
     1318    for El in ElList:
     1319        FillElemSizer(elemSizer,ElList[El])
     1320    mainSizer.Add(elemSizer,0)
     1321    mainSizer.Add((5,5),0)   
     1322    midSizer = wx.BoxSizer(wx.HORIZONTAL)
     1323    midSizer.Add(wx.StaticText(self.dataDisplay,label=' Formula volume: '),0,wx.ALIGN_CENTER_VERTICAL)
     1324    formVol = wx.TextCtrl(self.dataDisplay,value='%.2f'%(data['Form Vol']))
     1325    formVol.Bind(wx.EVT_TEXT_ENTER,OnFormVol)       
     1326    formVol.Bind(wx.EVT_KILL_FOCUS,OnFormVol)
     1327    midSizer.Add(formVol,0)
     1328    midSizer.Add(wx.StaticText(self.dataDisplay,
     1329        label=' Theoretical absorption: %.4f cm-1 Sample absorption: %.4f cm-1'%(Abs,Abs*data['Pack'])),
     1330        0,wx.ALIGN_CENTER_VERTICAL)
     1331    mainSizer.Add(midSizer,0)
     1332    mainSizer.Add((5,5),0)   
     1333
     1334    geoBox = wx.BoxSizer(wx.HORIZONTAL)
     1335    geoBox.Add(wx.StaticText(self.dataDisplay,label=' Sample geometry: '),0,wx.ALIGN_CENTER_VERTICAL)
     1336    choice = ['Cylinder','Bragg-Brentano','Tilting Flat Plate in transmission','Fixed flat plate']
     1337    geometry = wx.ComboBox(self.dataDisplay,value=data['Geometry'],choices=choice,
     1338            style=wx.CB_READONLY|wx.CB_DROPDOWN)
     1339    geometry.Bind(wx.EVT_COMBOBOX, OnGeometry)
     1340    geoBox.Add(geometry,0)
     1341    geoBox.Add(wx.StaticText(self.dataDisplay,label=' Sample diameter/thickness, mm: '),0,wx.ALIGN_CENTER_VERTICAL)
     1342    diam = wx.TextCtrl(self.dataDisplay,value='%.2f'%(data['Diam']))
     1343    diam.Bind(wx.EVT_TEXT_ENTER,OnDiameter)       
     1344    diam.Bind(wx.EVT_KILL_FOCUS,OnDiameter)
     1345#    diam.Bind(wx.EVT_SET_FOCUS,OnShowTip(self,'tip')) #this doesn't work - what would????
     1346    geoBox.Add(diam,0)
     1347    mainSizer.Add(geoBox,0)
     1348    mainSizer.Add((5,5),0)   
     1349    geoBox = wx.BoxSizer(wx.HORIZONTAL)
     1350    geoBox.Add(wx.StaticText(self.dataDisplay,label=' Packing: '),0,wx.ALIGN_CENTER_VERTICAL)
     1351    pack = wx.TextCtrl(self.dataDisplay,value='%.2f'%(data['Pack']))
     1352    pack.Bind(wx.EVT_TEXT_ENTER,OnPacking)       
     1353    pack.Bind(wx.EVT_KILL_FOCUS,OnPacking)
     1354    geoBox.Add(pack,0)
     1355    geoBox.Add(wx.StaticText(self.dataDisplay,label=' Sample transmission: %.3f %%'%(Trans)),0,wx.ALIGN_CENTER_VERTICAL)   
     1356    mainSizer.Add(geoBox,0)
     1357    mainSizer.Add((5,5),0)   
     1358       
     1359    mainSizer.Add(wx.StaticText(parent=self.dataDisplay,label=' S(Q) corrections: '),0,wx.ALIGN_CENTER_VERTICAL)
     1360    mainSizer.Add((5,5),0)
     1361   
     1362   
     1363   
     1364    mainSizer.Layout()   
     1365    self.dataDisplay.SetSizer(mainSizer)
     1366    Size = mainSizer.Fit(self.dataFrame)
     1367    self.dataDisplay.SetSize(Size)
     1368    self.dataFrame.setSizePosLeft(Size)
     1369   
Note: See TracChangeset for help on using the changeset viewer.