Changeset 271 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Apr 28, 2011 1:11:32 PM (12 years ago)
Author:
vondreele
Message:

make g77 versions of fortran for binwin2.7 - faster than gfortran!
fix to histogram2d.for
GSASII.py - allow 2D offset in multiplots, fix for large file lists
GSASIIimgGUI.py - more stuff in save/load controls
GSASIIplot.py - 2D offset in multiplots, fix bad behavior in structure drawings
GSASIIpwd.py - more mods to PDF calcs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r268 r271  
    2121import GSASIIgrid as G2gd
    2222import GSASIIimage as G2img
     23import GSASIIpwd as G2pwd
    2324import GSASIIIO as G2IO
    2425import GSASIIpwdGUI as G2pdG
     
    9697        self.status = parent.CreateStatusBar()
    9798        self.status.SetFieldsCount(2)
    98         self.status.SetStatusWidths([125,-1])
     99        self.status.SetStatusWidths([150,-1])
    99100        self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
    100101       
     
    201202        Page.figure.clf()
    202203        Plot = Page.figure.gca()          #get a fresh plot after clf()
    203     except ValueError,error:
     204    except ValueError:
    204205        Plot = self.G2plotNB.addMpl('Structure Factors').gca()
    205206        plotNum = self.G2plotNB.plotList.index('Structure Factors')
     
    337338                self.Weight = True
    338339            print 'plot weighting:',self.Weight
    339         elif event.key == 'l':
     340        elif event.key == 'n':
    340341            if self.Contour:
    341342                pass
     
    344345                    self.logPlot = False
    345346                else:
    346                     self.Offset = 0
     347                    self.Offset[0] = 0
    347348                    self.logPlot = True
    348349        elif event.key == 'u':
     
    351352            elif self.logPlot:
    352353                pass
    353             elif self.Offset < 100.:
    354                 self.Offset += 1.
     354            elif self.Offset[0] < 100.:
     355                self.Offset[0] += 1.
    355356        elif event.key == 'd':
    356357            if self.Contour:
     
    358359            elif self.logPlot:
    359360                pass
    360             elif self.Offset > 0.:
    361                 self.Offset -= 1.
     361            elif self.Offset[0] > 0.:
     362                self.Offset[0] -= 1.
     363        elif event.key == 'l':
     364            self.Offset[1] -= 1.
     365        elif event.key == 'r':
     366            self.Offset[1] += 1.
    362367        elif event.key == 'c':
    363368            newPlot = True
     
    367372                self.Contour = True
    368373                self.SinglePlot = False
    369                 self.Offset = 0
     374                self.Offset = [0.,0.]
    370375        elif event.key == 'q':
    371376            newPlot = True
     
    499504        Page.figure.clf()
    500505        Plot = Page.figure.gca()          #get a fresh plot after clf()
    501     except ValueError,error:
     506    except ValueError:
    502507        newPlot = True
    503508        self.Cmax = 1.0
     
    516521    else:
    517522        if self.logPlot:
    518             Choice = (' key press','l: log(I) off',
     523            Choice = (' key press','n: log(I) off','l: offset left','r: offset right',
    519524                'c: contour on','q: toggle q plot','s: toggle single plot','+: no selection')
    520525        else:
    521             Choice = (' key press','d: offset down','u: offset up','l: log(I) on',
    522                 'c: contour on','q: toggle q plot','s: toggle single plot','+: no selection')
     526            Choice = (' key press','l: offset left','r: offset right','d: offset down',
     527                'u: offset up','n: log(I) on','c: contour on','q: toggle q plot',
     528                's: toggle single plot','+: no selection')
    523529    cb = wx.ComboBox(self.G2plotNB.status,style=wx.CB_DROPDOWN|wx.CB_READONLY,
    524530        choices=Choice)
     
    555561        xye = Pattern[1]
    556562        Ymax = max(Ymax,max(xye[1]))
    557     offset = self.Offset*Ymax/100.0
     563    offset = self.Offset[0]*Ymax/100.0
    558564    Title = 'Powder Patterns: '+os.path.split(self.GSASprojectfile)[1]
    559565    if self.logPlot:
     
    600606                Plot.set_ylabel('Data sequence',fontsize=12)
    601607        else:
    602             X += self.Offset*.01*N
     608            X += self.Offset[1]*.005*N
    603609            if ifpicked:
    604610                Z = xye[3]+offset*N
     
    685691            if self.Contour:
    686692                self.Cmax = min(1.0,self.Cmax*1.2)
    687             elif self.Offset < 100.:
    688                 self.Offset += 1.
     693            elif self.Offset[0] < 100.:
     694                self.Offset[0] += 1.
    689695        elif event.key == 'd':
    690696            if self.Contour:
    691697                self.Cmax = max(0.0,self.Cmax*0.8)
    692             elif self.Offset > 0.:
    693                 self.Offset -= 1.
     698            elif self.Offset[0] > 0.:
     699                self.Offset[0] -= 1.
     700        elif event.key == 'l':
     701            self.Offset[1] -= 1.
     702        elif event.key == 'r':
     703            self.Offset[1] += 1.
    694704        elif event.key == 'c':
    695705            newPlot = True
     
    699709                self.Contour = True
    700710                self.SinglePlot = False
    701                 self.Offset = 0
     711                self.Offset = [0.,0.]
    702712        elif event.key == 's':
    703713            if self.Contour:
     
    763773        Page.figure.clf()
    764774        Plot = Page.figure.gca()
    765     except ValueError,error:
     775    except ValueError:
    766776        newPlot = True
    767777        self.Cmax = 1.0
     
    778788            'i: interpolation method','s: color scheme','c: contour off')
    779789    else:
    780         Choice = (' key press','d: offset down','u: offset up','t: toggle legend',
    781             'c: contour on','s: toggle single plot')
     790        Choice = (' key press','l: offset left','r: offset right','d: offset down',
     791            'u: offset up','t: toggle legend','c: contour on','s: toggle single plot')
    782792    cb = wx.ComboBox(self.G2plotNB.status,style=wx.CB_DROPDOWN|wx.CB_READONLY,
    783793        choices=Choice)
     
    794804    colors=['b','g','r','c','m','k']
    795805    name = self.PatternTree.GetItemText(PatternId)[4:]
    796     G2gd.GetPatternTreeItemId(self,PatternId, 'Instrument Parameters')
    797806    Pattern = []   
    798807    if self.SinglePlot:
     
    816825                    PlotList.append(Pattern)
    817826            item, cookie = self.PatternTree.GetNextChild(self.root, cookie)
     827    PDFdata = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, 'PDF Controls'))
     828    numbDen = G2pwd.GetNumDensity(PDFdata['ElList'],PDFdata['Form Vol'])
     829    Xb = [0.,10.]
     830    Yb = [0.,-40.*np.pi*numbDen]
    818831    Ymax = 1.0
    819832    lenX = 0
     
    821834        xye = Pattern[1]
    822835        Ymax = max(Ymax,max(xye[1]))
    823     offset = self.Offset*Ymax/100.0
     836    offset = self.Offset[0]*Ymax/100.0
    824837    if self.Contour:
    825838        ContourZ = []
     
    842855                Plot.set_ylabel('Data sequence',fontsize=12)
    843856        else:
    844             X = xye[0]+self.Offset*.1*N
     857            X = xye[0]+self.Offset[1]*.005*N
    845858            if ifpicked:
    846859                Plot.plot(X,Y,colors[N%6]+'+',picker=3.,clip_on=False)
     
    852865                    Plot.plot(X,Y,colors[N%6],picker=False)
    853866            if type == 'G(R)':
    854                 Plot.axhline(0.,color=wx.BLACK)
     867                Plot.plot(Xb,Yb,color='k',dashes=(5,5))
    855868            elif type == 'F(Q)':
    856869                Plot.axhline(0.,color=wx.BLACK)
     
    895908        Page.figure.clf()
    896909        Plot = Page.figure.gca()
    897     except ValueError,error:
     910    except ValueError:
    898911        newPlot = True
    899912        Plot = self.G2plotNB.addMpl(type).gca()
     
    948961        Page.figure.clf()
    949962        Plot = Page.figure.gca()
    950     except ValueError,error:
     963    except ValueError:
    951964        Plot = self.G2plotNB.addMpl('Powder Lines').gca()
    952965        plotNum = self.G2plotNB.plotList.index('Powder Lines')
     
    9981011        Page.figure.clf()
    9991012        Plot = Page.figure.gca()
    1000     except ValueError,error:
     1013    except ValueError:
    10011014        Plot = self.G2plotNB.addMpl('Peak Widths').gca()
    10021015        plotNum = self.G2plotNB.plotList.index('Peak Widths')
     
    10801093        Page.figure.clf()
    10811094        Plot = mp3d.Axes3D(Page.figure)
    1082     except ValueError,error:
     1095    except ValueError:
    10831096        Plot = mp3d.Axes3D(self.G2plotNB.add3D('Microstrain'))
    10841097        plotNum = self.G2plotNB.plotList.index('Microstrain')
     
    14081421            Plot = Page.figure.gca()          #get a fresh plot after clf()
    14091422       
    1410     except ValueError,error:
     1423    except ValueError:
    14111424        Plot = self.G2plotNB.addMpl('2D Powder Image').gca()
    14121425        plotNum = self.G2plotNB.plotList.index('2D Powder Image')
     
    15961609        Plot = Page.figure.gca()          #get a fresh plot after clf()
    15971610       
    1598     except ValueError,error:
     1611    except ValueError:
    15991612        Plot = self.G2plotNB.addMpl('2D Integration').gca()
    16001613        plotNum = self.G2plotNB.plotList.index('2D Integration')
     
    16611674        Plot = Page.figure.gca()          #get a fresh plot after clf()
    16621675       
    1663     except ValueError,error:
     1676    except ValueError:
    16641677        Plot = self.G2plotNB.addMpl('2D Transformed Powder Image').gca()
    16651678        plotNum = self.G2plotNB.plotList.index('2D Transformed Powder Image')
     
    18081821                panel[names.index('cameraSlider')].SetValue(drawingData['cameraPos'])
    18091822        Draw()
     1823       
     1824    def getSelection():
     1825        if self.dataDisplay:
     1826            return self.dataDisplay.GetSelection()
     1827        else:
     1828            return 0
    18101829           
    18111830    def SetViewPointText(VP):
    1812         page = self.dataDisplay.GetSelection()
     1831        page = getSelection()
    18131832        if page:
    18141833            if self.dataDisplay.GetPageText(page) == 'Draw Options':
     
    18181837           
    18191838    def ClearSelectedAtoms():
    1820         page = self.dataDisplay.GetSelection()
     1839        page = getSelection()
    18211840        if page:
    18221841            if self.dataDisplay.GetPageText(page) == 'Draw Atoms':
     
    18261845                   
    18271846    def SetSelectedAtoms(ind):
    1828         page = self.dataDisplay.GetSelection()
     1847        page = getSelection()
    18291848        if page:
    18301849            if self.dataDisplay.GetPageText(page) == 'Draw Atoms':
     
    18371856                 
    18381857    def GetSelectedAtoms():
    1839         page = self.dataDisplay.GetSelection()
     1858        page = getSelection()
    18401859        Ind = []
    18411860        if page:
     
    22572276        plotNum = self.G2plotNB.plotList.index(generalData['Name'])
    22582277        Page = self.G2plotNB.nb.GetPage(plotNum)       
    2259     except (ValueError,error):
     2278    except ValueError:
    22602279        Plot = self.G2plotNB.addOgl(generalData['Name'])
    22612280        plotNum = self.G2plotNB.plotList.index(generalData['Name'])
Note: See TracChangeset for help on using the changeset viewer.