Ignore:
Timestamp:
May 6, 2018 2:13:25 PM (4 years ago)
Author:
toby
Message:

make sequential refinement setting work like a global flag; add indicator to g2frame legend; clean up constrain selection by showing only wildcards in seq; and not showing them in for non-eq.; speed up some calls of G2stIO.GetHistogramPhaseData? but providing only current histogram (in seq. ref.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIconstrGUI.py

    r3371 r3373  
    197197            phaseAtTypes[item] = ''
    198198             
    199     # create a list of the hist*phase variables; include wildcards here
    200     hapVary,hapDict,controlDict = G2stIO.GetHistogramPhaseData(Phases,Histograms,Print=False)
    201     hapList = [i for i in hapDict.keys() if i.split(':')[2] not in ('Type',)]
    202     hapList.sort()
    203     wildList = [] # list of variables with "*" for histogram number
    204     for i in hapList:
    205         s = i.split(':')
    206         if s[1] == "": continue
    207         s[1] = '*'
    208         sj = ':'.join(s)
    209         if sj not in wildList: wildList.append(sj)
    210     #wildList.sort() # unneeded
    211     hapList += wildList
    212     histVary,histDict,controlDict = G2stIO.GetHistogramData(Histograms,Print=False)
     199    # create a list of the hist*phase variables
     200    seqList = G2frame.testSeqRefineMode()
     201    if seqList: # for sequential refinement, only process 1st histgram in list
     202        histDict = {seqList[0]:Histograms[seqList[0]]}
     203    else:
     204        histDict = Histograms
     205    hapVary,hapDict,controlDict = G2stIO.GetHistogramPhaseData(Phases,histDict,Print=False)
     206    hapList = sorted([i for i in hapDict.keys() if i.split(':')[2] not in ('Type',)])
     207    if seqList: # convert histogram # to wildcard
     208        wildList = [] # list of variables with "*" for histogram number
     209        for i in hapList:
     210            s = i.split(':')
     211            if s[1] == "": continue
     212            s[1] = '*'
     213            sj = ':'.join(s)
     214            if sj not in wildList: wildList.append(sj)
     215        hapList = wildList
     216    histVary,histDict,controlDict = G2stIO.GetHistogramData(histDict,Print=False)
    213217    histList = []
    214218    for item in histDict:
     
    220224            histList.append(item)
    221225    histList.sort()
    222     wildList = []
    223     # for i in histList: # any reason to have this for hist constraints?
    224     #     s = i.split(':')
    225     #     if s[1] == "": continue
    226     #     s[1] = '*'
    227     #     sj = ':'.join(s)
    228     #     if sj not in wildList: wildList.append(sj)
    229     # histList += wildList
     226    if seqList: # convert histogram # to wildcard
     227        wildList = [] # list of variables with "*" for histogram number
     228        for i in histList:
     229            s = i.split(':')
     230            if s[1] == "": continue
     231            s[1] = '*'
     232            sj = ':'.join(s)
     233            if sj not in wildList: wildList.append(sj)
     234        histList = wildList
    230235    Indx = {}
    231236    G2frame.Page = [0,'phs']
     
    10811086        G2frame.dataWindow.ConstraintEdit.Enable(G2G.wxID_EQUIVALANCEATOMS,False)
    10821087#        G2frame.dataWindow.ConstraintEdit.Enable(G2G.wxID_ADDRIDING,False)
    1083         enableEditCons = True
    10841088        if text == 'Histogram/Phase':
     1089            enableEditCons = [False]+4*[True]
    10851090            G2frame.Page = [page,'hap']
    10861091            UpdateConstraintPanel(HAPConstr,'HAP')
    10871092        elif text == 'Histogram':
     1093            enableEditCons = [False]+4*[True]
    10881094            G2frame.Page = [page,'hst']
    10891095            UpdateConstraintPanel(HistConstr,'Hist')
    10901096        elif text == 'Phase':
     1097            enableEditCons = 5*[True]
    10911098            G2frame.Page = [page,'phs']
    10921099            G2frame.dataWindow.ConstraintEdit.Enable(G2G.wxID_EQUIVALANCEATOMS,True)
     
    10981105            UpdateConstraintPanel(PhaseConstr,'Phase')
    10991106        elif text == 'Global':
     1107            enableEditCons = [False]+4*[True]
    11001108            G2frame.Page = [page,'glb']
    11011109            UpdateConstraintPanel(GlobalConstr,'Global')
    11021110        else:
    1103             enableEditCons = False
     1111            enableEditCons = 5*[False]
    11041112            G2frame.Page = [page,'sym']
    11051113            UpdateConstraintPanel(SymConstr,'Sym-Generated')
    11061114        # remove menu items when not allowed
    1107         for i in G2frame.dataWindow.ConstraintEdit.GetMenuItems():
    1108             i.Enable(enableEditCons)
     1115        for obj,flag in zip(G2frame.dataWindow.ConstraintEdit.GetMenuItems(),enableEditCons):
     1116            obj.Enable(flag)
    11091117        G2frame.dataWindow.SetDataSize()
    11101118
Note: See TracChangeset for help on using the changeset viewer.