Ignore:
Timestamp:
Sep 28, 2020 1:23:10 PM (3 years ago)
Author:
toby
Message:

docs for freezing parameters started + docs cleanup; start scriptable for freezing params; record initial chi2; Show more post refinement info; noted but unfixed bkg GUI bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMain.py

    r4534 r4578  
    6161        ifPrint = False
    6262    Rvals = {}
     63    chisq0 = None
    6364    while True:
    6465        begin = time.time()
     
    9192            Rvals['lamMax'] = result[2]['lamMax']
    9293            Controls['Marquardt'] = -3  #reset to default
     94            if 'chisq0' in result[2] and chisq0 is None:
     95                chisq0 = result[2]['chisq0']
    9396        elif 'Hessian SVD' in Controls['deriv type']:
    9497            maxCyc = Controls['max cyc']
     
    102105                break
    103106            ncyc = result[2]['num cyc']+1
     107            if 'chisq0' in result[2] and chisq0 is None:
     108                chisq0 = result[2]['chisq0']
    104109        else:           #'numeric'
    105110            result = so.leastsq(G2stMth.errRefine,values,full_output=True,ftol=Ftol,epsfcn=1.e-8,factor=Factor,
     
    182187    if IfOK:
    183188        G2stMth.GetFobsSq(Histograms,Phases,parmDict,calcControls)
     189    if chisq0 is not None:
     190        Rvals['GOF0'] = np.sqrt(chisq0/(Histograms['Nobs']-len(varyList)))
    184191    return IfOK,Rvals,result,covMatrix,sig
    185192
     
    293300            G2stIO.SetHistogramPhaseData(parmDict,sigDict,Phases,Histograms,calcControls['FFtables'],pFile=printFile)
    294301            G2stIO.SetHistogramData(parmDict,sigDict,Histograms,calcControls['FFtables'],pFile=printFile)
    295             if len(frozen) > 0:
    296                 G2fil.G2Print(
    297                     ' {} variables were outside limits and were frozen (now {} frozen total)\n'
    298                     .format(len(frozen),len(parmFrozenList)))
     302            if len(frozen):
     303                msg = ('Warning: {} variable(s) refined outside limits and were frozen ({} total frozen)'
     304                    .format(len(frozen),len(parmFrozenList))
     305                    )
     306                G2fil.G2Print(msg)
     307                Rvals['msg'] = msg
     308            elif len(parmFrozenList):
     309                msg = ('Note: a total of {} variable(s) are frozen due to refining outside limits'
     310                    .format(len(parmFrozenList))
     311                    )
     312                G2fil.G2Print('Note: ',msg)
     313                Rvals['msg'] = msg
    299314            G2stIO.SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,rigidbodyDict,covData,parmFrozenList,makeBack)
    300315            printFile.close()
Note: See TracChangeset for help on using the changeset viewer.