Changeset 271


Ignore:
Timestamp:
Apr 28, 2011 1:11:32 PM (13 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

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r267 r271  
    252252        self.dirname = ''
    253253        self.undofile = ''
    254         self.Offset = 0.0
     254        self.Offset = [0.0,0.0]
    255255        self.Weight = False
    256256        self.IparmName = ''
     
    544544            mainSizer.Add(topLabl,0,wx.ALIGN_CENTER_VERTICAL|wx.LEFT,10)
    545545            mainSizer.Add((10,10),1)
    546             dataGridSizer = wx.FlexGridSizer(rows=len(data),cols=2,hgap=2,vgap=2)
     546            ncols = len(data)/40+1
     547            dataGridSizer = wx.FlexGridSizer(rows=len(data),cols=ncols,hgap=2,vgap=2)
    547548            for id,item in enumerate(self.data):
    548549                ckbox = wx.CheckBox(panel,id,item[1])
     
    583584           
    584585        def GetData(self):
    585                 return self.data
     586            return self.data
    586587       
    587588    class SumDialog(wx.Dialog):
     
    10131014                    while item and not Id:
    10141015                        name = self.PatternTree.GetItemText(item)
    1015                         if name[:4] in ['PWDR','HKLF','IMG','PDF']:
     1016                        if name[:4] in ['PWDR','HKLF','IMG ','PDF ']:
    10161017                            Id = item
    10171018                        elif name == 'Controls':
     
    12341235       
    12351236    def OnExportPDF(self,event):
     1237        #need S(Q) and G(R) to be saved here - probably best from selection?
    12361238        event.Skip()
    12371239       
     
    12811283                        self.PatternTree.SetItemPyData(self.PatternTree.AppendItem(Id,text='F(Q)'+PWDRname),[])       
    12821284                        self.PatternTree.SetItemPyData(self.PatternTree.AppendItem(Id,text='G(R)'+PWDRname),[])       
     1285                self.ExportPDF.Enable(True)
    12831286            finally:
    12841287                dlg.Destroy()
  • trunk/GSASIIgrid.py

    r265 r271  
    750750        elif 'PDF' in self.PatternTree.GetItemText(item):
    751751            self.PatternId = item
     752            self.ExportPDF.Enable(True)
    752753            G2plt.PlotISFG(self,type='S(Q)')
    753754           
  • trunk/GSASIIimage.py

    r268 r271  
    593593                tax = np.where(tax < LRazm[0],tax+360.,tax)
    594594                NST,H0 = h2d.histogram2d(len(tax),tax,tay,taz,numAzms,numChans,LRazm,LUtth,Dazm,Dtth,NST,H0)
     595                print 'block done'
    595596                del tax,tay,taz
    596597                Nup += 1
  • trunk/GSASIIimgGUI.py

    r268 r271  
    231231    def OnIntegrateAll(event):
    232232        print 'integrate all'
    233         TextList = []
     233        TextList = [[False,'All IMG',0]]
    234234        Names = []
    235235        if self.PatternTree.GetCount():
     
    241241                    TextList.append([False,name,id])
    242242                id, cookie = self.PatternTree.GetNextChild(self.root, cookie)
    243             if not len(TextList):
     243            if len(TextList) == 1:
    244244                self.ErrorDialog('Nothing to integrate','There must some "IMG" patterns')
    245245                return
     
    248248                if dlg.ShowModal() == wx.ID_OK:
    249249                    result = dlg.GetData()
     250                    if result[0][0]:                    #the 'All IMG' is True
     251                        result = TextList[1:]
     252                        for item in result: item[0] = True
    250253                    for item in result:
    251254                        ifintegrate,name,id = item
     
    272275    def OnCopyControls(event):
    273276        import copy
    274         TextList = []
     277        TextList = [[False,'All IMG',0]]
    275278        Names = []
    276279        if self.PatternTree.GetCount():
     
    291294                        TextList.append([False,name,id])
    292295                id, cookie = self.PatternTree.GetNextChild(self.root, cookie)
    293             if not len(TextList):
     296            if len(TextList) == 1:
    294297                self.ErrorDialog('Nothing to copy controls to','There must be more than one "IMG" pattern')
    295298                return
     
    298301                if dlg.ShowModal() == wx.ID_OK:
    299302                    result = dlg.GetData()
     303                    if result[0][0]:
     304                        result = TextList[1:]
     305                        for item in result: item[0] = True
    300306                    for i,item in enumerate(result):
    301307                        ifcopy,name,id = item
     
    321327                File = open(filename,'w')
    322328                save = {}
    323                 keys = ['type','wavelength','calibrant','distance','center','tilt','rotation','azmthOff']
     329                keys = ['type','wavelength','calibrant','distance','center',
     330                    'tilt','rotation','azmthOff','fullIntegrate','LRazimuth',
     331                    'IOtth','outAzimuths']
    324332                for key in keys:
    325333                    File.write(key+':'+str(data[key])+'\n')
     
    348356                    elif key in ['wavelength','distance','tilt','rotation']:
    349357                        save[key] = float(val)
    350                     elif key in ['center',]:
    351                         vals = val.strip('[] ').split()
     358                    elif key in ['fullIntegrate',]:
     359                        save[key] = bool(val)
     360                    elif key in ['outAzimuths',]:
     361                        save[key] = int(val)
     362                    elif key in ['LRazimuth',]:
     363                        if ',' in val:
     364                            vals = val.strip('[] ').split(',')
     365                        else:
     366                            vals = val.strip('[] ').split()
     367                        save[key] = [int(vals[0]),int(vals[1])]                   
     368                    elif key in ['center','IOtth']:
     369                        if ',' in val:
     370                            vals = val.strip('[] ').split(',')
     371                        else:
     372                            vals = val.strip('[] ').split()
    352373                        save[key] = [float(vals[0]),float(vals[1])]                   
    353374                    S = File.readline()
    354375                data.update(save)
    355                 calSel.SetValue(data['calibrant'])
    356                 waveSel.SetValue("%6.5f" % (data['wavelength']))
    357                 cent = data['center']
    358                 centText.SetValue(("%8.3f,%8.3f" % (cent[0],cent[1])))
    359                 distSel.SetValue("%8.3f"%(data['distance']))
    360                 tiltSel.SetValue("%9.3f"%(data['tilt']))           
    361                 rotSel.SetValue("%9.3f"%(data['rotation']))
     376                UpdateImageControls(self,data,masks)           
     377                G2plt.PlotExposedImage(self,event=event)
     378               
    362379                File.close()
    363380        finally:
  • 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'])
  • trunk/GSASIIpwd.py

    r269 r271  
    44# $Author: vondreele $
    55# $Revision: 267 $
    6 # $URL: https://subversion.xor.aps.anl.gov/pyGSAS/trunk/GSASIIpeak.py $
    7 # $Id: GSASIIpeak.py 267 2011-04-20 18:09:53Z vondreele $
     6# $URL: https://subversion.xor.aps.anl.gov/pyGSAS/trunk/GSASIIpwd.py $
     7# $Id: GSASIIpwd.py 267 2011-04-20 18:09:53Z vondreele $
    88########### SVN repository information ###################
    99import sys
     
    184184    return 1.0/((1.0+dlam/RulCoff)*(1.0+(np.pi*dlam_c/(dlam+RulCoff))**2))
    185185   
     186def LorchWeight(Q):
     187    return np.sin(np.pi*(Q[-1]-Q)/(2.0*Q[-1]))
     188   
    186189def lambdaCompton(DetType,wave,Q):
    187190    hmc = 0.024262734687
     
    210213        CF += cf*el['FormulaNo']/sumNoAtoms
    211214    return FF2,FF**2,CF
     215   
     216def GetNumDensity(ElList,Vol):
     217    sumNoAtoms = 0.0
     218    for El in ElList:
     219        sumNoAtoms += ElList[El]['FormulaNo']
     220    return sumNoAtoms/Vol
    212221           
    213222def MultGetQ(Tth,MuT,Geometry,b=88.0,a=0.01):
     
    710719    xydata['SofQ'][1][1] -= CF
    711720    xydata['SofQ'][1][1] = xydata['SofQ'][1][1]/SqFF
    712    
    713 
     721    scale = len(xydata['SofQ'][1][1][minQ:maxQ])/np.sum(xydata['SofQ'][1][1][minQ:maxQ])
     722    xydata['SofQ'][1][1] *= scale
     723   
    714724    xydata['FofQ'] = copy.deepcopy(xydata['SofQ'])
    715725    xydata['FofQ'][1][1] = xydata['FofQ'][1][0]*(xydata['SofQ'][1][1]-1.0)
    716     xydata['FofQ'][1][1] *= np.sin(np.pi*(qLimits[1]-Q)/(2.0*qLimits[1]))
     726    if data['Lorch']:
     727        xydata['FofQ'][1][1] *= LorchWeight(Q)
    717728   
    718729    xydata['GofR'] = copy.deepcopy(xydata['FofQ'])
  • trunk/GSASIIpwdGUI.py

    r270 r271  
    10771077
    10781078def UpdatePDFGrid(self,data):
     1079    global inst
    10791080    tth2q = lambda t,w:4.0*math.pi*sind(t/2.0)/w
    10801081    dataFile = self.PatternTree.GetItemText(self.PatternId)
     
    11481149            sumVol += Avol*ElList[El]['FormulaNo']
    11491150        return sumVol
     1151        auxPlot = ComputePDF(data)
     1152        G2plt.PlotISFG(self,newPlot=False)       
    11501153       
    11511154    def FillElemSizer(elemSizer,ElData):
     
    11611164            formVol.SetValue('%.2f'%(data['Form Vol']))
    11621165            UpdatePDFGrid(self,data)
     1166            auxPlot = ComputePDF(data)
     1167            G2plt.PlotISFG(self,newPlot=False)       
    11631168       
    11641169        elemSizer.Add(wx.StaticText(parent=self.dataDisplay,
     
    11751180        data['Geometry'] = geometry.GetValue()
    11761181        UpdatePDFGrid(self,data)
     1182        auxPlot = ComputePDF(data)
     1183        G2plt.PlotISFG(self,newPlot=False)       
    11771184       
    11781185    def OnDetType(event):
    11791186        data['DetType'] = detType.GetValue()
    11801187        UpdatePDFGrid(self,data)
     1188        auxPlot = ComputePDF(data)
     1189        G2plt.PlotISFG(self,newPlot=False)       
    11811190       
    11821191    def OnFormVol(event):
     
    11901199        UpdatePDFGrid(self,data)
    11911200        auxPlot = ComputePDF(data)
    1192         G2plt.PlotISFG(self,newPlot=True)       
     1201        G2plt.PlotISFG(self,newPlot=False)       
    11931202       
    11941203    def OnDiameter(event):
     
    12021211        UpdatePDFGrid(self,data)
    12031212        auxPlot = ComputePDF(data)
    1204         G2plt.PlotISFG(self,newPlot=True)       
    1205        
     1213        G2plt.PlotISFG(self,newPlot=False)
     1214       
     1215    def OnPolaVal(event):
     1216        try:
     1217            value = float(polaVal.GetValue())
     1218            if not (0.0 <= value <= 1.0):
     1219                raise ValueError
     1220        except ValueError:
     1221            value = inst['Polariz.']
     1222        inst['Polariz.'] = value
     1223        polaVal.SetValue('%.2f'%(inst['Polariz.']))
     1224        UpdatePDFGrid(self,data)
     1225        auxPlot = ComputePDF(data)
     1226        G2plt.PlotISFG(self,newPlot=False)
     1227               
     1228    def OnAzimVal(event):
     1229        try:
     1230            value = float(azimVal.GetValue())
     1231            if not (0. <= value <= 360.):
     1232                raise ValueError
     1233        except ValueError:
     1234            value = inst['Azimuth']
     1235        inst['Azimuth'] = value
     1236        azimVal.SetValue('%.1f'%(inst['Azimuth']))
     1237        UpdatePDFGrid(self,data)
     1238        auxPlot = ComputePDF(data)
     1239        G2plt.PlotISFG(self,newPlot=False)
     1240                       
    12061241    def OnObliqCoeff(event):
    12071242        try:
     
    12161251        obliqCoeff.SetValue('%.3f'%(value))
    12171252        auxPlot = ComputePDF(data)
    1218         G2plt.PlotISFG(self,newPlot=True)
     1253        G2plt.PlotISFG(self,newPlot=False)
    12191254       
    12201255    def OnRulandWdt(event):
     
    12301265        rulandWdt.SetValue('%.3f'%(value))
    12311266        auxPlot = ComputePDF(data)
    1232         G2plt.PlotISFG(self,newPlot=True)
     1267        G2plt.PlotISFG(self,newPlot=False)
    12331268       
    12341269    def OnLorch(event):
    12351270        data['Lorch'] = lorch.GetValue()
    12361271        auxPlot = ComputePDF(data)
    1237         G2plt.PlotISFG(self,newPlot=True)       
    1238                
    1239        
     1272        G2plt.PlotISFG(self,newPlot=False)       
     1273                       
    12401274    def OnPacking(event):
    12411275        try:
     
    12471281        data['Pack'] = value
    12481282        UpdatePDFGrid(self,data)
    1249         G2plt.PlotISFG(self,newPlot=True)       
     1283        G2plt.PlotISFG(self,newPlot=False)       
    12501284               
    12511285    def OnSQmin(event):
     
    12591293        SQmin.SetValue('%.1f'%(value))
    12601294        auxPlot = ComputePDF(data)
     1295        G2plt.PlotISFG(self,newPlot=True)       
    12611296       
    12621297    def OnSQmax(event):
     
    12681303            value = min(qLimits[1],data['QScaleLim'][1])
    12691304        data['QScaleLim'][1] = value
     1305        if value < data['QScaleLim'][0]:
     1306            data['QScaleLim'][0] = 0.90*value
     1307            SQmin.SetValue('%.1f'%(data['QScaleLim'][0]))
    12701308        SQmax.SetValue('%.1f'%(value))
    12711309        auxPlot = ComputePDF(data)
     
    13001338        import copy
    13011339        TextList,Source = GetFileList('PDF',skip=self.PatternId)
     1340        TextList[0] = [False,'All PDF',0]
    13021341        if len(TextList) == 1:
    13031342            self.ErrorDialog('Nothing to copy controls to','There must be more than one "PDF" pattern')
    13041343            return
    1305         dlg = self.CopyDialog(self,'Copy PDF controls','Copy controls from '+Source+' to:',TextList[1:])
     1344        dlg = self.CopyDialog(self,'Copy PDF controls','Copy controls from '+Source+' to:',TextList)
    13061345        try:
    13071346            if dlg.ShowModal() == wx.ID_OK:
    13081347                result = dlg.GetData()
     1348                if result[0][0]:
     1349                    result = TextList[1:]
     1350                    for item in result: item[0] = True
    13091351                for i,item in enumerate(result):
    13101352                    ifcopy,name,id = item
     
    13151357                        olddata['Sample'] = sample
    13161358                        self.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(self,id, 'PDF Controls'),olddata)
     1359                Status.SetStatusText('PDF controls copied')
    13171360        finally:
    13181361            dlg.Destroy()
     
    13731416        print 'Calculating PDF:'
    13741417        auxPlot = ComputePDF(data)
     1418        Status.SetStatusText('PDF computed')
    13751419        for plot in auxPlot:
    13761420            G2plt.PlotXY(self,plot[:2],type=plot[2])
     
    13911435                    auxPlot = ComputePDF(Data)                   
    13921436                id, cookie = self.PatternTree.GetNextChild(self.root, cookie)
     1437            Status.SetStatusText('All PDFs computed')
    13931438            G2plt.PlotISFG(self,newPlot=True,type='G(R)')
    13941439       
    13951440    def OnShowTip(self,tip):
    1396         print tip
    1397    
     1441        print tip   
    13981442               
    13991443    if self.dataDisplay:
     
    14151459    str = ' Sample file: PWDR %s   Wavelength, A: %.5f  Energy, keV: %.3f  Polariz.: %.2f '%(dataFile[3:],wave,keV,polariz)
    14161460    mainSizer.Add(wx.StaticText(parent=self.dataDisplay,label=str),0,wx.ALIGN_CENTER_VERTICAL)
     1461#    dataSizer = wx.BoxSizer(wx.HORIZONTAL)
     1462#    dataSizer.Add(wx.StaticText(parent=self.dataDisplay,label='Azimuth'),0,wx.ALIGN_CENTER_VERTICAL)
     1463#    azimVal = wx.TextCtrl(self.dataDisplay,value='%.2f'%(inst['Azimuth']))
     1464#    azimVal.Bind(wx.EVT_TEXT_ENTER,OnAzimVal)       
     1465#    azimVal.Bind(wx.EVT_KILL_FOCUS,OnAzimVal)
     1466#    dataSizer.Add(azimVal,0)   
     1467#    dataSizer.Add(wx.StaticText(parent=self.dataDisplay,label='Polarization'),0,wx.ALIGN_CENTER_VERTICAL)
     1468#    polaVal = wx.TextCtrl(self.dataDisplay,value='%.2f'%(inst['Polariz.']))
     1469#    polaVal.Bind(wx.EVT_TEXT_ENTER,OnPolaVal)       
     1470#    polaVal.Bind(wx.EVT_KILL_FOCUS,OnPolaVal)
     1471#    dataSizer.Add(polaVal,0)   
     1472#    mainSizer.Add(dataSizer,0)
    14171473    mainSizer.Add((5,5),0)
    14181474    fileSizer = wx.FlexGridSizer(3,6,5,1)
  • trunk/fsource/histogram2d.for

    r248 r271  
    3131      REAL*8      DX,DY
    3232
    33 
    34       DO K=0,N
     33      DO K=0,N-1
    3534        IF ( ( X(K) .GE. XLIM(0) .AND. X(K) .LE. XLIM(1)) .AND.
    3635     1    (Y(K) .GE. YLIM(0) .AND. Y(K). LE. YLIM(1)) ) THEN
    37           I = INT((X(K)-XLIM(0))/DX)
    38           J = INT((Y(K)-YLIM(0))/DY)
     36          I = NINT((X(K)-XLIM(0))/DX)
     37          J = NINT((Y(K)-YLIM(0))/DY)
    3938          IF ( (I .GE. 0 .AND. I .LT. NXBINS) .AND.
    4039     1       (J .GE. 0 .AND. J .LT. NYBINS) ) THEN
Note: See TracChangeset for help on using the changeset viewer.