Changeset 5216 for trunk


Ignore:
Timestamp:
Mar 13, 2022 11:38:03 AM (3 years ago)
Author:
toby
Message:

improve display of processed constraints

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/GSASIIconstrGUI.py

    r5182 r5216  
    13961396            btn = wx.Button(panel, wx.ID_ANY, 'Show generated constraints')
    13971397            butSizer.Add(btn,0,wx.ALIGN_CENTER_VERTICAL)
     1398            txt = G2mv.VarRemapShow(linelen=999).replace('&','&&')
    13981399            btn.Bind(wx.EVT_BUTTON,lambda event:
    13991400                         G2G.ShowScrolledColText(panel,
    1400                         '*** Constraints after processing ***'+G2mv.VarRemapShow(linelen=999),
     1401                        '*** Constraints after processing ***'+txt,
    14011402                         header='Generated constraints',col1len=80))
    14021403            panel.delBtn = wx.Button(panel, wx.ID_ANY, 'Delete selected')
  • TabularUnified trunk/GSASIIctrlGUI.py

    r5204 r5216  
    25652565    for i,line in enumerate(txt.split('\n')):
    25662566        if line.strip().endswith(':'):
    2567             st = wx.StaticText(spanel,wx.ID_ANY,line,style=wx.ALIGN_CENTER)
     2567            st = wx.StaticText(spanel,wx.ID_ANY,line)
    25682568            txtSizer.Add(st,pos=(i,0),span=(0,cols),flag=wx.EXPAND)
    25692569            continue
    25702570        elif line.strip().startswith('**') and line.strip().endswith('**'):
    2571             st = wx.StaticText(spanel,wx.ID_ANY,line)
     2571            st = wx.StaticText(spanel,wx.ID_ANY,line,style=wx.ALIGN_CENTER)
    25722572            st.SetBackgroundColour(DULL_YELLOW)
    25732573            txtSizer.Add(st,pos=(i,0),span=(0,cols),flag=wx.EXPAND)
     
    25842584            while col == 0 and len(t) > col1len:
    25852585                b = -1
    2586                 for sym in (') ',' * ',' + ',' - '):
    2587                     if sym in t[:col1len]:
    2588                         b = max(b,t.rfind(sym,0,col1len)+len(sym))
    2589                 s += t[:b] + '\n\t'
    2590                 t = t[b:]
     2586                for sym in (') ',' * ',' + ',' - ',' && '):
     2587                    b = max(b, t.rfind(sym,0,col1len))
     2588                if b > 20:
     2589                    s += t[:b+1]
     2590                    t = '\n\t' + t[b+1:]
     2591                    continue
     2592                break
    25912593            s += t
    25922594            st = wx.StaticText(spanel,wx.ID_ANY,s)
    2593             if col == 0: st.Wrap(600)
     2595            if col == 0: st.Wrap(650)  # last resort...
    25942596            st.SetBackgroundColour(wx.WHITE)
    25952597            txtSizer.Add(st,pos=(i,col),flag=wx.EXPAND)
    2596         txtSizer.AddGrowableRow(i)
     2598        #txtSizer.AddGrowableRow(i)
    25972599    txtSizer.AddGrowableCol(0)  #to fill screen
    25982600    spanel.SetSizer(txtSizer)
  • TabularUnified trunk/GSASIImapvars.py

    r5204 r5216  
    22262226                for v,m in zip(varlist,invmultarr):
    22272227                    if debug: print ('v,m[0]: ',v,m[0])
    2228                     if len(s1.split('\n')[-1]) > 75: s1 += '\n        '
    22292228                    if j > 0: s1 += ' & '
    22302229                    j += 1
    22312230                    s1 += str(v)
    22322231                    if m != 1:
    2233                         s1 += " / " + str(m[0])
     2232                        s1 += " / " + '{:.4f}'.format(m[0])
     2233                    #if len(s1.split('\n')[-1]) > 70:
     2234                    #    s1 = ' \n          &'.join(s1.rsplit('&',1))
    22342235                if symFlag:
    22352236                    symOut += s1 + '\n'
     
    23182319    return s
    23192320
     2321def getInvConstraintEq(var,varyList):
     2322    '''For a dependent variable, find the constraint that
     2323    defines the dependent variable in terms of varied independent variables.
     2324    This works for constraint equations (via new var or generated parameters)
     2325    or equivalences. For equivalences the result will lists of length 1
     2326   
     2327    :param str var: named of refined variable (e.g. 0:0:Scale)
     2328    :param list varyList: list of refined variables
     2329    :returns: vList,mList where vList is a list of variables and
     2330      mList is a list of multipliers for that variable (floats)
     2331    '''
     2332    for varlist,mapvars,invmultarr in zip(dependentParmList,indParmList,invarrayList):
     2333        if var not in varlist: continue
     2334        i = varlist.index(var)
     2335        print(var,i)
     2336        vList = []
     2337        mList = []
     2338        for m,v in zip(invmultarr[i,:],mapvars):
     2339            if v not in varyList: continue
     2340            if m == 0: continue
     2341            if v == 0: continue
     2342            vList.append(v)
     2343            mList.append(m)
     2344        return vList,mList
     2345    if GSASIIpath.GetConfigValue('debug'): print('getInvConstraintEq: not found: ',var)
     2346    return [],[]   # unexpected -- not an independent parameter
     2347   
    23202348def GetSymEquiv(seqmode,seqhistnum):
    23212349    '''Return the automatically generated (equivalence) relationships.
Note: See TracChangeset for help on using the changeset viewer.