Changeset 939 for trunk/GSASIIstrMath.py


Ignore:
Timestamp:
Jun 2, 2013 11:07:35 PM (9 years ago)
Author:
toby
Message:

fix & cleanup unit tests; add/change doc strings for sphinx; add all G2 py files to sphinx

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r934 r939  
    11# -*- coding: utf-8 -*-
    2 #GSASIIstrMath - structure computation math routines
     2'''
     3*GSASIIstrMath - structure math routines*
     4-----------------------------------------
     5'''
    36########### SVN repository information ###################
    47# $Date: 2013-05-17 12:13:15 -0500 (Fri, 17 May 2013) $
     
    134137                   
    135138def ApplyRBModelDervs(dFdvDict,parmDict,rigidbodyDict,Phase):
     139    'Needs a doc string'
    136140    atxIds = ['dAx:','dAy:','dAz:']
    137141    atuIds = ['AU11:','AU22:','AU33:','AU12:','AU13:','AU23:']
     
    293297
    294298def penaltyFxn(HistoPhases,parmDict,varyList):
     299    'Needs a doc string'
    295300    Histograms,Phases,restraintDict,rigidbodyDict = HistoPhases
    296301    pNames = []
     
    389394   
    390395def penaltyDeriv(pNames,pVal,HistoPhases,parmDict,varyList):
     396    'Needs a doc string'
    391397    Histograms,Phases,restraintDict,rigidbodyDict = HistoPhases
    392398    pDerv = np.zeros((len(varyList),len(pVal)))
     
    486492                   
    487493def GetAtomFXU(pfx,calcControls,parmDict):
     494    'Needs a doc string'
    488495    Natoms = calcControls['Natoms'][pfx]
    489496    Tdata = Natoms*[' ',]
     
    510517   
    511518def getFFvalues(FFtables,SQ):
     519    'Needs a doc string'
    512520    FFvals = {}
    513521    for El in FFtables:
     
    516524   
    517525def getBLvalues(BLtables):
     526    'Needs a doc string'
    518527    BLvals = {}
    519528    for El in BLtables:
     
    523532def StructureFactor(refList,G,hfx,pfx,SGData,calcControls,parmDict):
    524533    ''' Compute structure factors for all h,k,l for phase
     534    puts the result, F^2, in each ref[8] in refList
    525535    input:
    526         refList: [ref] where each ref = h,k,l,m,d,...,[equiv h,k,l],phase[equiv]
    527         G:      reciprocal metric tensor
    528         pfx:    phase id string
    529         SGData: space group info. dictionary output from SpcGroup
    530         calcControls:
    531         ParmDict:
    532     puts result F^2 in each ref[8] in refList
     536   
     537    :param list refList: [ref] where each ref = h,k,l,m,d,...,[equiv h,k,l],phase[equiv]
     538    :param np.array G:      reciprocal metric tensor
     539    :param str pfx:    phase id string
     540    :param dict SGData: space group info. dictionary output from SpcGroup
     541    :param dict calcControls:
     542    :param dict ParmDict:
     543
    533544    '''       
    534545    twopi = 2.0*np.pi
     
    584595   
    585596def StructureFactorDerv(refList,G,hfx,pfx,SGData,calcControls,parmDict):
     597    'Needs a doc string'
    586598    twopi = 2.0*np.pi
    587599    twopisq = 2.0*np.pi**2
     
    757769   
    758770def GetNewCellParms(parmDict,varyList):
     771    'Needs a doc string'
    759772    newCellDict = {}
    760773    Anames = ['A'+str(i) for i in range(6)]
     
    769782   
    770783def ApplyXYZshifts(parmDict,varyList):
    771     ''' takes atom x,y,z shift and applies it to corresponding atom x,y,z value
    772         input:
    773             parmDict - parameter dictionary
    774             varyList - list of variables
    775         returns:
    776             newAtomDict - dictionary of new atomic coordinate names & values;
    777                 key is parameter shift name
     784    '''
     785    takes atom x,y,z shift and applies it to corresponding atom x,y,z value
     786   
     787    :param dict parmDict: parameter dictionary
     788    :param list varyList: list of variables
     789    :returns: newAtomDict - dictionary of new atomic coordinate names & values; key is parameter shift name
     790
    778791    '''
    779792    newAtomDict = {}
     
    786799   
    787800def SHTXcal(refl,g,pfx,hfx,SGData,calcControls,parmDict):
    788     #Spherical harmonics texture
     801    'Spherical harmonics texture'
    789802    IFCoup = 'Bragg' in calcControls[hfx+'instType']
    790803    odfCor = 1.0
     
    805818   
    806819def SHTXcalDerv(refl,g,pfx,hfx,SGData,calcControls,parmDict):
    807     #Spherical harmonics texture derivatives
     820    'Spherical harmonics texture derivatives'
    808821    FORPI = 4.0*np.pi
    809822    IFCoup = 'Bragg' in calcControls[hfx+'instType']
     
    830843   
    831844def SHPOcal(refl,g,phfx,hfx,SGData,calcControls,parmDict):
    832     #sphericaql harmonics preferred orientation (cylindrical symmetry only)
     845    'spherical harmonics preferred orientation (cylindrical symmetry only)'
    833846    odfCor = 1.0
    834847    H = refl[:3]
     
    851864   
    852865def SHPOcalDerv(refl,g,phfx,hfx,SGData,calcControls,parmDict):
    853     #spherical harmonics preferred orientation derivatives (cylindrical symmetry only)
     866    'spherical harmonics preferred orientation derivatives (cylindrical symmetry only)'
    854867    FORPI = 12.5663706143592
    855868    odfCor = 1.0
     
    875888   
    876889def GetPrefOri(refl,G,g,phfx,hfx,SGData,calcControls,parmDict):
     890    'Needs a doc string'
    877891    POcorr = 1.0
    878892    if calcControls[phfx+'poType'] == 'MD':
     
    892906   
    893907def GetPrefOriDerv(refl,G,g,phfx,hfx,SGData,calcControls,parmDict):
     908    'Needs a doc string'
    894909    POcorr = 1.0
    895910    POderv = {}
     
    912927   
    913928def GetAbsorb(refl,hfx,calcControls,parmDict):
     929    'Needs a doc string'
    914930    if 'Debye' in calcControls[hfx+'instType']:
    915931        return G2pwd.Absorb('Cylinder',parmDict[hfx+'Absorption'],refl[5],0,0)
     
    918934   
    919935def GetAbsorbDerv(refl,hfx,calcControls,parmDict):
     936    'Needs a doc string'
    920937    if 'Debye' in calcControls[hfx+'instType']:
    921938        return G2pwd.AbsorbDerv('Cylinder',parmDict[hfx+'Absorption'],refl[5],0,0)
     
    924941   
    925942def GetIntensityCorr(refl,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict):
     943    'Needs a doc string'
    926944    Icorr = parmDict[phfx+'Scale']*parmDict[hfx+'Scale']*refl[3]               #scale*multiplicity
    927945    if 'X' in parmDict[hfx+'Type']:
     
    934952   
    935953def GetIntensityDerv(refl,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict):
     954    'Needs a doc string'
    936955    dIdsh = 1./parmDict[hfx+'Scale']
    937956    dIdsp = 1./parmDict[phfx+'Scale']
     
    956975       
    957976def GetSampleSigGam(refl,wave,G,GB,phfx,calcControls,parmDict):
     977    'Needs a doc string'
    958978    costh = cosd(refl[5]/2.)
    959979    #crystallite size
     
    9931013       
    9941014def GetSampleSigGamDerv(refl,wave,G,GB,phfx,calcControls,parmDict):
     1015    'Needs a doc string'
    9951016    gamDict = {}
    9961017    sigDict = {}
     
    10681089       
    10691090def GetReflPos(refl,wave,G,hfx,calcControls,parmDict):
     1091    'Needs a doc string'
    10701092    h,k,l = refl[:3]
    10711093    dsq = 1./G2lat.calc_rDsq2(np.array([h,k,l]),G)
     
    10831105
    10841106def GetReflPosDerv(refl,wave,A,hfx,calcControls,parmDict):
     1107    'Needs a doc string'
    10851108    dpr = 180./np.pi
    10861109    h,k,l = refl[:3]
     
    11041127           
    11051128def GetHStrainShift(refl,SGData,phfx,parmDict):
     1129    'Needs a doc string'
    11061130    laue = SGData['SGLaue']
    11071131    uniq = SGData['SGUniq']
     
    11321156           
    11331157def GetHStrainShiftDerv(refl,SGData,phfx):
     1158    'Needs a doc string'
    11341159    laue = SGData['SGLaue']
    11351160    uniq = SGData['SGUniq']
     
    11631188   
    11641189def GetFobsSq(Histograms,Phases,parmDict,calcControls):
     1190    'Needs a doc string'
    11651191    histoList = Histograms.keys()
    11661192    histoList.sort()
     
    12281254               
    12291255def getPowderProfile(parmDict,x,varylist,Histogram,Phases,calcControls,pawleyLookup):
     1256    'Needs a doc string'
    12301257   
    12311258    def GetReflSigGam(refl,wave,G,GB,hfx,phfx,calcControls,parmDict):
     
    13201347   
    13211348def getPowderProfileDerv(parmDict,x,varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup):
     1349    'Needs a doc string'
    13221350   
    13231351    def cellVaryDerv(pfx,SGData,dpdA):
     
    15701598
    15711599def dervRefine(values,HistoPhases,parmDict,varylist,calcControls,pawleyLookup,dlg):
     1600    'Needs a doc string'
    15721601    parmDict.update(zip(varylist,values))
    15731602    G2mv.Dict2Map(parmDict,varylist)
     
    16581687
    16591688def HessRefine(values,HistoPhases,parmDict,varylist,calcControls,pawleyLookup,dlg):
     1689    'Needs a doc string'
    16601690    parmDict.update(zip(varylist,values))
    16611691    G2mv.Dict2Map(parmDict,varylist)
     
    17691799
    17701800def errRefine(values,HistoPhases,parmDict,varylist,calcControls,pawleyLookup,dlg):       
     1801    'Needs a doc string'
    17711802    parmDict.update(zip(varylist,values))
    17721803    Values2Dict(parmDict, varylist, values)
Note: See TracChangeset for help on using the changeset viewer.