Changeset 4825
- Timestamp:
- Feb 23, 2021 1:57:49 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIdataGUI.py
r4822 r4825 3985 3985 TextList.append(self.GPXtree.GetItemText(item)) 3986 3986 item, cookie = self.GPXtree.GetNextChild(sub, cookie) 3987 dlg = wx.MultiChoiceDialog(self, 'Which phase to delete?', 'Delete phase', TextList, wx.CHOICEDLG_STYLE)3987 dlg = wx.MultiChoiceDialog(self, 'Which phase(s) to delete?', 'Delete phase', TextList, wx.CHOICEDLG_STYLE) 3988 3988 try: 3989 3989 if dlg.ShowModal() == wx.ID_OK: … … 4877 4877 return phaseData 4878 4878 4879 def GetPhaseInfofromTree(self ):4879 def GetPhaseInfofromTree(self, Used=False): 4880 4880 '''Get the phase names and their rId values, 4881 also the histograms used in each phase. 4882 4881 also the histograms referenced in each phase. 4882 4883 :param bool Used: if Used is True, only histograms that are 4884 referenced in the histogram are returned 4883 4885 :returns: (phaseRIdList, usedHistograms) where 4884 4886 … … 4899 4901 data = self.GPXtree.GetItemPyData(item) 4900 4902 UseList = data['Histograms'] 4901 usedHistograms[phaseName] = list(UseList.keys()) 4903 if Used: 4904 usedHistograms[phaseName] = [h for h in UseList if UseList[h]['Use']] 4905 else: 4906 usedHistograms[phaseName] = list(UseList.keys()) 4902 4907 item, cookie = self.GPXtree.GetNextChild(sub, cookie) 4903 4908 return phaseRIdList,usedHistograms … … 5327 5332 Controls = self.GPXtree.GetItemPyData(GetGPXtreeItemId(self,self.root, 'Controls')) 5328 5333 Controls['ShowCell'] = True 5334 for key in ('parmMinDict','parmMaxDict','parmFrozen'): 5335 if key not in Controls: Controls[key] = {} 5336 # check for deleted or unused histograms in refine list 5337 phaseRIdList,histdict = self.GetPhaseInfofromTree(Used=True) 5338 usedHistograms = [] 5339 for k in histdict: 5340 usedHistograms += histdict[k] 5341 usedHistograms = list(set(usedHistograms)) 5342 newseqList = [i for i in seqList if i in usedHistograms] 5343 if len(newseqList) != len(seqList): 5344 G2G.G2MessageBox(self, 5345 str(len(seqList)-len(newseqList))+ 5346 ' histograms that are not used have been removed from the sequential list.', 5347 'Histograms removed') 5348 Controls['Seq Data'] = newseqList 5349 seqList = newseqList 5329 5350 self.OnFileSave(event) 5330 5351 # check that constraints are OK here … … 5359 5380 # select it 5360 5381 self.PatternId = GetGPXtreeItemId(self,self.root,histNames[0]) 5361 if self. GPXtree.GetItemText(self.PatternId).startswith('PWDR '):5382 if self.PatternId and self.GPXtree.GetItemText(self.PatternId).startswith('PWDR '): 5362 5383 refPlotUpdate = G2plt.PlotPatterns(self,refineMode=True) # prepare for plot updating 5363 5384 else: … … 6536 6557 def OnSelectData(event): 6537 6558 choices = GetGPXtreeDataNames(G2frame,['PWDR','HKLF',]) 6559 phaseRIdList,histdict = G2frame.GetPhaseInfofromTree(Used=True) 6560 usedHistograms = [] 6561 for k in histdict: 6562 usedHistograms += histdict[k] 6563 usedHistograms = list(set(usedHistograms)) 6564 choices = [i for i in choices if i in usedHistograms] 6565 if len(choices) == 0: 6566 G2G.G2MessageBox(self, 6567 'No histograms in use found for a sequential fit.', 6568 'No Histograms') 6569 return 6538 6570 sel = [] 6539 6571 try: … … 6544 6576 except ValueError: #data changed somehow - start fresh 6545 6577 sel = [] 6546 dlg = G2G.G2MultiChoiceDialog(G2frame, 'Se quential refinement',6547 'Select dataset to include',choices)6578 dlg = G2G.G2MultiChoiceDialog(G2frame, 'Select datasets to include', 6579 'Sequential refinement selection',choices) 6548 6580 dlg.SetSelections(sel) 6549 6581 names = [] … … 7992 8024 Albls = [pfx+'A'+str(i) for i in range(6)] 7993 8025 for name in histNames: 8026 if name not in Histograms: continue 7994 8027 hId = Histograms[name]['hId'] 7995 8028 phfx = '%d:%d:'%(pId,hId) … … 8282 8315 for row,name in enumerate(histNames): 8283 8316 deltaChi = G2frame.SeqTable.GetValue(row,deltaChiCol) 8284 if deltaChi > 10.: 8285 G2frame.dataDisplay.SetCellStyle(row,deltaChiCol,color=wx.Colour(255,0,0)) 8286 elif deltaChi > 1.0: 8287 G2frame.dataDisplay.SetCellStyle(row,deltaChiCol,color=wx.Colour(255,255,0)) 8317 try: 8318 if deltaChi > 10.: 8319 G2frame.dataDisplay.SetCellStyle(row,deltaChiCol,color=wx.Colour(255,0,0)) 8320 elif deltaChi > 1.0: 8321 G2frame.dataDisplay.SetCellStyle(row,deltaChiCol,color=wx.Colour(255,255,0)) 8322 except: 8323 pass 8288 8324 G2frame.dataDisplay.InstallGridToolTip(GridSetToolTip,GridColLblToolTip) 8289 8325 #G2frame.dataDisplay.SendSizeEvent() # resize needed on mac -
trunk/GSASIIphsGUI.py
r4824 r4825 9774 9774 if G2frame.dataWindow.HistsInPhase: 9775 9775 DelList = [] 9776 dlg = G2G.G2MultiChoiceDialog(G2frame, 'Delete histogram', 9777 'Which histogram to delete from this phase?',G2frame.dataWindow.HistsInPhase) 9776 extraOpts= {'label_0':'Remove from all phases','value_0':False} 9777 h,pd = G2frame.GetUsedHistogramsAndPhasesfromTree() 9778 if len(pd) > 1: 9779 opts = extraOpts 9780 else: 9781 opts = {} 9782 dlg = G2G.G2MultiChoiceDialog(G2frame, 9783 'Select histogram(s) to remove \nfrom this phase:', 9784 'Remove histograms', G2frame.dataWindow.HistsInPhase, 9785 extraOpts=opts) 9778 9786 try: 9779 9787 if dlg.ShowModal() == wx.ID_OK: 9780 9788 DelList = [G2frame.dataWindow.HistsInPhase[i] for i in dlg.GetSelections()] 9781 for i in DelList:9782 del data['Histograms'][i]9783 9789 finally: 9784 9790 dlg.Destroy() 9785 wx.CallAfter(G2ddG.UpdateDData,G2frame,DData,data) 9786 9791 if extraOpts['value_0']: 9792 for p in pd: 9793 for i in DelList: 9794 if i in pd[p]['Histograms']: del pd[p]['Histograms'][i] 9795 else: 9796 for i in DelList: 9797 del data['Histograms'][i] 9798 #wx.CallLater(100,G2ddG.UpdateDData,G2frame,DData,data) # produces error 9799 wx.CallAfter(UpdatePhaseData,G2frame,Item,data) 9800 9787 9801 def OnDataApplyStrain(event): 9788 9802 SGData = data['General']['SGData'] -
trunk/GSASIIstrMain.py
r4819 r4825 605 605 if histogram not in Histograms: 606 606 G2fil.G2Print("Error: not found!") 607 continue 607 raise G2obj.G2Exception("refining with invalid histogram {}". 608 format(histogram)) 608 609 hId = Histograms[histogram]['hId'] 609 610 redphaseVary = phaseCheck(phaseVary,Phases,histogram)
Note: See TracChangeset
for help on using the changeset viewer.