Changeset 2956
- Timestamp:
- Aug 1, 2017 1:36:41 PM (6 years ago)
- Location:
- branch/2frame
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branch/2frame/GSASIIphsGUI.py
r2955 r2956 6341 6341 for name in copyNames: 6342 6342 copyDict[name] = copy.deepcopy(sourceDict[name]) #force copy 6343 dlg = G2G.G2MultiChoiceDialog(G2frame, 6344 u'Copy phase/histogram parameters\nfrom '+hist[5:][:35], 6343 dlg = G2G.G2MultiChoiceDialog(G2frame,u'Copy phase/histogram parameters\nfrom '+hist[5:][:35], 6345 6344 'Copy phase/hist parameters', keyList) 6346 6345 try: … … 6389 6388 G2G.G2MessageBox(G2frame,'No histograms to copy to') 6390 6389 return 6391 dlg = G2G.G2MultiChoiceDialog(G2frame, 6392 u'Copy phase/histogram flags\nfrom '+hist[5:][:35], 6390 dlg = G2G.G2MultiChoiceDialog(G2frame,u'Copy phase/histogram flags\nfrom '+hist[5:][:35], 6393 6391 'Copy phase/hist flags', keyList) 6394 6392 try: … … 6452 6450 for parm in selectedItems: 6453 6451 copyDict[parm] = copy.deepcopy(sourceDict[parm]) 6454 dlg = G2G.G2MultiChoiceDialog(G2frame, 6455 u'Copy selected phase/histogram parameters\nfrom '+hist[5:][:35], 6456 'Copy selected phase/hist parameters', keyList) 6452 dlg = G2G.G2MultiChoiceDialog(G2frame,u'Copy selected phase/histogram parameters\nfrom '+hist[5:][:35], 6453 'Copy selected phase/hist parameters', keyList) 6457 6454 try: 6458 6455 if dlg.ShowModal() == wx.ID_OK: … … 6481 6478 return 6482 6479 dlg = G2G.G2MultiChoiceDialog(G2frame, 'Select powder histograms to use', 6483 6480 'Use data',TextList) 6484 6481 try: 6485 6482 if dlg.ShowModal() == wx.ID_OK: -
branch/2frame/GSASIIpwdGUI.py
r2955 r2956 317 317 G2frame.GPXtree.SetItemPyData(G2frame.PatternId,sourceData) 318 318 319 dlg = G2G.G2MultiChoiceDialog( 320 G2frame, 321 'Copy plot controls from\n'+str(hst[5:])+' to...', 319 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy plot controls from\n'+str(hst[5:])+' to...', 322 320 'Copy plot controls', histList) 323 321 results = [] … … 349 347 return 350 348 choices = ['Limits','Background','Instrument Parameters','Sample Parameters'] 351 dlg = G2G.G2MultiChoiceDialog( 352 G2frame, 353 'Copy which histogram sections from\n'+str(hst[5:]), 349 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy which histogram sections from\n'+str(hst[5:]), 354 350 'Select copy sections', choices, filterBox=False) 355 351 dlg.SetSelections(range(len(choices))) … … 359 355 if not choiceList: return 360 356 361 dlg = G2G.G2MultiChoiceDialog( 362 G2frame, 363 'Copy parameters from\n'+str(hst[5:])+' to...', 357 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy parameters from\n'+str(hst[5:])+' to...', 364 358 'Copy parameters', histList) 365 359 results = [] … … 466 460 return 467 461 copyList = [] 468 dlg = G2G.G2MultiChoiceDialog( 469 G2frame, 470 'Copy peak list from\n'+str(hst[5:])+' to...', 462 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy peak list from\n'+str(hst[5:])+' to...', 471 463 'Copy peaks', histList) 472 464 try: … … 526 518 def OnSeqPeakFit(event): 527 519 histList = G2gd.GetGPXtreeDataNames(G2frame,['PWDR',]) 520 od = {'label_1':'Copy to next','value_1':False,'label_2':'Reverse order','value_2':False} 528 521 dlg = G2G.G2MultiChoiceDialog(G2frame, 'Sequential peak fits', 529 'Select dataset to include',histList )522 'Select dataset to include',histList,extraOpts=od) 530 523 names = [] 531 524 if dlg.ShowModal() == wx.ID_OK: … … 543 536 SeqResult = {'SeqPseudoVars':{},'SeqParFitEqList':[]} 544 537 SeqResult['histNames'] = names 545 Reverse = False546 CopyForward = False547 choice = ['Reverse sequence','Copy from prev.',]548 dlg = wx.MultiChoiceDialog(G2frame,'Sequential controls','Select controls',choice)549 if dlg.ShowModal() == wx.ID_OK:550 for sel in dlg.GetSelections():551 if sel:552 CopyForward = True553 else:554 Reverse = True555 dlg.Destroy()556 538 dlg = wx.ProgressDialog('Sequential peak fit','Data set name = '+names[0],len(names), 557 539 style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME|wx.PD_CAN_ABORT) … … 563 545 peaks = None 564 546 varyList = None 565 if Reverse:547 if od['value_2']: 566 548 names.reverse() 567 549 try: … … 573 555 break 574 556 PatternId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,name) 575 if i and CopyForward:557 if i and od['value_1']: 576 558 G2frame.GPXtree.SetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Peak List'),copy.deepcopy(peaks)) 577 559 prevVaryList = varyList[:] … … 735 717 ''' 736 718 refOpts = {reflGrid.GetColLabelValue(i):i+1 for i in range(reflGrid.GetNumberCols()) if reflGrid.GetColLabelValue(i) != "refine"} 737 dlg = G2G.G2MultiChoiceDialog( 738 G2frame, 739 'Select columns to refine', 719 dlg = G2G.G2MultiChoiceDialog(G2frame,'Select columns to refine', 740 720 'Refinement Selection', sorted(refOpts.keys()), 741 721 filterBox=False,toggle=False) … … 909 889 G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame) 910 890 return 911 dlg = G2G.G2MultiChoiceDialog( 912 G2frame, 913 'Copy bkg ref. flags from\n'+str(hst[5:])+' to...', 891 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy bkg ref. flags from\n'+str(hst[5:])+' to...', 914 892 'Copy bkg flags', histList) 915 893 copyList = [] … … 1327 1305 G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame) 1328 1306 return 1329 dlg = G2G.G2MultiChoiceDialog( 1330 G2frame, 1331 'Copy limits from\n'+str(hst[5:])+' to...', 1307 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy limits from\n'+str(hst[5:])+' to...', 1332 1308 'Copy limits', histList) 1333 1309 try: … … 1532 1508 histList.insert(0,hst) 1533 1509 saveList = [] 1534 dlg = G2G.G2MultiChoiceDialog( 1535 G2frame, 1536 'Save instrument parameters from', 1510 dlg = G2G.G2MultiChoiceDialog(G2frame,'Save instrument parameters from', 1537 1511 'Save instrument parameters', histList) 1538 1512 try: … … 1588 1562 instType = data['Type'][0] 1589 1563 copyList = [] 1590 dlg = G2G.G2MultiChoiceDialog( 1591 G2frame, 1592 'Copy inst ref. flags from\n'+hst[5:], 1564 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy inst ref. flags from\n'+hst[5:], 1593 1565 'Copy refinement flags', histList) 1594 1566 try: … … 1620 1592 copyList = [] 1621 1593 instType = data['Type'][0] 1622 dlg = G2G.G2MultiChoiceDialog( 1623 G2frame, 1624 'Copy inst params from\n'+hst, 1594 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy inst params from\n'+hst, 1625 1595 'Copy parameters', histList) 1626 1596 try: … … 2213 2183 G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame) 2214 2184 return 2215 dlg = G2G.G2MultiChoiceDialog(G2frame, 2216 'Copy sample params from\n'+str(hst[5:])+' to...', 2185 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy sample params from\n'+str(hst[5:])+' to...', 2217 2186 'Copy sample parameters', histList) 2218 2187 try: … … 2249 2218 keyText, keyList = zip(*sorted(zip(keyText,keyList))) # sort lists 2250 2219 selectedKeys = [] 2251 dlg = G2G.G2MultiChoiceDialog( 2252 G2frame, 2253 'Select which sample parameters\nto copy', 2220 dlg = G2G.G2MultiChoiceDialog(G2frame,'Select which sample parameters\nto copy', 2254 2221 'Select sample parameters', keyText) 2255 2222 try: … … 2262 2229 for parm in selectedKeys: 2263 2230 copyDict[parm] = data[parm] 2264 dlg = G2G.G2MultiChoiceDialog( 2265 G2frame, 2266 'Copy sample params from\n'+str(hst[5:])+' to...', 2231 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy sample params from\n'+str(hst[5:])+' to...', 2267 2232 'Copy sample parameters', histList) 2268 2233 try: … … 2288 2253 G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame) 2289 2254 return 2290 dlg = G2G.G2MultiChoiceDialog( 2291 G2frame, 2292 'Copy sample ref. flags from\n'+str(hst[5:])+' to...', 2255 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy sample ref. flags from\n'+str(hst[5:])+' to...', 2293 2256 'Copy sample flags', histList) 2294 2257 try: … … 3691 3654 return 3692 3655 copyList = [] 3693 dlg = G2G.G2MultiChoiceDialog( 3694 G2frame, 3695 'Copy substances from\n'+hst[5:]+' to...', 3656 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy substances from\n'+hst[5:]+' to...', 3696 3657 'Copy substances', histList) 3697 3658 try: … … 4015 3976 return 4016 3977 copyList = [] 4017 dlg = G2G.G2MultiChoiceDialog( 4018 G2frame, 4019 'Copy models from\n'+hst[5:]+' to...', 3978 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy models from\n'+hst[5:]+' to...', 4020 3979 'Copy models', histList) 4021 3980 try: … … 4045 4004 G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame) 4046 4005 return 4047 dlg = G2G.G2MultiChoiceDialog( 4048 G2frame, 4049 'Copy sample ref. flags from\n'+str(hst[5:])+' to...', 4006 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy sample ref. flags from\n'+str(hst[5:])+' to...', 4050 4007 'Copy sample flags', histList) 4051 4008 distChoice = ['LogNormal','Gaussian','LSW','Schulz-Zimm','Bragg','Unified', … … 4078 4035 def OnFitModelAll(event): 4079 4036 choices = G2gd.GetGPXtreeDataNames(G2frame,['SASD',]) 4037 od = {'label_1':'Copy to next','value_1':False,'label_2':'Reverse order','value_2':False} 4080 4038 dlg = G2G.G2MultiChoiceDialog(G2frame, 'Sequential SASD refinement', 4081 'Select dataset to include',choices )4039 'Select dataset to include',choices,extraOpts=od) 4082 4040 names = [] 4083 4041 if dlg.ShowModal() == wx.ID_OK: … … 4096 4054 return 4097 4055 dlg.Destroy() 4098 Reverse = False4099 CopyForward = False4100 choice = ['Reverse sequence','Copy from prev.']4101 dlg = wx.MultiChoiceDialog(G2frame,'Sequential controls','Select controls',choice)4102 if dlg.ShowModal() == wx.ID_OK:4103 for sel in dlg.GetSelections():4104 if sel:4105 CopyForward = True4106 else:4107 Reverse = True4108 dlg.Destroy()4109 4056 dlg = wx.ProgressDialog('SASD Sequential fit','Data set name = '+names[0],len(names), 4110 4057 style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME|wx.PD_CAN_ABORT) 4111 4058 wx.BeginBusyCursor() 4112 if Reverse:4059 if od['value_2']: 4113 4060 names.reverse() 4114 4061 JModel = None … … 4120 4067 break 4121 4068 sId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,name) 4122 if i and CopyForward:4069 if i and od['value_1']: 4123 4070 G2frame.GPXtree.SetItemPyData(G2gd.GetGPXtreeItemId(G2frame,sId, 'Models'),JModel) 4124 4071 IProfDict,IProfile = G2frame.GPXtree.GetItemPyData(sId)[:2] … … 4737 4684 def OnFitModelAll(event): 4738 4685 choices = G2gd.GetGPXtreeDataNames(G2frame,['REFD',]) 4686 od = {'label_1':'Copy to next','value_1':False,'label_2':'Reverse order','value_2':False} 4739 4687 dlg = G2G.G2MultiChoiceDialog(G2frame, 'Sequential REFD refinement', 4740 'Select dataset to include',choices )4688 'Select dataset to include',choices,extraOpts=od) 4741 4689 names = [] 4742 4690 if dlg.ShowModal() == wx.ID_OK: … … 4755 4703 return 4756 4704 dlg.Destroy() 4757 Reverse = False4758 CopyForward = False4759 choice = ['Reverse sequence','Copy from prev.']4760 dlg = wx.MultiChoiceDialog(G2frame,'Sequential controls','Select controls',choice)4761 if dlg.ShowModal() == wx.ID_OK:4762 for sel in dlg.GetSelections():4763 if sel:4764 CopyForward = True4765 else:4766 Reverse = True4767 dlg.Destroy()4768 4705 dlg = wx.ProgressDialog('REFD Sequential fit','Data set name = '+names[0],len(names), 4769 4706 style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME|wx.PD_CAN_ABORT) 4770 4707 wx.BeginBusyCursor() 4771 if Reverse:4708 if od['value_2']: 4772 4709 names.reverse() 4773 4710 JModel = None … … 4779 4716 break 4780 4717 sId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,name) 4781 if i and CopyForward:4718 if i and od['value_1']: 4782 4719 G2frame.GPXtree.SetItemPyData(G2gd.GetGPXtreeItemId(G2frame,sId, 'Models'),JModel) 4783 4720 IProfDict,IProfile = G2frame.GPXtree.GetItemPyData(sId)[:2] … … 5762 5699 G2frame.ErrorDialog('Nothing to copy controls to','There must be more than one "PDF" pattern') 5763 5700 return 5764 od = {'label_1':'Only copy flags','value_1':False}5701 od = {'label_1':'Only refine flag','value_1':False} 5765 5702 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy PDF controls','Copy controls from '+Source+' to:',TextList,extraOpts=od) 5766 5703 try: … … 6108 6045 G2frame.ErrorDialog('Nothing to copy PDF peaks to','There must be more than one "PDF" pattern') 6109 6046 return 6110 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy PDF peaks','Copy peaks from '+Source+' to:',TextList) 6047 od = {'label_1':'Only refine flags','value_1':False} 6048 dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy PDF peaks','Copy peaks from '+Source+' to:',TextList,extraOpts=od) 6111 6049 try: 6112 6050 if dlg.ShowModal() == wx.ID_OK: … … 6115 6053 id = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,item) 6116 6054 olddata = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,id, 'PDF Peaks')) 6117 olddata.update(copy.deepcopy(peaks)) 6055 if od['value_1']: 6056 olddata['Background'][2] = peaks['Background'][2] 6057 for ip,peak in enumerate(olddata['Peaks']): 6058 peak[3] = peaks['Peaks'][ip][3] 6059 else: 6060 olddata.update(copy.deepcopy(peaks)) 6118 6061 G2frame.GPXtree.SetItemPyData(G2gd.GetGPXtreeItemId(G2frame,id, 'PDF Peaks'),olddata) 6119 6062 G2frame.GetStatusBar().SetStatusText('PDF peaks copied',1) … … 6136 6079 def OnFitAllPDFpeaks(event): 6137 6080 Names = G2gd.GetGPXtreeDataNames(G2frame,['PDF ',]) 6138 dlg = G2G.G2MultiChoiceDialog(G2frame,'PDF peak fitting','Select PDFs to fit:',Names) 6081 od = {'label_1':'Copy to next','value_1':False,'label_2':'Reverse order','value_2':False} 6082 dlg = G2G.G2MultiChoiceDialog(G2frame,'PDF peak fitting','Select PDFs to fit:',Names,extraOpts=od) 6139 6083 try: 6140 6084 if dlg.ShowModal() == wx.ID_OK: … … 6147 6091 SeqResult = {'SeqPseudoVars':{},'SeqParFitEqList':[]} 6148 6092 items = dlg.GetSelections() 6093 if od['value_2']: 6094 items.reverse() 6095 newpeaks = None 6149 6096 G2frame.EnablePlot = False 6150 6097 for item in items: … … 6152 6099 pId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,name) 6153 6100 data = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,pId, 'PDF Controls')) 6154 peaks = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,pId,'PDF Peaks')) 6101 if od['value_1'] and newpeaks is not None: 6102 peaks = copy.deepcopy(newpeaks) 6103 else: 6104 peaks = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,pId,'PDF Peaks')) 6155 6105 newpeaks,vals,varyList,sigList,parmDict,Rvals = G2pwd.PDFPeakFit(peaks,data['G(R)']) 6156 6106 if vals is None: … … 6163 6113 SeqResult['histNames'] = Names 6164 6114 G2frame.G2plotNB.Delete('Sequential refinement') #clear away probably invalid plot 6115 G2plt.PlotISFG(G2frame,data,peaks=newpeaks,newPlot=False) 6116 G2frame.GPXtree.SetItemPyData(Id,SeqResult) 6117 G2frame.GPXtree.SelectItem(Id) 6118 print 'All PDFs peak fitted - results in Sequential PDF peak fit results' 6119 else: 6120 print 'Sequential fit cancelled' 6165 6121 finally: 6166 6122 dlg.Destroy() 6167 G2plt.PlotISFG(G2frame,data,peaks=newpeaks,newPlot=False)6168 G2frame.GPXtree.SetItemPyData(Id,SeqResult)6169 G2frame.GPXtree.SelectItem(Id)6170 print 'All PDFs peak fitted - results in Sequential PDF peak fit results'6171 6123 6172 6124 def OnClearPDFpeaks(event):
Note: See TracChangeset
for help on using the changeset viewer.