Ignore:
Timestamp:
Mar 15, 2019 7:53:57 PM (3 years ago)
Author:
toby
Message:

major speed up with very big sequential fits

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r3848 r3855  
    38163816            else:
    38173817                pth = '.'
     3818            #if GSASIIpath.GetConfigValue('debug'): print('debug: open from '+pth)
    38183819            dlg = wx.FileDialog(self, 'Choose GSAS-II project file', pth,
    38193820                wildcard='GSAS-II project file (*.gpx)|*.gpx',style=wx.FD_OPEN)
     
    38343835        if not filename:
    38353836            GetGPX()
     3837            filename = self.GSASprojectfile
    38363838        else:
    38373839            try:
     
    38783880            self.GPXtree.Expand(Id)
    38793881            SelectDataTreeItem(self,Id)
    3880 #            self.GPXtree.SelectItem(Id)
    38813882        elif phaseId:
    3882 #            self.GPXtree.SelectItem(phaseId)
    38833883            SelectDataTreeItem(self,phaseId)
    38843884        self.CheckNotebook()
     
    43604360                if name[:4] in hType:
    43614361                    HistogramNames.append(name)       
    4362                 item, cookie = self.GPXtree.GetNextChild(self.root, cookie)               
    4363 
     4362                item, cookie = self.GPXtree.GetNextChild(self.root, cookie)
    43644363        return HistogramNames
     4364   
     4365    def GetHistogramNamesID(self,hType):
     4366        """ Returns a list of histogram names found in the GSASII data tree
     4367        and a lookup table of their Id values. Should replace GetHistogramNames
     4368        since that will not be much faster (and there may be real speed gains from
     4369        caching the Ids rather than keep searching for them).
     4370
     4371        N.B routine :func:`GSASIIstrIO.GetHistogramNames` also exists to
     4372        get same info, but from GPX file.
     4373       
     4374        :param str hType: list of histogram types
     4375        :return: list of histogram names and a dict of histogram Ids
     4376           keyed by histogram name.
     4377        """
     4378        HistogramNames = []
     4379        HistogramIds = {}
     4380        if self.GPXtree.GetCount():
     4381            item, cookie = self.GPXtree.GetFirstChild(self.root)
     4382            while item:
     4383                name = self.GPXtree.GetItemText(item)
     4384                if name[:4] in hType:
     4385                    HistogramNames.append(name)       
     4386                    HistogramIds[name] = item
     4387                item, cookie = self.GPXtree.GetNextChild(self.root, cookie)
     4388        return HistogramNames,HistogramIds
    43654389                   
    43664390    def GetUsedHistogramsAndPhasesfromTree(self):
     
    43814405        phaseNames = self.GetPhaseNames()
    43824406        phaseData = self.GetPhaseData()
    4383         histoList = self.GetHistogramNames(['PWDR','HKLF'])
     4407        histoList,histIdList = self.GetHistogramNamesID(['PWDR','HKLF'])
    43844408
    43854409        for phase in phaseData:
     
    43944418                        Phases[phase] = Phase
    43954419                    if hist not in Histograms and Phase['Histograms'][hist]['Use']:
    4396                         item = GetGPXtreeItemId(self,self.root,hist)
     4420                        item = histIdList[hist]
    43974421                        if item:
    43984422                            if 'PWDR' in hist[:4]:
     
    45134537        Called from the Calculate/Refine menu.
    45144538        '''
    4515         G2cnstG.CheckAllScalePhaseFractions(self)
    45164539        if self.testSeqRefineMode():
    45174540            self.OnSeqRefine(event)
    45184541            return
    4519         # Id = GetGPXtreeItemId(self,self.root,'Sequential results')
    4520         # if Id:
    4521         #     dlg = wx.MessageDialog(
    4522         #         self,
    4523         #         'Your last refinement was sequential. Continue with "Refine", removing previous sequential results?',
    4524         #         'Remove sequential results?',wx.OK|wx.CANCEL)
    4525         #     if dlg.ShowModal() == wx.ID_OK:
    4526         #         self.GPXtree.Delete(Id)
    4527         #         dlg.Destroy()
    4528         #     else:
    4529         #         dlg.Destroy()
    4530         #         return
     4542        G2cnstG.CheckAllScalePhaseFractions(self) # can be slow for sequential fits, skip
    45314543        self.OnFileSave(event)
    45324544        # check that constraints are OK here
     
    46404652    def OnSeqRefine(self,event):
    46414653        '''Perform a sequential refinement.
    4642         Called from self.OnRefine (Called from the Calculate/Refine menu)
    4643        
    4644         temporarily called from the Calculate/Sequential refine menu (to be removed)
     4654        Called from self.OnRefine (Which is called from the Calculate/Refine menu)
    46454655        '''
    46464656        seqList = self.testSeqRefineMode()
Note: See TracChangeset for help on using the changeset viewer.