Changeset 362 for trunk/GSASIIstruct.py


Ignore:
Timestamp:
Sep 4, 2011 8:04:31 AM (11 years ago)
Author:
vondreele
Message:

add shift factor to LS controls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstruct.py

    r360 r362  
    4444        Controls = dictionary of control items
    4545    '''
     46    Controls = {'deriv type':'analytical','min dM/M':0.0001,'shift factor':1.}
    4647    file = open(GPXfile,'rb')
    4748    while True:
     
    5253        datum = data[0]
    5354        if datum[0] == 'Controls':
    54             Controls = datum[1]
     55            Controls.update(datum[1])
    5556    file.close()
    5657    return Controls
     
    6061    print ' Derivative type: ',Controls['deriv type']
    6162    print ' Minimum delta-M/M for convergence: ','%.2g'%(Controls['min dM/M'])
     63    print ' Initial shift factor: ','%.3f'%(Controls['shift factor'])
    6264   
    6365def GetPhaseNames(GPXfile):
     
    12011203        tanth = tand(refl[5]/2.)
    12021204        if calcControls[phfx+'SizeType'] == 'isotropic':
    1203             gam = 1.8*wave/(np.pi*parmDict[phfx+'Size:0']*costh)
    1204             gamDict[phfx+'Size:0'] = -gam/parmDict[phfx+'Size:0']
     1205            gam = 180.*wave/(np.pi*parmDict[phfx+'Size:0']*costh)
     1206            gamDict[phfx+'Size:0'] = gam/parmDict[phfx+'Size:0']
    12051207        elif calcControls[phfx+'SizeType'] == 'uniaxial':
    12061208            H = np.array(refl[:3])
     
    12091211            Si = parmDict[phfx+'Size:0']
    12101212            Sa = parmDict[phfx+'Size:1']
    1211             gami = (1.8*wave/np.pi)/(Si*Sa)
     1213            gami = (180.*wave/np.pi)/(Si*Sa)
    12121214            sqtrm = np.sqrt((cosP*Sa)**2+(sinP*Si)**2)
    12131215            gam = gami*sqtrm/costh           
    12141216            gamDict[phfx+'Size:0'] = gami*Si*sinP**2/(sqtrm*costh)-gam/Si
    1215             gamDict[phfx+'Size:1'] = gami*Sa*cosP**2/(sqtrm*costh)-gam/Sa         
     1217            gamDict[phfx+'Size:1'] = gam/Sa-gami*Sa*cosP**2/(sqtrm*costh)         
    12161218        else:           #ellipsoidal crystallites - do numerically?
    12171219            H = np.array(refl[:3])
     
    14891491        dlg.SetPosition(wx.Point(screenSize[2]-Size[0]-305,screenSize[1]+5))
    14901492        Ftol = Controls['min dM/M']
     1493        Factor = Controls['shift factor']
    14911494        try:
    14921495            if Controls['deriv type'] == 'analytic':
    1493                 result = so.leastsq(errRefine,values,Dfun=dervRefine,full_output=True,ftol=Ftol,col_deriv=True,
     1496                result = so.leastsq(errRefine,values,Dfun=dervRefine,full_output=True,
     1497                    ftol=Ftol,col_deriv=True,factor=Factor,
    14941498                    args=([Histograms,Phases],parmDict,varyList,calcControls,pawleyLookup,dlg))
    14951499                ncyc = int(result[2]['nfev']/2)               
    14961500            else:           #'numeric'
    1497                 result = so.leastsq(errRefine,values,full_output=True,ftol=Ftol,epsfcn=1.e-8,
     1501                result = so.leastsq(errRefine,values,full_output=True,ftol=Ftol,epsfcn=1.e-8,factor=Factor,
    14981502                    args=([Histograms,Phases],parmDict,varyList,calcControls,pawleyLookup,dlg))
    14991503                ncyc = int(result[2]['nfev']/len(varyList))
Note: See TracChangeset for help on using the changeset viewer.