Changeset 411 for trunk/GSASIImapvars.py


Ignore:
Timestamp:
Nov 11, 2011 2:14:35 PM (10 years ago)
Author:
vondreele
Message:

fix very old (!) bug in psvfcj.for
implement neutron scattering lengths in GSASII including the dozen anomalous scattering isotopes
isotope choice is in General
so GSASII will now do neutron CW Rietveld refinements
some cleanup of the constraints GUI
remove varyList from GSASIImapvars.py globals

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImapvars.py

    r407 r411  
    9090     each group. This contains both parameters used in parameter
    9191     redefinitions as well as names of generated new parameters.
    92    varyList: a list of parameters that have been flagged to be varied.
    9392   
    9493   arrayList: a list by group of relationship matrices to relate
     
    116115fixedDict = {} # a dictionary containing the fixed values corresponding to defined parameter equations
    117116               # key is original ascii string, value is float
    118 varyList = [] # a list of varied constraints
    119117
    120118# compile regular expressions used for parsing input
     
    132130def InitVars():
    133131    '''Initializes all constraint information'''
    134     global dependentParmList,arrayList,invarrayList,indParmList,fixedDict,varyList,consNum
     132    global dependentParmList,arrayList,invarrayList,indParmList,fixedDict,consNum
    135133    dependentParmList = [] # contains a list of parameters in each group
    136134    arrayList = [] # a list of of relationship matrices
     
    138136    indParmList = [] # a list of names for the new parameters
    139137    fixedDict = {} # a dictionary containing the fixed values corresponding to defined parameter equations
    140     varyList = [] # a list of varied constraints
    141138    consNum = 0 # number of the next constraint to be created
    142139
     
    301298    return groups,ParmList
    302299
    303 def GenerateConstraints(groups,parmlist,constrDict,constrFlag,fixedList):
     300def GenerateConstraints(groups,parmlist,varyList,constrDict,constrFlag,fixedList):
    304301    '''Takes a list of relationship entries comprising a group of constraints and
    305302    builds the relationship lists and their inverse and stores them in global variables
    306303    '''
    307     global dependentParmList,arrayList,invarrayList,indParmList,varyList,consNum
     304    global dependentParmList,arrayList,invarrayList,indParmList,consNum
    308305    for group,varlist in zip(groups,parmlist):
    309306        VaryFree = False
     
    337334    # key is original ascii string, value is float
    338335    for fixedval in fixedList:
    339         if fixedval is not None:
     336        if fixedval:
    340337            fixedDict[fixedval] = float(fixedval)
    341338
     
    385382    return
    386383
    387 def VarRemapShow():
     384def VarRemapShow(varyList):
    388385    '''List out the saved relationships.
    389386    Returns a string containing the details.
    390387    '''
    391388    s = 'Mapping relations:\n'
    392     global dependentParmList,arrayList,invarrayList,indParmList,fixedDict,varyList
     389    global dependentParmList,arrayList,invarrayList,indParmList,fixedDict
    393390    for varlist,mapvars,multarr in zip(dependentParmList,indParmList,arrayList):
    394391        i = 0
     
    443440                pass
    444441        if multarr is None: continue
    445         valuelist = [parmdict[var] for var in varlist]
     442        valuelist = [parmDict[var] for var in varlist]
    446443        parmDict.update(zip(mapvars,
    447444                            np.dot(multarr,np.array(valuelist)))
     
    450447    parmDict.update(fixedDict)
    451448
    452 def Dict2Map(parmDict):
     449def Dict2Map(parmDict,varyList):
     450    #I think this needs fixing to update parmDict with new values
     451    #   from the constraints based on what is in varyList - RVD
    453452    '''Convert the remapped values back to the original parameters
    454453   
     
    458457    '''
    459458    global dependentParmList,arrayList,invarrayList,indParmList,fixedDict
    460     # reset fixed values (should not be needed, but very quick)
     459    # reset fixed values (should not be needed, but very quick)
     460    # - this seems to update parmDict with {'0':0.0} & {'1.0':1.0} - probably not what was intended
    461461    parmDict.update(fixedDict)
    462462    for varlist,mapvars,invmultarr in zip(dependentParmList,indParmList,invarrayList):
     
    675675
    676676    before = parmdict.copy()
    677     Dict2Map(parmdict)
     677    Dict2Map(parmdict,[])
    678678    print 'after Dict2Map'
    679679    print '  key / before / after'
Note: See TracChangeset for help on using the changeset viewer.