Ignore:
Timestamp:
Apr 21, 2019 10:05:23 PM (3 years ago)
Author:
toby
Message:

Update Rietveld cycle-by-cycle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r3909 r3913  
    38803880            self.GPXtree.Expand(Id)
    38813881            SelectDataTreeItem(self,Id)
     3882            self.GPXtree.SelectItem(Id)  # needed on OSX or item is not selected in tree; perhaps not needed elsewhere
    38823883        elif phaseId:
    38833884            SelectDataTreeItem(self,phaseId)
     3885            self.GPXtree.SelectItem(phaseId) # as before for OSX
    38843886        self.CheckNotebook()
    38853887        if self.dirname: os.chdir(self.dirname)           # to get Mac/Linux to change directory!
     
    45554557            return
    45564558        if warnmsg:
    4557             print('Conflict between refinment flag settings and constraints:\n'+
     4559            print('Conflict between refinement flag settings and constraints:\n'+
    45584560                warnmsg+'\nRefinement not possible')
    45594561            self.ErrorDialog('Refinement Flag Error',
     
    45714573        self.SaveTreeSetting() # save the current tree selection
    45724574        self.GPXtree.SaveExposedItems()             # save the exposed/hidden tree items
     4575        refPlotUpdate = G2plt.PlotPatterns(self,refineMode=True) # prepare for plot updating
    45734576        try:
    4574             OK,Msg = G2stMn.Refine(self.GSASprojectfile,dlg)    #Msg is Rvals dict if Ok=True
     4577            OK,Msg = G2stMn.Refine(self.GSASprojectfile,dlg,refPlotUpdate=refPlotUpdate)    #Msg is Rvals dict if Ok=True
    45754578        finally:
    45764579            dlg.Update(101.) # forces the Auto_Hide; needed after move w/Win & wx3.0
     
    45894592            try:
    45904593                if dlg2.ShowModal() == wx.ID_OK:
     4594                    if refPlotUpdate: refPlotUpdate({},restore=True)
    45914595                    wx.CallAfter(self.reloadFromGPX)
     4596                else:
     4597                    if refPlotUpdate: refPlotUpdate({},restore=True)
    45924598            finally:
    45934599                dlg2.Destroy()
    45944600        else:
    45954601            self.ErrorDialog('Refinement error',Msg)
    4596 
     4602           
    45974603    def reloadFromGPX(self):
    45984604        '''Deletes current data tree & reloads it from GPX file (after a
     
    46444650                try:
    46454651                    win.replotFunction(*win.replotArgs,**win.replotKWargs)
    4646                 except:
     4652                except Exception as msg:
    46474653                    if GSASIIpath.GetConfigValue('debug'):
    4648                         print('Error with args',win.replotArgs,win.replotKWargs)
     4654                        print('Error calling',win.replotFunction,'with args',
     4655                                  win.replotArgs,win.replotKWargs)
     4656                    if GSASIIpath.GetConfigValue('debug'):
     4657                        print(msg)
     4658                        GSASIIpath.IPyBreak()
    46494659        # delete any remaining plots that have not been updated and need a refresh (win.plotRequiresRedraw)
    46504660        for lbl,win in zip(self.G2plotNB.plotList,self.G2plotNB.panelList):
     
    46654675            self.OnRefine(event)
    46664676            return
     4677        plotHist = self.GPXtree.GetItemText(self.PatternId)
    46674678        Id = GetGPXtreeItemId(self,self.root,'Sequential results')
    46684679        if not Id:
     
    46944705            dlg.SetSize((int(Size[0]*1.2),Size[1])) # increase size a bit along x
    46954706        dlg.CenterOnParent()
     4707        # find 1st histogram to be refined
     4708        if 'Seq Data' in Controls:
     4709            histNames = Controls['Seq Data']
     4710        else: # patch from before Controls['Seq Data'] was implemented
     4711            histNames = G2stIO.GetHistogramNames(GPXfile,['PWDR',])
     4712        if Controls.get('Reverse Seq'):
     4713            histNames.reverse()
     4714        # select it
     4715        self.PatternId = GetGPXtreeItemId(self,self.root,histNames[0])       
     4716        refPlotUpdate = G2plt.PlotPatterns(self,refineMode=True) # prepare for plot updating
    46964717        try:
    4697             OK,Msg = G2stMn.SeqRefine(self.GSASprojectfile,dlg,G2plt.SequentialPlotPattern,self)    #Msg is Rvals dict if Ok=True
     4718            OK,Msg = G2stMn.SeqRefine(self.GSASprojectfile,dlg,refPlotUpdate) #Msg is Rvals dict if Ok=True
    46984719        finally:
    46994720            dlg.Update(101.) # forces the Auto_Hide; needed after move w/Win & wx3.0
     
    47044725            try:
    47054726                if dlg.ShowModal() == wx.ID_OK:
     4727                    if refPlotUpdate: refPlotUpdate({},restore=True)
    47064728                    self.PickIdText = None  #force reload of PickId contents
    47074729                    self.GPXtree.DeleteChildren(self.root)
     
    47124734                    self.GPXtree.RestoreExposedItems()
    47134735                    self.ResetPlots()
     4736                    self.PatternId = GetGPXtreeItemId(self,self.root,plotHist)
     4737                    SelectDataTreeItem(self,self.PatternId)
    47144738                    sId = GetGPXtreeItemId(self,self.root,'Sequential results')
    47154739                    SelectDataTreeItem(self,sId)
     4740                    self.GPXtree.SelectItem(sId)
     4741                else:
     4742                    if refPlotUpdate: refPlotUpdate({},restore=True)
    47164743            finally:
    47174744                dlg.Destroy()
Note: See TracChangeset for help on using the changeset viewer.