Changeset 939 for trunk/GSASIIElem.py


Ignore:
Timestamp:
Jun 2, 2013 11:07:35 PM (8 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/GSASIIElem.py

    r881 r939  
    11# -*- coding: utf-8 -*-
    2 """Element: functions for element types
    3    Copyright: 2008, Robert B. Von Dreele & Brian H. Toby (Argonne National Laboratory)
    42"""
     3*GSASIIElem: functions for element types*
     4-----------------------------------------
     5
     6"""
     7# Copyright: 2008, Robert B. Von Dreele & Brian H. Toby (Argonne National Laboratory)
    58########### SVN repository information ###################
    69# $Date$
     
    2023    """Read X-ray form factor coefficients from `atomdata.asc` file
    2124
    22     :param El: element 1-2 character symbol case irrevelant
     25    :param str El: element 1-2 character symbol, case irrevelant
    2326    :return: `FormFactors`: list of form factor dictionaries
    2427   
     
    5861def GetFFC5(ElSym):
    5962    '''Get 5 term form factor and Compton scattering data
    60     @param ElSym: str(1-2 character element symbol with proper case);
    61     @return El: dictionary with 5 term form factor & compton coefficients
     63
     64    :param ElSym: str(1-2 character element symbol with proper case);
     65    :return El: dictionary with 5 term form factor & compton coefficients
    6266    '''
    6367    import FormFactors as FF
     
    7478   
    7579def CheckElement(El):
     80    '''Check if element El is in the periodic table
     81
     82    :param str El: One or two letter element symbol, capitaliztion ignored
     83    :returns: True if the element is found
     84
     85    '''
    7686    import ElementTable as ET
    7787    Elements = []
     
    8393        return False
    8494
    85 def FixValence(El):
     95def FixValence(El):
     96    'Returns the element symbol, even when a valence is present'
    8697    if '+' in El[-1]: #converts An+/- to A+/-n
    8798        num = El[-2]
     
    97108       
    98109def GetAtomInfo(El):
    99    
     110    'reads element information from file atmdata.dat'
    100111    import ElementTable as ET
    101112    Elements = []
     
    149160def GetXsectionCoeff(El):
    150161    """Read atom orbital scattering cross sections for fprime calculations via Cromer-Lieberman algorithm
    151     @param El: 2 character element symbol
    152     @return: Orbs: list of orbitals each a dictionary with detailed orbital information used by FPcalc
     162
     163    :param El: 2 character element symbol
     164    :return: Orbs: list of orbitals each a dictionary with detailed orbital information used by FPcalc
     165
    153166    each dictionary is:
    154     'OrbName': Orbital name read from file
    155     'IfBe' 0/2 depending on orbital
    156     'BindEn': binding energy
    157     'BB': BindEn/0.02721
    158     'XSectIP': 5 cross section inflection points
    159     'ElEterm': energy correction term
    160     'SEdge': absorption edge for orbital
    161     'Nval': 10/11 depending on IfBe
    162     'LEner': 10/11 values of log(energy)
    163     'LXSect': 10/11 values of log(cross section)
     167
     168    * 'OrbName': Orbital name read from file
     169    * 'IfBe' 0/2 depending on orbital
     170    * 'BindEn': binding energy
     171    * 'BB': BindEn/0.02721
     172    * 'XSectIP': 5 cross section inflection points
     173    * 'ElEterm': energy correction term
     174    * 'SEdge': absorption edge for orbital
     175    * 'Nval': 10/11 depending on IfBe
     176    * 'LEner': 10/11 values of log(energy)
     177    * 'LXSect': 10/11 values of log(cross section)
     178
    164179    """
    165180    AU = 2.80022e+7
     
    227242def GetMagFormFacCoeff(El):
    228243    """Read magnetic form factor data from atomdata.asc file
    229     @param El: 2 character element symbol
    230     @return: MagFormFactors: list of all magnetic form factors dictionaries for element El.
     244
     245    :param El: 2 character element symbol
     246    :return: MagFormFactors: list of all magnetic form factors dictionaries for element El.
     247
    231248    each dictionary contains:
    232     'Symbol':Symbol
    233     'Z':Z
    234     'mfa': 4 MA coefficients
    235     'nfa': 4 NA coefficients
    236     'mfb': 4 MB coefficients
    237     'nfb': 4 NB coefficients
    238     'mfc': MC coefficient
    239     'nfc': NC coefficient
     249
     250    * 'Symbol':Symbol
     251    * 'Z':Z
     252    * 'mfa': 4 MA coefficients
     253    * 'nfa': 4 NA coefficients
     254    * 'mfb': 4 MB coefficients
     255    * 'nfb': 4 NB coefficients
     256    * 'mfc': MC coefficient
     257    * 'nfc': NC coefficient
     258   
    240259    """
    241260    ElS = El.upper()
     
    270289def ScatFac(El, SQ):
    271290    """compute value of form factor
    272     @param El: element dictionary defined in GetFormFactorCoeff
    273     @param SQ: (sin-theta/lambda)**2
    274     @return: real part of form factor
     291
     292    :param El: element dictionary defined in GetFormFactorCoeff
     293    :param SQ: (sin-theta/lambda)**2
     294    :return: real part of form factor
    275295    """
    276296    fa = np.array(El['fa'])
     
    340360def ComptonFac(El,SQ):
    341361    """compute Compton scattering factor
    342     @param El: element dictionary
    343     @param SQ: (sin-theta/lambda)**2
    344     @return: compton scattering factor
     362
     363    :param El: element dictionary
     364    :param SQ: (sin-theta/lambda)**2
     365    :return: compton scattering factor
    345366    """   
    346367    ca = np.array(El['cmpa'])
     
    351372def FPcalc(Orbs, KEv):
    352373    """Compute real & imaginary resonant X-ray scattering factors
    353     @param Orbs: list of orbital dictionaries as defined in GetXsectionCoeff
    354     @param KEv: x-ray energy in keV
    355     @return: C: (f',f",mu): real, imaginary parts of resonant scattering & atomic absorption coeff.
     374
     375    :param Orbs: list of orbital dictionaries as defined in GetXsectionCoeff
     376    :param KEv: x-ray energy in keV
     377    :return: C: (f',f",mu): real, imaginary parts of resonant scattering & atomic absorption coeff.
    356378    """
    357379    def Aitken(Orb, LKev):
Note: See TracChangeset for help on using the changeset viewer.