Changeset 5000 for trunk


Ignore:
Timestamp:
Jul 24, 2021 8:55:07 AM (2 months ago)
Author:
toby
Message:

deal with deleting histograms from tree w/sequential fits

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r4989 r5000  
    41594159        item, cookie = self.GPXtree.GetFirstChild(self.root)
    41604160        used = False
     4161        seqUse = False
    41614162        while item:
    41624163            name = self.GPXtree.GetItemText(item)
    4163             if name not in ['Notebook','Controls','Covariance','Constraints',
    4164                 'Restraints','Phases','Rigid bodies'] and 'Sequential' not in name:
    4165                 if 'PWDR' in name[:4]:
    4166                     nItems['PWDR'] += 1
    4167                     if name in Histograms:
    4168                         used = True
    4169                         item, cookie = self.GPXtree.GetNextChild(self.root, cookie)
    4170                         continue
    4171                 if 'SASD' in name[:4]: nItems['SASD'] += 1
    4172                 if 'REFD' in name[:4]: nItems['REFD'] += 1
    4173                 if 'IMG' in name[:3]:  nItems['IMG'] += 1
    4174                 if 'HKLF' in name[:4]:
    4175                     nItems['HKLF'] += 1
    4176                     if name in Histograms:
    4177                         used = True
    4178                         item, cookie = self.GPXtree.GetNextChild(self.root, cookie)
    4179                         continue
    4180                 if 'PDF' in name[:3]:
    4181                     PDFnames.append(name)
    4182                     nItems['PDF'] += 1
    4183                 TextList.append(name)
    41844164            item, cookie = self.GPXtree.GetNextChild(self.root, cookie)
     4165            if name in ['Notebook','Controls','Covariance','Constraints',
     4166                'Restraints','Phases','Rigid bodies','Hist/Phase']:
     4167                continue
     4168            if 'Sequential' in name:
     4169                continue
     4170            if name in self.testSeqRefineMode():
     4171                seqUse = True
     4172                continue
     4173            if 'PWDR' in name[:4]:
     4174                nItems['PWDR'] += 1
     4175                if name in Histograms:
     4176                    used = True
     4177                    continue
     4178            if 'SASD' in name[:4]: nItems['SASD'] += 1
     4179            if 'REFD' in name[:4]: nItems['REFD'] += 1
     4180            if 'IMG' in name[:3]:  nItems['IMG'] += 1
     4181            if 'HKLF' in name[:4]:
     4182                nItems['HKLF'] += 1
     4183                if name in Histograms:
     4184                    used = True
     4185                    continue
     4186            if 'PDF' in name[:3]:
     4187                PDFnames.append(name)
     4188                nItems['PDF'] += 1
     4189            TextList.append(name)
    41854190        for pdfName in PDFnames:
    41864191            try:
     
    41884193            except ValueError:
    41894194                print (u'PWDR'+pdfName[4:]+u' for '+pdfName+u' not found')
    4190         if len(TextList) == 0 and used:
    4191             G2G.G2MessageBox(self,'All histograms are used. You must remove them from phases before they can be deleted',
    4192                                  'Nothing to delete')
     4195        if len(TextList) == 0:
     4196            if used:
     4197                msg = 'All histograms are associated with at least one phase. You must unset a histogram "use" flag in all phase(s) where it is referenced before it can be deleted'
     4198            elif seqUse:
     4199                msg = 'All histograms are in used in the sequential list. You must remove it from the list (in Controls) before it can be deleted'
     4200            else:
     4201                msg = 'No data items found in tree to delete'
     4202            G2G.G2MessageBox(self,msg,'Nothing to delete')
    41934203            return
    4194         elif len(TextList) == 0:
    4195             G2G.G2MessageBox(self,'None of the tree items are allowed to be deleted',
    4196                                  'Nothing to delete')
    4197             return
    4198        
    41994204        dlg = G2G.G2MultiChoiceDialog(self, 'Which data to delete?', 'Delete data', TextList, wx.CHOICEDLG_STYLE)
    42004205        try:
  • trunk/GSASIIseqGUI.py

    r4987 r5000  
    114114                if Id:
    115115                    sampleData = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,Id,'Sample Parameters'))
    116                     for item in sampleParmDict:
    117                         sampleParmDict[item].append(sampleData.get(item,0))
     116                else:  # item missing from tree! stick in NaN's!
     117                    sampleData = {}
     118                for item in sampleParmDict:
     119                    sampleParmDict[item].append(sampleData.get(item,np.NaN))
    118120        for item in sampleParmDict:
    119121            if sampleParmDict[item]:
Note: See TracChangeset for help on using the changeset viewer.