Ignore:
Timestamp:
Mar 12, 2014 3:46:47 PM (8 years ago)
Author:
toby
Message:

allow wildcarded-histogram constraint input; implement for seq refinements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImapvars.py

    r1243 r1247  
    416416            for var in constrDict[rel]:
    417417                if var.startswith('_'): continue
    418                 if not re.match('[0-9]*:[0-9]*:',var):
     418                if not re.match('[0-9]*:[0-9\*]*:',var):
    419419                    warnmsg += "\nVariable "+str(var)+" does not begin with a ':'"
    420420                if var in varyList:
     
    511511    return errmsg,warnmsg
    512512
    513 def GenerateConstraints(groups,parmlist,varyList,constrDict,fixedList,parmDict=None):
     513def GenerateConstraints(groups,parmlist,varyList,constrDict,fixedList,parmDict=None,SeqHist=None):
    514514    '''Takes a list of relationship entries comprising a group of
    515515    constraints and builds the relationship lists and their inverse
     
    535535      floats, float values or None if the constraint defines a new parameter.
    536536     
    537     :param dict constrDict: a list of dicts defining relationships/constraints.
    538 
     537    :param dict parmDict: a dict containing all parameters defined in current
     538      refinement.
     539
     540    :param int SeqHist: number of current histogram, when used in a sequential
     541      refinement. None (default) otherwise. Wildcard variable names are
     542      set to the current histogram, when found if not None.
    539543    '''
    540544    global dependentParmList,arrayList,invarrayList,indParmList,consNum
     
    630634            for var in constrDict[rel]:
    631635                if var.startswith('_'): continue
     636                if var.split(':')[1] == '*' and SeqHist is not None:
     637                    # convert wildcard var to current histogram
     638                    sv = var.split(':')
     639                    sv[1] = str(SeqHist)
     640                    var = ':'.join(sv)
    632641                if parmDict is not None and var not in parmDict:
    633642                    unused += 1
     
    673682            unused = 0
    674683            for var in VarKeys(constrDict[rel]):
     684                if var.split(':')[1] == '*' and SeqHist is not None:
     685                    # convert wildcard var to current histogram
     686                    sv = var.split(':')
     687                    sv[1] = str(SeqHist)
     688                    var = ':'.join(sv)
    675689                if parmDict is not None and var not in parmDict:
    676690                    unused += 1                   
Note: See TracChangeset for help on using the changeset viewer.