Changeset 5072


Ignore:
Timestamp:
Nov 10, 2021 12:55:45 PM (7 months ago)
Author:
toby
Message:

cleanup indexing of phases/hists

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIconstrGUI.py

    r5070 r5072  
    15291529    #     dlg.Destroy()
    15301530    #     return
    1531     if Histograms and Phases:
    1532         G2obj.IndexAllIds(Histograms,Phases)
    15331531    # for p in Phases:
    15341532    #     if 'ISODISTORT' in Phases[p] and 'G2VarList' in Phases[p]['ISODISTORT']:
  • trunk/GSASIIdataGUI.py

    r5071 r5072  
    11141114                if h.startswith('HKLF ') and h not in usedHKLFhists:
    11151115                    usedHKLFhists.append(h)
    1116                    
    1117                    
     1116                     
    11181117        rdlist = self.OnImportGeneric(reqrdr,self.ImportPhaseReaderlist,
    11191118            'phase',usedRanIdList=phaseRIdList)
     
    11931192        TextList = PWDRlist + HKLFlist
    11941193        if not TextList:
     1194            Histograms,Phases = self.GetUsedHistogramsAndPhasesfromTree() # reindex
    11951195            return          #no histograms
    11961196        header = 'Select histogram(s) to add to new phase(s):'
     
    12011201        while notOK:
    12021202            result = G2G.ItemSelector(TextList,self,header,header='Add histogram(s)',multiple=True)
    1203             if not result: return
     1203            if not result:
     1204                Histograms,Phases = self.GetUsedHistogramsAndPhasesfromTree() # reindex
     1205                return
    12041206            # check that selected single crystal histograms are not already in use!
    12051207            used = [TextList[i] for i in result if TextList[i] in usedHKLFhists]
     
    12691271                else:
    12701272                    raise Exception('Unexpected histogram '+histoName)
     1273        Histograms,Phases = self.GetUsedHistogramsAndPhasesfromTree() # reindex
    12711274        wx.EndBusyCursor()
    12721275        self.EnableRefineCommand()
     
    14451448                        else:
    14461449                            ref[3] = 0
     1450        Histograms,Phases = self.GetUsedHistogramsAndPhasesfromTree() # reindex
    14471451        wx.EndBusyCursor()
    14481452        self.EnableRefineCommand()       
     
    20432047                    GetGPXtreeItemId(self,Id,'Reflection Lists'))
    20442048                refList[generalData['Name']] = []
     2049        Histograms,Phases = self.GetUsedHistogramsAndPhasesfromTree() # reindex
    20452050        self.EnableRefineCommand()
    20462051        return # success
     
    22302235        Controls['max cyc'] = 0
    22312236        self.EnableRefineCommand()
     2237        Histograms,Phases = self.GetUsedHistogramsAndPhasesfromTree() # reindex
    22322238        return # success
    22332239
     
    51315137            if not len(Phases) or not len(Histograms):
    51325138                print('No constraints processing without phases and histograms defined')
    5133                 raise G2mv.ConstraintException               
    5134             G2obj.IndexAllIds(Histograms,Phases)
     5139                raise G2mv.ConstraintException
    51355140            sub = GetGPXtreeItemId(self,self.root,'Constraints')
    51365141            Constraints = self.GPXtree.GetItemPyData(sub)
  • trunk/GSASIIobj.py

    r5071 r5072  
    15841584    element each atom record.
    15851585
    1586     This is called in three places (only): :func:`GSASIIstrIO.GetUsedHistogramsAndPhases`
    1587     (which loads the histograms and phases from a GPX file),
    1588     :meth:`~GSASIIdataGUI.GSASII.GetUsedHistogramsAndPhasesfromTree`
    1589     (which loads the histograms and phases from the data tree.) and
    1590     :meth:`GSASIIconstrGUI.UpdateConstraints`
    1591     (which displays & edits the constraints in a GUI)
    1592 
     1586    This is called when phases & histograms are looked up
     1587    in these places (only):
     1588       
     1589     * :func:`GSASIIstrIO.GetUsedHistogramsAndPhases` (which loads the histograms and phases from a GPX file),
     1590     * :meth:`~GSASIIdataGUI.GSASII.GetUsedHistogramsAndPhasesfromTree` (which does the same thing but from the data tree.)
     1591     * :meth:`~GSASIIdataGUI.GSASII.OnFileClose` (clears out an old project)
     1592   
     1593    Note that globals :data:`PhaseIdLookup` and :data:`PhaseRanIdLookup` are
     1594    also set in :func:`AddPhase2Index` to temporarily assign a phase number
     1595    as a phase is being imported.
     1596 
    15931597    TODO: do we need a lookup for rigid body variables?
    15941598    '''
     
    16531657    maxph = -1
    16541658    for r in PhaseRanIdLookup:
    1655         maxph = max(maxph,PhaseRanIdLookup[r])
     1659        maxph = max(maxph,int(PhaseRanIdLookup[r]))
    16561660    PhaseRanIdLookup[ranId] = pId = str(maxph + 1)
    16571661    PhaseIdLookup[pId] = (ph,ranId)
  • trunk/GSASIIphsGUI.py

    r5071 r5072  
    44354435    def OnShowIsoDistortCalc(event):
    44364436        Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree()
    4437         if Histograms and Phases:
    4438             G2obj.IndexAllIds(Histograms,Phases)
    44394437        G2cnstG.ShowIsoDistortCalc(G2frame,data['General']['Name'])
    44404438
    44414439    def OnShowIsoModes(event):
    44424440        Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree()
    4443         if Histograms and Phases:
    4444             G2obj.IndexAllIds(Histograms,Phases)
    44454441        #import imp
    44464442        #imp.reload(G2cnstG)
Note: See TracChangeset for help on using the changeset viewer.