Changeset 4534 for trunk/GSASIIstrIO.py


Ignore:
Timestamp:
Jul 27, 2020 10:42:49 PM (15 months ago)
Author:
toby
Message:

implement variable limits; show cell under Dij vals

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrIO.py

    r4520 r4534  
    132132    :return: dictionary of control items
    133133    '''
    134     Controls = copy.copy(G2obj.DefaultControls)
     134    Controls = copy.deepcopy(G2obj.DefaultControls)
    135135    IndexGPX(GPXfile)
    136136    pos = gpxIndex.get('Controls')
     
    648648    return GPXback
    649649
    650 def SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,RigidBodies,CovData,makeBack=True):
     650def SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,RigidBodies,CovData,parmFrozenList,makeBack=True):
    651651    ''' Updates gpxfile from all histograms that are found in any phase
    652652    and any phase that used a histogram. Also updates rigid body definitions.
     
    658658    :param dict RigidBodies: dictionary of rigid bodies
    659659    :param dict CovData: dictionary of refined variables, varyList, & covariance matrix
     660    :param list parmFrozenList: list of parameters that are frozen due to limits
    660661    :param bool makeBack: True if new backup of .gpx file is to be made; else use the last one made
    661662
     
    684685        elif datum[0] == 'Rigid bodies':
    685686            data[0][1] = RigidBodies
     687        elif datum[0] == 'Controls':
     688            Controls = data[0][1]
     689            if 'parmFrozen' not in Controls:
     690                Controls['parmFrozen'] = {}
     691            Controls['parmFrozen']['FrozenList'] = parmFrozenList
    686692        try:
    687693            histogram = Histograms[datum[0]]
     
    754760    fp.close()
    755761
    756 def SaveUpdatedHistogramsAndPhases(GPXfile,Histograms,Phases,RigidBodies,CovData):
     762def SaveUpdatedHistogramsAndPhases(GPXfile,Histograms,Phases,RigidBodies,CovData,parmFrozen):
    757763    '''
    758764    Save phase and histogram information into "pseudo-gpx" files. The phase
     
    765771    :param dict RigidBodies: dictionary of rigid bodies
    766772    :param dict CovData: dictionary of refined variables, varyList, & covariance matrix
     773    :param dict parmFrozen: dict with frozen parameters for all phases
    767774    '''
    768775                       
     
    785792    cPickle.dump([['Covariance',CovData]],fp,1)
    786793    cPickle.dump([['Rigid bodies',RigidBodies]],fp,1)
     794    cPickle.dump([['parmFrozen',parmFrozen]],fp,1)
    787795    fp.close()
    788796    # create an entry that looks like a PWDR tree item
     
    841849    Phases = {}
    842850    for name,vals in data[1:]:
    843         Phases[name] = vals
     851        Phases[name] = vals       
    844852    name,CovData = cPickleLoad(fp)[0] # 2nd block in file should be Covariance
    845853    name,RigidBodies = cPickleLoad(fp)[0] # 3rd block in file should be Rigid Bodies
     854    name,parmFrozen = cPickleLoad(fp)[0] # 4th block in file should be frozen parameters
    846855    fp.close()
    847856    GPXhist = os.path.splitext(GPXfile)[0]+'.seqHist'
     
    876885            data[0][1] = RigidBodies
    877886        elif datum[0] == 'Controls': # reset the Copy Next flag after a sequential fit
    878             data[0][1]['Copy2Next'] = False
     887            Controls = data[0][1]
     888            Controls['Copy2Next'] = False
     889            Controls['parmFrozen'] = parmFrozen
    879890        elif datum[0] in histIndex:
    880891            hist.seek(histIndex[datum[0]])
Note: See TracChangeset for help on using the changeset viewer.