Ignore:
Timestamp:
Apr 18, 2014 10:22:29 AM (8 years ago)
Author:
toby
Message:

sequential refinement updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMain.py

    r1248 r1282  
    4646def RefineCore(Controls,Histograms,Phases,restraintDict,rigidbodyDict,parmDict,varyList,
    4747    calcControls,pawleyLookup,ifPrint,printFile,dlg):
     48    'Core optimization routines, shared between SeqRefine and Refine'
    4849#    print 'current',varyList
    4950#    for item in parmDict: print item,parmDict[item] ######### show dict just before refinement
     
    7374#        for item in table: print item,table[item]               #useful debug - are things shifting?
    7475        runtime = time.time()-begin
     76        Rvals['converged'] = result[2].get('Converged')
     77        Rvals['DelChi2'] = result[2].get('DelChi2',-1.)
    7578        Rvals['chisq'] = np.sum(result[2]['fvec']**2)
    7679        G2stMth.Values2Dict(parmDict, varyList, result[0])
     
    109112
    110113def Refine(GPXfile,dlg):
    111     'Needs a doc string'
     114    'Global refinement -- refines to minimize against all histograms'
    112115    import pytexture as ptx
    113116    ptx.pyqlmninit()            #initialize fortran arrays for spherical harmonics
     
    206209
    207210def SeqRefine(GPXfile,dlg):
    208     'Needs a doc string'
     211    '''Perform a sequential refinement -- cycles through all selected histgrams,
     212    one at a time
     213    '''
    209214    import pytexture as ptx
    210215    ptx.pyqlmninit()            #initialize fortran arrays for spherical harmonics
     
    329334            #if warnmsg: print 'Warnings',warnmsg
    330335            raise Exception(' *** Refine aborted ***')
    331         print G2mv.VarRemapShow(varyList)
     336        #print G2mv.VarRemapShow(varyList)
    332337       
    333338        ifPrint = False
     
    336341        Rvals,result,covMatrix,sig = RefineCore(Controls,Histo,Phases,restraintDict,
    337342            rigidbodyDict,parmDict,varyList,calcControls,pawleyLookup,ifPrint,printFile,dlg)
    338            
     343
     344        # add the uncertainties into the esd dictionary (sigDict)
    339345        sigDict = dict(zip(varyList,sig))
     346        # the uncertainties for dependent constrained parms into the esd dict
     347        sigDict.update(G2mv.ComputeDepESD(covMatrix,varyList,parmDict))
     348
     349        # a dict with values & esds for dependent (constrained) parameters
     350        depParmDict = {i:(parmDict[i],sigDict[i]) for i in varyListStart
     351                       if i not in varyList}
    340352        newCellDict = copy.deepcopy(G2stMth.GetNewCellParms(parmDict,varyList))
    341353        newAtomDict = copy.deepcopy(G2stMth.ApplyXYZshifts(parmDict,varyList))
     
    343355                   'varyListStart':varyListStart,
    344356                   'covMatrix':covMatrix,'title':histogram,'newAtomDict':newAtomDict,
    345                    'newCellDict':newCellDict}
    346         # add the uncertainties into the esd dictionary (sigDict)
     357                   'newCellDict':newCellDict,'depParmDict':depParmDict}
    347358        G2stMth.ApplyRBModels(parmDict,Phases,rigidbodyDict,True)
    348359#        G2stIO.SetRigidBodyModels(parmDict,sigDict,rigidbodyDict,printFile)
Note: See TracChangeset for help on using the changeset viewer.