Changeset 3100


Ignore:
Timestamp:
Sep 27, 2017 3:18:40 PM (4 years ago)
Author:
vondreele
Message:

implement fix FXU for sequential refinements

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIddataGUI.py

    r3092 r3100  
    829829            h,k,l = hkl
    830830            Obj.SetValue('%3d %3d %3d'%(h,k,l))
     831           
     832        def OnFixVals(event):
     833            Obj = event.GetEventObject()
     834            UseList[G2frame.hist]['Fix FXU'] = Obj.GetValue()
    831835
    832836        if G2frame.hist not in UseList:               
     
    842846        if 'Babinet' not in UseList[G2frame.hist]:
    843847            UseList[G2frame.hist]['Babinet'] = {'BabA':[0.0,False],'BabU':[0.0,False]}
    844         if 'Fix X' not in UseList[G2frame.hist]:
    845             UseList[G2frame.hist]['Fix F'] = False
    846             UseList[G2frame.hist]['Fix X'] = False
    847             UseList[G2frame.hist]['Fix U'] = False
     848        if 'Fix FXU' not in UseList[G2frame.hist]:
     849            UseList[G2frame.hist]['Fix FXU'] = ' '
    848850        bottomSizer = wx.BoxSizer(wx.VERTICAL)
    849851        useBox = wx.BoxSizer(wx.HORIZONTAL)
     
    859861            if UseList[G2frame.hist]['LeBail']:
    860862                G2frame.SetStatusText('To reset LeBail, cycle LeBail check box.',1)
     863        bottomSizer.Add(useBox,0,WACV|wx.TOP|wx.BOTTOM|wx.LEFT,5)
     864        fixBox = wx.BoxSizer(wx.HORIZONTAL)
     865        parmChoice = [' ','X','XU','U','F','FX','FXU','FU']
     866        if generalData['Type'] == 'magnetic':
     867            parmChoice += ['M','MX','MXU','MU','MF','MFX','MFXU','MFU']
     868        fixBox.Add(wx.StaticText(DData,label=' In sequential refinement, fix these in '+generalData['Name']+' for this histogram: '),0,WACV)
     869        fixVals = wx.ComboBox(DData,value=UseList[G2frame.hist]['Fix FXU'],choices=parmChoice,
     870            style=wx.CB_DROPDOWN)
     871        fixVals.Bind(wx.wx.EVT_COMBOBOX,OnFixVals)
     872        fixBox.Add(fixVals,0,WACV)
     873        bottomSizer.Add(fixBox)
    861874        #TODO - put Sequential refinement fix F? fix X? fix U? CheckBox here
    862         bottomSizer.Add(useBox,0,WACV|wx.TOP|wx.BOTTOM|wx.LEFT,5)
    863875       
    864876        bottomSizer.Add(ScaleSizer(),0,WACV|wx.BOTTOM,5)
  • trunk/GSASIIphsGUI.py

    r3099 r3100  
    63496349            G2G.G2MessageBox(G2frame,'No histograms to copy to')
    63506350            return
    6351         sourceDict = data['Histograms'][hist]
     6351        sourceDict = copy.deepcopy(data['Histograms'][hist])
    63526352        if 'HKLF' in sourceDict['Histogram']:
    6353             copyNames = ['Scale','Extinction','Babinet','Flack','Twins']
     6353            copyNames = ['Scale','Extinction','Babinet','Flack','Twins','Fix FXU']
    63546354        else:  #PWDR 
    6355             copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail','newLeBail',]
     6355            copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail','newLeBail','Fix FXU']
    63566356        copyDict = {}
    63576357        for name in copyNames:
    6358             copyDict[name] = copy.deepcopy(sourceDict[name])        #force copy
     6358            copyDict[name] = sourceDict[name]        #force copy
    63596359        dlg = G2G.G2MultiChoiceDialog(G2frame,u'Copy phase/histogram parameters\nfrom '+hist[5:][:35],
    63606360                'Copy phase/hist parameters', keyList)
     
    63626362            if dlg.ShowModal() == wx.ID_OK:
    63636363                for sel in dlg.GetSelections():
    6364                     data['Histograms'][keyList[sel]].update(copy.deepcopy(copyDict))
     6364                    data['Histograms'][keyList[sel]].update(copyDict)
    63656365        finally:
    63666366            dlg.Destroy()
     
    63686368    def OnDataCopyFlags(event):
    63696369        hist = G2frame.hist
    6370         sourceDict = data['Histograms'][hist]
     6370        sourceDict = copy.deepcopy(data['Histograms'][hist])
    63716371        copyDict = {}
    63726372        if 'HKLF' in sourceDict['Histogram']:
    6373             copyNames = ['Scale','Extinction','Babinet','Flack','Twins']
     6373            copyNames = ['Scale','Extinction','Babinet','Flack','Twins','Fix FXU']
    63746374        else:  #PWDR 
    6375             copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet']
     6375            copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','Fix FXU']
    63766376        babNames = ['BabA','BabU']
    63776377        for name in copyNames:
     
    63986398                copyDict[name] = {}
    63996399                for bab in babNames:
    6400                     copyDict[name][bab] = sourceDict[name][bab][1]                       
     6400                    copyDict[name][bab] = sourceDict[name][bab][1]
     6401            elif name == 'Fix FXU':
     6402                copyDict[name] = sourceDict[name]                     
    64016403        keyList = G2frame.dataWindow.HistsInPhase[:]
    64026404        if hist in keyList: keyList.remove(hist)
     
    64376439                        elif name == 'Babinet':
    64386440                            for bab in babNames:
    6439                                 data['Histograms'][item][name][bab][1] = copy.deepcopy(copyDict[name][bab])                                             
     6441                                data['Histograms'][item][name][bab][1] = copy.deepcopy(copyDict[name][bab])
     6442                        elif name == 'Fix FXU':
     6443                            data['Histograms'][item][name] = copy.deepcopy(sourceDict[name])                     
    64406444        finally:
    64416445            dlg.Destroy()
     
    64516455        copyDict = {}
    64526456        if 'HKLF' in sourceDict['Histogram']:
    6453             copyNames = ['Scale','Extinction','Babinet','Flack','Twins']
     6457            copyNames = ['Scale','Extinction','Babinet','Flack','Twins','Fix FXU']
    64546458        else:  #PWDR 
    6455             copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail']
     6459            copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail','Fix FXU']
    64566460        dlg = G2G.G2MultiChoiceDialog(G2frame,'Select which parameters to copy',
    64576461            'Select phase data parameters', copyNames)
     
    65106514                                NShkl*[0.01,],NShkl*[False,]],
    65116515                            'HStrain':[NDij*[0.0,],NDij*[False,]],                         
    6512                             'Extinction':[0.0,False],'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]}}
     6516                            'Extinction':[0.0,False],'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]},'Fix FXU':' '}
    65136517                        refList = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,Id,'Reflection Lists'))
    65146518                        refList[generalData['Name']] = {}                       
  • trunk/GSASIIstrMain.py

    r3095 r3100  
    261261    '''
    262262    Removes unused parameters from phase varylist if phase not in histogram
    263     #TODO - implement "Fix F,X,U" for seq refinement here
     263    #TODO - implement "Fix FXU" for seq refinement here - done?
    264264    '''
    265     pIds = []
     265    NewVary = []
    266266    for phase in Phases:
    267267        if histogram not in Phases[phase]['Histograms']: continue
    268268        if Phases[phase]['Histograms'][histogram]['Use']:
    269             pIds.append(str(Phases[phase]['pId']))
    270     return [item for item in phaseVary if item.split(':')[0] in pIds]
     269            pId = Phases[phase]['pId']
     270            newVary = [item for item in phaseVary if item.split(':')[0] == str(pId)]
     271            FixVals = Phases[phase]['Histograms'][histogram].get('Fix FXU',' ')
     272            if 'F' in FixVals:
     273                newVary = [item for item in newVary if not 'AF' in item]
     274            if 'X' in FixVals:
     275                newVary = [item for item in newVary if not 'dA' in item]
     276            if 'U' in FixVals:
     277                newVary = [item for item in newVary if not 'AU' in item]
     278            if 'M' in FixVals:
     279                newVary = [item for item in newVary if not 'AM' in item]
     280            NewVary += newVary
     281    return NewVary
    271282
    272283def SeqRefine(GPXfile,dlg,PlotFunction=None,G2frame=None):
     
    334345            print("Error: not found!")
    335346            continue
    336     #TODO - implement "Fix F,X,U" for seq refinement here
     347    #TODO - implement "Fix FXU" for seq refinement here - done?
     348        redphaseVary = phaseCheck(phaseVary,Phases,histogram)
    337349        Histo = {histogram:Histograms[histogram],}
    338         redphaseVary = phaseCheck(phaseVary,Phases,histogram)
    339350        hapVary,hapDict,controlDict = G2stIO.GetHistogramPhaseData(Phases,Histo,Print=False)
    340351        calcControls.update(controlDict)
Note: See TracChangeset for help on using the changeset viewer.