- Timestamp:
- Feb 17, 2021 12:52:34 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIctrlGUI.py
r4811 r4819 183 183 pass 184 184 185 ################################################################################ 186 #### Fixed definitions for wx Ids 187 ################################################################################ 185 #### Fixed definitions for wx Ids ################################################################################ 188 186 def Define_wxId(*args): 189 187 '''routine to create unique global wx Id symbols in this module. … … 197 195 exec('global '+arg+';'+arg+' = wx.NewId()') 198 196 199 ################################################################################ 200 #### Tree Control 201 ################################################################################ 197 #### Tree Control ################################################################################ 202 198 class G2TreeCtrl(wx.TreeCtrl): 203 199 '''Create a wrapper around the standard TreeCtrl so we can "wrap" … … 415 411 item, cookie = self.GetNextChild(self.root, cookie) 416 412 417 ################################################################################ 418 #### TextCtrl that stores input as entered with optional validation 419 ################################################################################ 413 #### TextCtrl that stores input as entered with optional validation ################################################################################ 420 414 class ValidatedTxtCtrl(wx.TextCtrl): 421 415 '''Create a TextCtrl widget that uses a validator to prevent the … … 1275 1269 if num >= 0: self.SetSelection(num) 1276 1270 1277 ############################################################## 1278 # Custom checkbox that saves values into dict/list as used 1271 #### Custom checkbox that saves values into dict/list as used ############################################################## 1279 1272 class G2CheckBox(wx.CheckBox): 1280 1273 '''A customized version of a CheckBox that automatically initializes … … 1308 1301 if self.OnChange: self.OnChange(event) 1309 1302 1310 ################################################################################ 1311 #### Commonly used dialogs 1312 ################################################################################ 1303 #### Commonly used dialogs ################################################################################ 1313 1304 def CallScrolledMultiEditor(parent,dictlst,elemlst,prelbl=[],postlbl=[], 1314 1305 title='Edit items',header='',size=(300,250), … … 1324 1315 title,header,size, 1325 1316 CopyButton, ASCIIonly, **kw) 1317 dlg.CenterOnParent() 1326 1318 if dlg.ShowModal() == wx.ID_OK: 1327 1319 dlg.Destroy() … … 1349 1341 :param tuple dictlst: a list of dicts or lists containing values to edit 1350 1342 1351 :param tuple elemlst: a list of keys for each item in a dictlst. Must have the1352 same length as dictlst.1353 1354 :param wx.Frame parent: name of parent window, or may be None1355 1343 :param tuple elemlst: a list of keys/indices for items in dictlst. 1344 Note that elemlst must have the same length as dictlst, where each 1345 item in elemlst will will match an entry for an entry for successive 1346 dicts/lists in dictlst. 1347 1356 1348 :param tuple prelbl: a list of labels placed before the TextCtrl for each 1357 1349 item (optional) … … 1561 1553 ############################################### Multichoice Dialog with set all, toggle & filter options 1562 1554 class G2MultiChoiceDialog(wx.Dialog): 1563 '''A dialog similar to MultiChoiceDialog except that buttons are 1564 added to set all choices and to toggle all choices. 1555 '''A dialog similar to wx.MultiChoiceDialog except that buttons are 1556 added to set all choices and to toggle all choices and a filter is 1557 available to select from available entries. Note that if multiple 1558 entries are placed in the filter box separated by spaces, all 1559 of the strings must be present for an item to be shown. 1565 1560 1566 1561 :param wx.Frame ParentFrame: reference to parent frame … … 1577 1572 options to present to the user, where value_i is the default value. 1578 1573 Options are listed ordered by the value_i values. 1574 :param list selected: list of indicies for items that should be 1579 1575 :param kw: optional keyword parameters for the wx.Dialog may 1580 1576 be included such as size [which defaults to `(320,310)`] and … … 1585 1581 ''' 1586 1582 def __init__(self,parent, title, header, ChoiceList, toggle=True, 1587 monoFont=False, filterBox=True, extraOpts={}, **kw): 1583 monoFont=False, filterBox=True, extraOpts={}, selected=[], 1584 **kw): 1588 1585 # process keyword parameters, notably style 1589 1586 options = {'size':(320,310), # default Frame keywords … … 1593 1590 self.ChoiceList = ['%4d) %s'%(i,item) for i,item in enumerate(ChoiceList)] # numbered list of choices (list of str values) 1594 1591 self.Selections = len(self.ChoiceList) * [False,] # selection status for each choice (list of bools) 1592 for i in selected: 1593 self.Selections[i] = True 1595 1594 self.filterlist = range(len(self.ChoiceList)) # list of the choice numbers that have been filtered (list of int indices) 1596 1595 self.Stride = 1 … … 1624 1623 self.rangeFirst = None 1625 1624 self.clb = wx.CheckListBox(self, wx.ID_ANY, (30,30), wx.DefaultSize, self.ChoiceList) 1625 self._ShowSelections() 1626 1626 self.clb.Bind(wx.EVT_CHECKLISTBOX,self.OnCheck) 1627 1627 if monoFont: … … 1795 1795 self.GetSelections() # record current selections 1796 1796 txt = self.filterBox.GetValue() 1797 txt = txt.lower() 1797 1798 self.clb.Clear() 1798 1799 … … 1800 1801 self.filterlist = [] 1801 1802 if txt: 1802 txt = txt.lower()1803 1803 ChoiceList = [] 1804 1804 for i,item in enumerate(self.ChoiceList): 1805 if item.lower().find(txt) != -1: 1805 for t in txt.split(): 1806 if item.lower().find(t) == -1: 1807 break 1808 else: 1806 1809 ChoiceList.append(item) 1807 1810 self.filterlist.append(i) … … 2205 2208 dlg.Destroy() 2206 2209 2207 ############################################################### 2208 # Single choice Dialog with filter options 2210 ##### Single choice Dialog with filter options ############################################################### 2209 2211 class G2SingleChoiceDialog(wx.Dialog): 2210 2212 '''A dialog similar to wx.SingleChoiceDialog except that a filter can be … … 4448 4450 return None 4449 4451 4450 ################################################################################ 4451 ##### Customized Grid Support 4452 ################################################################################ 4452 ##### Customized Grid Support ################################################################################ 4453 4453 class GSGrid(wg.Grid): 4454 4454 '''Basic wx.Grid implementation … … 4773 4773 evt.StopPropagation() 4774 4774 4775 ################################################################################ 4776 ##### Get an output file or directory 4777 ################################################################################ 4775 ##### Get an output file or directory ################################################################################ 4778 4776 def askSaveFile(G2frame,defnam,extension,longFormatName,parent=None): 4779 4777 '''Ask the user to supply a file name … … 4829 4827 return filename 4830 4828 4831 ################################################################################ 4832 ##### Customized Notebook 4833 ################################################################################ 4829 ##### Customized Notebook ################################################################################ 4834 4830 class GSNoteBook(wx.aui.AuiNotebook): 4835 4831 '''Notebook used in various locations; implemented with wx.aui extension … … 4896 4892 # return attr 4897 4893 4898 ################################################################################ 4899 #### Help support routines 4900 ################################################################################ 4894 #### Help support routines ################################################################################ 4901 4895 class MyHelp(wx.Menu): 4902 4896 ''' … … 5387 5381 return s.encode('ascii','replace') 5388 5382 5389 ###################################################################### 5390 # wx classes for reading various types of data files 5391 ###################################################################### 5383 # wx classes for reading various types of data files ###################################################################### 5392 5384 def BlockSelector(ChoiceList, ParentFrame=None,title='Select a block', 5393 5385 size=None, header='Block Selector',useCancel=True): … … 6001 5993 6002 5994 ################################################################################ 6003 ################################################################################6004 5995 class SortableLstCtrl(wx.Panel): 6005 5996 '''Creates a read-only table with sortable columns. Sorting is done by … … 6119 6110 print('docs build kludge for G2LstCtrl') 6120 6111 6121 ################################################################################ 6122 #### Display Help information 6123 ################################################################################ 6112 #### Display Help information ################################################################################ 6124 6113 # define some globals 6125 6114 htmlPanel = None … … 6221 6210 webbrowser.open(pfx+URL, new=0, autoraise=True) 6222 6211 6223 ################################################################################ 6224 #### Tutorials support 6225 ################################################################################ 6212 #### Tutorials support ################################################################################ 6226 6213 G2BaseURL = "https://subversion.xray.aps.anl.gov/pyGSAS" 6227 6214 tutorialIndex = ( … … 6761 6748 except KeyError: 6762 6749 pass 6763 ################################################################################ 6764 # Autoload PWDR files 6765 ################################################################################ 6750 6751 ### Autoload PWDR files ################################################################################ 6766 6752 AutoLoadWindow = None 6767 6753 … … 7169 7155 AutoLoadWindow = dlg # save window reference 7170 7156 7171 ################################################################################ 7172 # Deal with Origin 1/2 ambiguities 7173 ################################################################################ 7157 # Deal with Origin 1/2 ambiguities ################################################################################ 7174 7158 def ChooseOrigin(G2frame,rd): 7175 7159 # make copy of Phase but shift atoms Origin 1->2 -
trunk/GSASIIdataGUI.py
r4809 r4819 151 151 return None 152 152 153 ################################################################################ 154 #### class definitions used for main GUI 155 ################################################################################ 156 153 #### class definitions used for main GUI ###################################### 157 154 class MergeDialog(wx.Dialog): 158 155 ''' HKL transformation & merge dialog … … 513 510 '\nhttps://gsas-ii.readthedocs.io/en/latest/GSASIIGUI.html#GSASIIdataGUI.versionDict') 514 511 515 ############################################################################### 516 #### GUI creation 517 ############################################################################### 512 #### GUI creation ############################################################# 518 513 def GSASIImain(application): 519 514 '''Start up the GSAS-II GUI''' … … 644 639 application.GetTopWindow().Show(True) 645 640 646 ################################################################################ 647 #### Create main frame (window) for GUI 648 ################################################################################ 641 #### Create main frame (window) for GUI ####################################### 649 642 class GSASII(wx.Frame): 650 643 '''Define the main GSAS-II frame and its associated menu items. … … 2725 2718 data.append('Notebook entry @ %s: %s'%(time.ctime(),text)) 2726 2719 2727 ############################################################################### 2728 #Command logging 2729 ############################################################################### 2730 2720 2721 ### Command logging ########################################################### 2731 2722 def OnMacroRecordStatus(self,event,setvalue=None): 2732 2723 '''Called when the record macro menu item is used which toggles the … … 2954 2945 # self.ExportLookup[item.GetId()] = 'powder' 2955 2946 2956 ############################################################################### 2957 # Exporters 2958 ############################################################################### 2959 2947 # Exporters ################################################################### 2960 2948 def _Add_ExportMenuItems(self,parent): 2961 2949 # item = parent.Append( … … 3146 3134 print('Value for config {} {} is invalid'.format(var,GSASIIpath.GetConfigValue(var))) 3147 3135 win.Center() 3148 ################################################################################ 3149 #### init_vars 3150 ################################################################################ 3136 3137 #### init_vars ################################################################ 3151 3138 def init_vars(self): 3152 3139 # initialize default values for GSAS-II "global" variables (saved in main Frame) … … 3240 3227 self.dataDisplay = None 3241 3228 self.init_vars() 3242 3229 3230 if GSASIIpath.GetConfigValue('Starting_directory'): 3231 try: 3232 pth = GSASIIpath.GetConfigValue('Starting_directory') 3233 pth = os.path.expanduser(pth) 3234 os.chdir(pth) 3235 self.LastGPXdir = pth 3236 except: 3237 print('Ignoring Config Starting_directory value: '+ 3238 GSASIIpath.GetConfigValue('Starting_directory')) 3243 3239 arg = sys.argv 3244 3240 if len(arg) > 1 and arg[1]: … … 3263 3259 import traceback 3264 3260 print (traceback.format_exc()) 3265 3266 if GSASIIpath.GetConfigValue('Starting_directory'): 3267 try: 3268 pth = GSASIIpath.GetConfigValue('Starting_directory') 3269 pth = os.path.expanduser(pth) 3270 os.chdir(pth) 3271 self.LastGPXdir = pth 3272 except: 3273 print('Ignoring Config Starting_directory value: '+ 3274 GSASIIpath.GetConfigValue('Starting_directory')) 3275 3261 elif any('SPYDER' in name for name in os.environ): 3262 self.OnFileReopen(None) 3263 3276 3264 def GetTreeItemsList(self,item): 3277 3265 return self.GPXtree._getTreeItemsList(item) … … 5434 5422 G2IO.SaveMultipleImg(self) 5435 5423 5436 ################################################################################ 5437 # Data window side of main GUI 5438 ################################################################################ 5424 # Data window side of main GUI ################################################ 5439 5425 class G2DataWindow(wx.ScrolledWindow): #wxscroll.ScrolledPanel): 5440 5426 '''Create the data item window as well as the menu. Note that … … 5730 5716 self.SequentialFile.Append(G2G.wxID_UPDATESEQSEL,'Update phase from selected', 5731 5717 'Update phase information from selected row') 5718 G2G.Define_wxId('wxID_EDITSEQSELPHASE') 5719 self.SequentialFile.Append(G2G.wxID_EDITSEQSELPHASE,'Edit phase parameters in selected', 5720 'Edit phase information from selected row') 5732 5721 self.SequentialFile.AppendSeparator() 5733 5722 self.SequentialFile.Append(G2G.wxID_PLOTSEQSEL,'Plot selected cols', … … 6447 6436 # end of GSAS-II menu definitions 6448 6437 6449 ################################################################################ 6450 ##### Notebook Tree Item editor 6451 ################################################################################ 6438 ##### Notebook Tree Item editor ############################################## 6452 6439 def UpdateNotebook(G2frame,data): 6453 6440 '''Called when the data tree notebook entry is selected. Allows for … … 6471 6458 G2frame.dataWindow.GetSizer().Add(text,1,wx.ALL|wx.EXPAND) 6472 6459 6473 ################################################################################ 6474 ##### Comments 6475 ################################################################################ 6460 ##### Comments ############################################################### 6476 6461 def UpdateComments(G2frame,data): 6477 6462 '''Place comments into the data window … … 6491 6476 6492 6477 6493 ################################################################################ 6494 ##### Controls Tree Item editor 6495 ################################################################################ 6478 ##### Controls Tree Item editor ############################################## 6496 6479 def UpdateControls(G2frame,data): 6497 6480 '''Edit overall GSAS-II controls in main Controls data tree entry … … 6783 6766 G2frame.SendSizeEvent() 6784 6767 6785 ################################################################################ 6786 ##### Display of Sequential Results 6787 ################################################################################ 6788 6768 6769 ##### Display of Sequential Results ########################################## 6789 6770 def UpdateSeqResults(G2frame,data,prevSize=None): 6790 6771 """ … … 7741 7722 for iname,name in enumerate(names): 7742 7723 AtomSS[Stype][iw][0][iname] = parmDict[pfx+name] 7743 7724 7725 def OnEditSelectPhaseVars(event): 7726 '''Select phase parameters in a selected histogram in a sequential 7727 fit. This allows the user to set their value(s) 7728 ''' 7729 rows = G2frame.dataDisplay.GetSelectedRows() 7730 if len(rows) == 1: 7731 sel = rows[0] 7732 else: 7733 dlg = G2G.G2SingleChoiceDialog(G2frame, 'Select histogram to use for update', 7734 'Select row',histNames) 7735 if dlg.ShowModal() == wx.ID_OK: 7736 sel = dlg.GetSelection() 7737 dlg.Destroy() 7738 else: 7739 dlg.Destroy() 7740 return 7741 parmDict = data[histNames[sel]]['parmDict'] 7742 # narrow down to items w/o a histogram & having float values 7743 phaseKeys = [i for i in parmDict if ':' in i and i.split(':')[1] == ''] 7744 phaseKeys = [i for i in phaseKeys if type(parmDict[i]) not in (int,str,bool) ] 7745 dlg = G2G.G2MultiChoiceDialog(G2frame, 'Choose phase parmDict items to set', 7746 'Choose items to edit', phaseKeys) 7747 if dlg.ShowModal() == wx.ID_OK: 7748 select = dlg.GetSelections() 7749 dlg.Destroy() 7750 else: 7751 dlg.Destroy() 7752 return 7753 if len(select) == 0: return 7754 l = [phaseKeys[i] for i in select] 7755 d = {i:parmDict[i] for i in l} 7756 val = G2G.CallScrolledMultiEditor(G2frame,len(l)*[d],l,l,CopyButton=True) 7757 if val: 7758 for key in d: # update values shown in table 7759 if parmDict[key] == d[key]: continue 7760 if key in data[histNames[sel]]['varyList']: 7761 i = data[histNames[sel]]['varyList'].index(key) 7762 data[histNames[sel]]['variables'][i] = d[key] 7763 data[histNames[sel]]['sig'][i] = 0 7764 if key in data[histNames[sel]].get('depParmDict',{}): 7765 data[histNames[sel]]['depParmDict'][key] = (d[key],0) 7766 parmDict.update(d) # update values used in next fit 7767 wx.CallAfter(UpdateSeqResults,G2frame,data) # redisplay variables 7768 return 7769 7770 ##### UpdateSeqResults: start processing sequential results here ########## 7744 7771 # lookup table for unique cell parameters by symmetry 7745 7772 cellGUIlist = [ … … 7756 7783 cellUlbl = ('a','b','c',u'\u03B1',u'\u03B2',u'\u03B3') # unicode a,b,c,alpha,beta,gamma 7757 7784 7758 #======================================================================7759 # start processing sequential results here (UpdateSeqResults)7760 #======================================================================7761 7785 if not data: 7762 7786 print ('No sequential refinement results') … … 7839 7863 #G2frame.Bind(wx.EVT_MENU, OnReOrgSelSeq, id=G2G.wxID_ORGSEQSEL) 7840 7864 G2frame.Bind(wx.EVT_MENU, OnSelectUpdate, id=G2G.wxID_UPDATESEQSEL) 7865 G2frame.Bind(wx.EVT_MENU, OnEditSelectPhaseVars, id=G2G.wxID_EDITSEQSELPHASE) 7841 7866 G2frame.Bind(wx.EVT_MENU, onSelectSeqVars, id=G2G.wxID_ORGSEQINC) 7842 7867 G2frame.Bind(wx.EVT_MENU, AddNewPseudoVar, id=G2G.wxID_ADDSEQVAR) … … 7902 7927 #else: 7903 7928 # G2frame.dataWindow.SequentialFile.Enable(G2G.wxID_ORGSEQSEL,False) 7904 #----------------------------------------------------------------------------------- 7905 # build up the data table by columns ----------------------------------------------- 7929 ###### build up the data table by columns ----------------------------------------------- 7906 7930 histNames = foundNames 7907 7931 nRows = len(histNames) … … 8252 8276 G2frame.dataWindow.SetDataSize() 8253 8277 8254 ################################################################################ 8255 ##### Main PWDR panel 8256 ################################################################################ 8257 8278 ##### Main PWDR panel ######################################################## 8258 8279 def UpdatePWHKPlot(G2frame,kind,item): 8259 8280 '''Called when the histogram main tree entry is called. Displays the … … 8681 8702 wx.CallAfter(G2frame.GPXtree.SelectItem,item) 8682 8703 8683 ################################################################################ 8684 ##### Data (GPX) tree routines 8685 ################################################################################ 8686 8704 ##### Data (GPX) tree routines ############################################### 8687 8705 def GetGPXtreeDataNames(G2frame,dataTypes): 8688 8706 '''Finds all items in tree that match a 4 character prefix -
trunk/GSASIIddataGUI.py
r4801 r4819 30 30 import GSASIIctrlGUI as G2G 31 31 import GSASIIpy3 as G2py3 32 import GSASIIdataGUI as G2gd 32 33 33 34 WACV = wx.ALIGN_CENTER_VERTICAL … … 38 39 'rho':[],'rhoMax':0.,'mapSize':10.0,'cutOff':50.,'Flip':False} 39 40 40 ################################################################################ 41 ##### DData routines 42 ################################################################################ 41 ##### DData routines ################################################################################ 43 42 def UpdateDData(G2frame,DData,data,hist='',Scroll=0): 44 43 '''Display the Diffraction Data associated with a phase … … 229 228 Obj = event.GetEventObject() 230 229 UseList[G2frame.hist]['Pref.Ori.'][2] = Obj.GetValue() 231 230 231 def OnAddFixed(event): 232 fixedVars = UseList[G2frame.hist].get('FixedSeqVars',[]) 233 SeqId = G2gd.GetGPXtreeItemId(G2frame, G2frame.root, 'Sequential results') 234 seqData = G2frame.GPXtree.GetItemPyData(SeqId) 235 if G2frame.hist not in seqData: 236 print('Strange: '+G2frame.hist+' not found') 237 return 238 parmDict = seqData[G2frame.hist].get('parmDict',[]) 239 # narrow down to items w/o a histogram & having float values 240 phaseKeys = [i for i in parmDict if ':' in i and i.split(':')[1] == ''] 241 phaseKeys = [i for i in phaseKeys if type(parmDict[i]) not in (int,str,bool)] 242 if len(phaseKeys) == 0: return 243 selected = [] 244 for i,key in enumerate(phaseKeys): 245 if key in fixedVars: selected.append(i) 246 dlg = G2G.G2MultiChoiceDialog(G2frame, 'Choose phase vars to fix for this histogram only', 247 'Choose items to edit', phaseKeys,selected=selected) 248 if dlg.ShowModal() == wx.ID_OK: 249 sel = dlg.GetSelections() 250 dlg.Destroy() 251 else: 252 dlg.Destroy() 253 return 254 UseList[G2frame.hist]['FixedSeqVars'] = [phaseKeys[i] for i in sel] 255 wx.CallLater(100,RepaintHistogramInfo,DData.GetScrollPos(wx.VERTICAL)) 256 232 257 def SetPOCoef(Order,hist): 233 258 cofNames = G2lat.GenSHCoeff(SGData['SGLaue'],'0',Order,False) #cylindrical & no M … … 868 893 if 'Fix FXU' not in UseList[G2frame.hist]: 869 894 UseList[G2frame.hist]['Fix FXU'] = ' ' 895 if 'FixedSeqVars' not in UseList[G2frame.hist]: 896 UseList[G2frame.hist]['FixedSeqVars'] = [] 870 897 if 'Flack' not in UseList[G2frame.hist]: 871 898 UseList[G2frame.hist]['Flack'] = [0.0,False] … … 892 919 G2frame.SetStatusText('To reset LeBail, cycle LeBail check box.',1) 893 920 bottomSizer.Add(useBox,0,wx.TOP|wx.BOTTOM|wx.LEFT,5) 894 fixBox = wx.BoxSizer(wx.HORIZONTAL) 895 parmChoice = [' ','X','XU','U','F','FX','FXU','FU'] 896 if generalData['Type'] == 'magnetic': 897 parmChoice += ['M','MX','MXU','MU','MF','MFX','MFXU','MFU'] 898 fixBox.Add(wx.StaticText(DData,label=' In sequential refinement, fix these in '+generalData['Name']+' for this histogram: '),0,WACV) 899 fixVals = wx.ComboBox(DData,value=UseList[G2frame.hist]['Fix FXU'],choices=parmChoice, 900 style=wx.CB_DROPDOWN) 901 fixVals.Bind(wx.EVT_COMBOBOX,OnFixVals) 902 fixBox.Add(fixVals,0,WACV) 903 bottomSizer.Add(fixBox) 904 #TODO - put Sequential refinement fix F? fix X? fix U? CheckBox here 921 if G2frame.testSeqRefineMode(): 922 bottomSizer.Add(wx.StaticText(DData,label=' Sequential Refinemment Options')) 923 parmChoice = [' ','X','XU','U','F','FX','FXU','FU'] 924 if generalData['Type'] == 'magnetic': 925 parmChoice += ['M','MX','MXU','MU','MF','MFX','MFXU','MFU'] 926 fixBox = wx.BoxSizer(wx.HORIZONTAL) 927 fixBox.Add(wx.StaticText(DData,label=' Fix these var types: '),0,WACV) 928 fixVals = wx.ComboBox(DData,value=UseList[G2frame.hist]['Fix FXU'],choices=parmChoice, 929 style=wx.CB_DROPDOWN) 930 fixVals.Bind(wx.EVT_COMBOBOX,OnFixVals) 931 fixBox.Add(fixVals,0,WACV) 932 fixBox.Add(wx.StaticText(DData,label=' in phase '+generalData['Name']+' for this histogram'),0,WACV) 933 bottomSizer.Add(fixBox) 934 SeqId = G2gd.GetGPXtreeItemId(G2frame, G2frame.root, 'Sequential results') 935 if SeqId: 936 fixBox = wx.BoxSizer(wx.HORIZONTAL) 937 fixBox.Add(wx.StaticText(DData,label=' Specific phase variables to fix for this histogram: '),0,WACV) 938 addFixed = wx.Button(DData,wx.ID_ANY,label='Select Vars') 939 fixBox.Add(addFixed,0,WACV) 940 addFixed.Bind(wx.EVT_BUTTON,OnAddFixed) 941 fixedVars = UseList[G2frame.hist].get('FixedSeqVars',[]) 942 if len(fixedVars): 943 fixBox.Add(wx.StaticText(DData,label=' (currently {} fixed)'.format(len(fixedVars))),0,WACV) 944 bottomSizer.Add(fixBox) 905 945 906 946 bottomSizer.Add(ScaleSizer(),0,wx.BOTTOM,5) -
trunk/GSASIImath.py
r4811 r4819 338 338 # complete current cycle 339 339 deltaChi2 = (chisq0-chisq1)/chisq0 340 if Print andn-len(indices):340 if n-len(indices): 341 341 G2fil.G2Print( 342 342 'Cycle %d: %.2fs Chi2: %.5g; Obs: %d; Lam: %.3g Del: %.3g; drop=%d, SVD=%d'% 343 343 (icycle,time.time()-time0,chisq1,Nobs,lamMax,deltaChi2,n-len(indices),Nzeros)) 344 el if Print:344 else: 345 345 G2fil.G2Print( 346 346 'Cycle %d: %.2fs, Chi**2: %.5g for %d obs., Lambda: %.3g, Delta: %.3g, SVD=%d'% … … 350 350 if deltaChi2 < ftol: 351 351 ifConverged = True 352 if Print:G2fil.G2Print("converged")352 G2fil.G2Print("converged") 353 353 break 354 354 icycle += 1 -
trunk/GSASIIphsGUI.py
r4818 r4819 100 100 GkDelta = chr(0x0394) 101 101 Angstr = chr(0x00c5) 102 ################################################################################ 103 #### phase class definitions 104 ################################################################################ 102 103 #### phase class definitions ################################################################################ 105 104 class SymOpDialog(wx.Dialog): 106 105 '''Class to select a symmetry operator … … 9592 9591 sourceDict = copy.deepcopy(data['Histograms'][hist]) 9593 9592 if 'HKLF' in sourceDict['Histogram']: 9594 copyNames = [' Scale','Extinction','Babinet','Flack','Twins','Fix FXU']9593 copyNames = ['Extinction','Babinet','Flack','Twins'] 9595 9594 else: #PWDR 9596 copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail','newLeBail','Fix FXU','Layer Disp'] 9595 copyNames = ['Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail','newLeBail','Layer Disp'] 9596 copyNames += ['Scale','Fix FXU','FixedSeqVars'] 9597 9597 copyDict = {} 9598 for name in copyNames: 9599 copyDict[name] = sourceDict[name] #force copy 9598 for name in copyNames: 9599 if name not in sourceDict: continue 9600 copyDict[name] = copy.deepcopy(sourceDict[name]) #force copy 9600 9601 dlg = G2G.G2MultiChoiceDialog(G2frame,u'Copy phase/histogram parameters\nfrom '+hist[5:][:35], 9601 9602 'Copy phase/hist parameters', keyList) … … 9612 9613 copyDict = {} 9613 9614 if 'HKLF' in sourceDict['Histogram']: 9614 copyNames = [' Scale','Extinction','Babinet','Flack','Twins','Fix FXU']9615 copyNames = ['Extinction','Babinet','Flack','Twins'] 9615 9616 else: #PWDR 9616 copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','Fix FXU','Layer Disp'] 9617 copyNames = ['Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','Layer Disp'] 9618 copyNames += ['Scale','Fix FXU','FixedSeqVars'] 9617 9619 babNames = ['BabA','BabU'] 9618 9620 for name in copyNames: 9621 if name not in sourceDict: continue 9619 9622 if name in ['Scale','Extinction','HStrain','Flack','Twins','Layer Disp']: 9620 9623 if name == 'Extinction' and 'HKLF' in sourceDict['Histogram']: … … 9640 9643 for bab in babNames: 9641 9644 copyDict[name][bab] = sourceDict[name][bab][1] 9642 elif name == 'Fix FXU' :9643 copyDict[name] = sourceDict[name]9645 elif name == 'Fix FXU' or name == 'FixedSeqVars': 9646 copyDict[name] = copy.deepcopy(sourceDict[name]) 9644 9647 keyList = G2frame.dataWindow.HistsInPhase[:] 9645 9648 if hist in keyList: keyList.remove(hist) … … 9654 9657 item = keyList[sel] 9655 9658 for name in copyNames: 9659 if name not in sourceDict: continue 9656 9660 if name in ['Scale','Extinction','HStrain','Flack','Twins','Layer Disp']: 9657 9661 if name == 'Extinction' and 'HKLF' in sourceDict['Histogram']: … … 9681 9685 for bab in babNames: 9682 9686 data['Histograms'][item][name][bab][1] = copy.deepcopy(copyDict[name][bab]) 9683 elif name == 'Fix FXU' :9687 elif name == 'Fix FXU' or name == 'FixedSeqVars': 9684 9688 data['Histograms'][item][name] = copy.deepcopy(sourceDict[name]) 9685 9689 finally: … … 9695 9699 return 9696 9700 if 'HKLF' in sourceDict['Histogram']: 9697 copyNames = [' Scale','Extinction','Babinet','Flack','Twins','Fix FXU']9701 copyNames = ['Extinction','Babinet','Flack','Twins'] 9698 9702 else: #PWDR 9699 copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail','newLeBail','Fix FXU','Layer Disp'] 9703 copyNames = ['Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail','newLeBail','Layer Disp'] 9704 copyNames += ['Scale','Fix FXU','FixedSeqVars'] 9700 9705 dlg = G2G.G2MultiChoiceDialog(G2frame,'Select which parameters to copy', 9701 9706 'Select phase data parameters', copyNames) … … 9709 9714 copyDict = {} 9710 9715 for parm in selectedItems: 9716 if parm not in sourceDict: continue 9711 9717 copyDict[parm] = copy.deepcopy(sourceDict[parm]) 9712 9718 dlg = G2G.G2MultiChoiceDialog(G2frame,u'Copy selected phase/histogram parameters\nfrom '+hist[5:][:35], … … 9755 9761 'HStrain':[NDij*[0.0,],NDij*[False,]], 9756 9762 'Layer Disp':[0.0,False], 9757 'Extinction':[0.0,False],'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]},'Fix FXU':' ' }9763 'Extinction':[0.0,False],'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]},'Fix FXU':' ','FixedSeqVars':[]} 9758 9764 refList = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,Id,'Reflection Lists')) 9759 9765 refList[generalData['Name']] = {} … … 10890 10896 RigidBodies.atomsGrid.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect) 10891 10897 choiceeditor = wg.GridCellChoiceEditor( 10892 data['testRBObj']['availAtoms'] , False)10898 data['testRBObj']['availAtoms']+['Create new'], False) 10893 10899 RigidBodies.atomsGrid.SetTable(RigidBodies.atomsTable,True) 10894 10900 # make all grid entries read only -
trunk/GSASIIpwdGUI.py
r4810 r4819 1168 1168 for term in backDict['peaksList']: 1169 1169 PKflags.append(term[1::2]) 1170 FBflag = b ackDict['background PWDR'][2]1170 FBflag = bool(backDict['background PWDR'][2]) 1171 1171 hst = G2frame.GPXtree.GetItemText(G2frame.PatternId) 1172 1172 histList = GetHistsLikeSelected(G2frame) … … 1194 1194 for i,term in enumerate(bkDict['peaksList']): 1195 1195 term[1::2] = copy.copy(PKflags[i]) 1196 backData[1]['background PWDR'] = copy.copy(FBflag) 1196 try: 1197 backData[1]['background PWDR'][2] = FBflag 1198 except: 1199 backData[1]['background PWDR'] = ['',-1.,False] 1197 1200 1198 1201 def OnBackCopy(event): -
trunk/GSASIIstrMain.py
r4789 r4819 505 505 ''' 506 506 Removes unused parameters from phase varylist if phase not in histogram 507 #TODO - implement "Fix FXU" for seq refinement here - done?507 for seq refinement removes vars in "Fix FXU" and "FixedSeqVars" here 508 508 ''' 509 509 NewVary = [] … … 522 522 if 'M' in FixVals: 523 523 newVary = [item for item in newVary if not 'AM' in item] 524 removeVars = Phases[phase]['Histograms'][histogram].get('FixedSeqVars',[]) 525 newVary = [item for item in newVary if item not in removeVars] 524 526 NewVary += newVary 525 527 return NewVary … … 604 606 G2fil.G2Print("Error: not found!") 605 607 continue 606 #TODO - implement "Fix FXU" for seq refinement here - done?607 608 hId = Histograms[histogram]['hId'] 608 609 redphaseVary = phaseCheck(phaseVary,Phases,histogram)
Note: See TracChangeset
for help on using the changeset viewer.