Changeset 2956 for branch


Ignore:
Timestamp:
Aug 1, 2017 1:36:41 PM (6 years ago)
Author:
vondreele
Message:

Put all reverse/copy to next options on all 4 seq fits in G2pwdGUI

Location:
branch/2frame
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branch/2frame/GSASIIphsGUI.py

    r2955 r2956  
    63416341        for name in copyNames:
    63426342            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],
    63456344                'Copy phase/hist parameters', keyList)
    63466345        try:
     
    63896388            G2G.G2MessageBox(G2frame,'No histograms to copy to')
    63906389            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],
    63936391                'Copy phase/hist flags', keyList)
    63946392        try:
     
    64526450        for parm in selectedItems:
    64536451            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)
    64576454        try:
    64586455            if dlg.ShowModal() == wx.ID_OK:
     
    64816478                return
    64826479            dlg = G2G.G2MultiChoiceDialog(G2frame, 'Select powder histograms to use',
    6483                     'Use data',TextList)
     6480                'Use data',TextList)
    64846481            try:
    64856482                if dlg.ShowModal() == wx.ID_OK:
  • branch/2frame/GSASIIpwdGUI.py

    r2955 r2956  
    317317        G2frame.GPXtree.SetItemPyData(G2frame.PatternId,sourceData)
    318318       
    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...',
    322320        'Copy plot controls', histList)
    323321    results = []
     
    349347        return
    350348    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:]),
    354350        'Select copy sections', choices, filterBox=False)
    355351    dlg.SetSelections(range(len(choices)))
     
    359355    if not choiceList: return
    360356   
    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...',
    364358        'Copy parameters', histList)
    365359    results = []
     
    466460            return
    467461        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...',
    471463            'Copy peaks', histList)
    472464        try:
     
    526518    def OnSeqPeakFit(event):
    527519        histList = G2gd.GetGPXtreeDataNames(G2frame,['PWDR',])
     520        od = {'label_1':'Copy to next','value_1':False,'label_2':'Reverse order','value_2':False}
    528521        dlg = G2G.G2MultiChoiceDialog(G2frame, 'Sequential peak fits',
    529              'Select dataset to include',histList)
     522             'Select dataset to include',histList,extraOpts=od)
    530523        names = []
    531524        if dlg.ShowModal() == wx.ID_OK:
     
    543536        SeqResult = {'SeqPseudoVars':{},'SeqParFitEqList':[]}
    544537        SeqResult['histNames'] = names
    545         Reverse = False
    546         CopyForward = False
    547         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 = True
    553                 else:
    554                     Reverse = True
    555         dlg.Destroy()
    556538        dlg = wx.ProgressDialog('Sequential peak fit','Data set name = '+names[0],len(names),
    557539            style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME|wx.PD_CAN_ABORT)
     
    563545        peaks = None
    564546        varyList = None
    565         if Reverse:
     547        if od['value_2']:
    566548            names.reverse()
    567549        try:
     
    573555                    break
    574556                PatternId =  G2gd.GetGPXtreeItemId(G2frame,G2frame.root,name)
    575                 if i and CopyForward:
     557                if i and od['value_1']:
    576558                    G2frame.GPXtree.SetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Peak List'),copy.deepcopy(peaks))
    577559                    prevVaryList = varyList[:]
     
    735717        '''
    736718        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',
    740720            'Refinement Selection', sorted(refOpts.keys()),
    741721            filterBox=False,toggle=False)
     
    909889            G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame)
    910890            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...',
    914892            'Copy bkg flags', histList)
    915893        copyList = []
     
    13271305            G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame)
    13281306            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...',
    13321308            'Copy limits', histList)
    13331309        try:
     
    15321508        histList.insert(0,hst)
    15331509        saveList = []
    1534         dlg = G2G.G2MultiChoiceDialog(
    1535             G2frame,
    1536             'Save instrument parameters from',
     1510        dlg = G2G.G2MultiChoiceDialog(G2frame,'Save instrument parameters from',
    15371511            'Save instrument parameters', histList)
    15381512        try:
     
    15881562        instType = data['Type'][0]
    15891563        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:],
    15931565            'Copy refinement flags', histList)
    15941566        try:
     
    16201592        copyList = []
    16211593        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,
    16251595            'Copy parameters', histList)
    16261596        try:
     
    22132183            G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame)
    22142184            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...',
    22172186            'Copy sample parameters', histList)
    22182187        try:
     
    22492218        keyText, keyList = zip(*sorted(zip(keyText,keyList))) # sort lists
    22502219        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',
    22542221            'Select sample parameters', keyText)
    22552222        try:
     
    22622229        for parm in selectedKeys:
    22632230            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...',
    22672232            'Copy sample parameters', histList)
    22682233        try:
     
    22882253            G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame)
    22892254            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...',
    22932256            'Copy sample flags', histList)
    22942257        try:
     
    36913654            return
    36923655        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...',
    36963657            'Copy substances', histList)
    36973658        try:
     
    40153976            return
    40163977        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...',
    40203979            'Copy models', histList)
    40213980        try:
     
    40454004            G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame)
    40464005            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...',
    40504007            'Copy sample flags', histList)
    40514008        distChoice = ['LogNormal','Gaussian','LSW','Schulz-Zimm','Bragg','Unified',
     
    40784035    def OnFitModelAll(event):
    40794036        choices = G2gd.GetGPXtreeDataNames(G2frame,['SASD',])
     4037        od = {'label_1':'Copy to next','value_1':False,'label_2':'Reverse order','value_2':False}
    40804038        dlg = G2G.G2MultiChoiceDialog(G2frame, 'Sequential SASD refinement',
    4081              'Select dataset to include',choices)
     4039             'Select dataset to include',choices,extraOpts=od)
    40824040        names = []
    40834041        if dlg.ShowModal() == wx.ID_OK:
     
    40964054            return
    40974055        dlg.Destroy()
    4098         Reverse = False
    4099         CopyForward = False
    4100         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 = True
    4106                 else:
    4107                     Reverse = True
    4108         dlg.Destroy()
    41094056        dlg = wx.ProgressDialog('SASD Sequential fit','Data set name = '+names[0],len(names),
    41104057            style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME|wx.PD_CAN_ABORT)
    41114058        wx.BeginBusyCursor()
    4112         if Reverse:
     4059        if od['value_2']:
    41134060            names.reverse()
    41144061        JModel = None
     
    41204067                    break
    41214068                sId =  G2gd.GetGPXtreeItemId(G2frame,G2frame.root,name)
    4122                 if i and CopyForward:
     4069                if i and od['value_1']:
    41234070                    G2frame.GPXtree.SetItemPyData(G2gd.GetGPXtreeItemId(G2frame,sId, 'Models'),JModel)
    41244071                IProfDict,IProfile = G2frame.GPXtree.GetItemPyData(sId)[:2]
     
    47374684    def OnFitModelAll(event):
    47384685        choices = G2gd.GetGPXtreeDataNames(G2frame,['REFD',])
     4686        od = {'label_1':'Copy to next','value_1':False,'label_2':'Reverse order','value_2':False}
    47394687        dlg = G2G.G2MultiChoiceDialog(G2frame, 'Sequential REFD refinement',
    4740              'Select dataset to include',choices)
     4688             'Select dataset to include',choices,extraOpts=od)
    47414689        names = []
    47424690        if dlg.ShowModal() == wx.ID_OK:
     
    47554703            return
    47564704        dlg.Destroy()
    4757         Reverse = False
    4758         CopyForward = False
    4759         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 = True
    4765                 else:
    4766                     Reverse = True
    4767         dlg.Destroy()
    47684705        dlg = wx.ProgressDialog('REFD Sequential fit','Data set name = '+names[0],len(names),
    47694706            style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME|wx.PD_CAN_ABORT)
    47704707        wx.BeginBusyCursor()
    4771         if Reverse:
     4708        if od['value_2']:
    47724709            names.reverse()
    47734710        JModel = None
     
    47794716                    break
    47804717                sId =  G2gd.GetGPXtreeItemId(G2frame,G2frame.root,name)
    4781                 if i and CopyForward:
     4718                if i and od['value_1']:
    47824719                    G2frame.GPXtree.SetItemPyData(G2gd.GetGPXtreeItemId(G2frame,sId, 'Models'),JModel)
    47834720                IProfDict,IProfile = G2frame.GPXtree.GetItemPyData(sId)[:2]
     
    57625699            G2frame.ErrorDialog('Nothing to copy controls to','There must be more than one "PDF" pattern')
    57635700            return
    5764         od = {'label_1':'Only copy flags','value_1':False}
     5701        od = {'label_1':'Only refine flag','value_1':False}
    57655702        dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy PDF controls','Copy controls from '+Source+' to:',TextList,extraOpts=od)
    57665703        try:
     
    61086045            G2frame.ErrorDialog('Nothing to copy PDF peaks to','There must be more than one "PDF" pattern')
    61096046            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)
    61116049        try:
    61126050            if dlg.ShowModal() == wx.ID_OK:
     
    61156053                    id = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,item)
    61166054                    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))
    61186061                    G2frame.GPXtree.SetItemPyData(G2gd.GetGPXtreeItemId(G2frame,id, 'PDF Peaks'),olddata)
    61196062                G2frame.GetStatusBar().SetStatusText('PDF peaks copied',1)
     
    61366079    def OnFitAllPDFpeaks(event):
    61376080        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)
    61396083        try:
    61406084            if dlg.ShowModal() == wx.ID_OK:
     
    61476091                SeqResult = {'SeqPseudoVars':{},'SeqParFitEqList':[]}
    61486092                items = dlg.GetSelections()
     6093                if od['value_2']:
     6094                    items.reverse()
     6095                newpeaks = None
    61496096                G2frame.EnablePlot = False
    61506097                for item in items:
     
    61526099                    pId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,name)
    61536100                    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'))
    61556105                    newpeaks,vals,varyList,sigList,parmDict,Rvals = G2pwd.PDFPeakFit(peaks,data['G(R)'])
    61566106                    if vals is None:
     
    61636113                SeqResult['histNames'] = Names
    61646114                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'
    61656121        finally:
    61666122            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'
    61716123       
    61726124    def OnClearPDFpeaks(event):
Note: See TracChangeset for help on using the changeset viewer.