User Tools

Site Tools


python_commenting

This is an old revision of the document!


Python Commenting

Example

def get_source_coeffs(source_name):
    """Retrieve the coefficients for a source

    Args:
        source_name (String): The name of a source, nust be a source defined
            int tlist of sources.

    Returns:
        namedtuple: the 10 coefficients for this source, otherwise None if the
        source_name is invalid (not in the list).

    """
    SourceCoeffs = namedtuple('SourceCoeffs', 'name a0 a1 a2 a3 a4 a5 fit fmin fmax')
    
    for coeffs in _COEFF_TABLE:
        if coeffs[0].lower() == source_name.lower(): 
            return SourceCoeffs(coeffs[0], coeffs[1], coeffs[2],
                                coeffs[3], coeffs[4], coeffs[5],
                                coeffs[6], coeffs[7], coeffs[8], coeffs[9])
    
    return None
python_commenting.1576103671.txt.gz · Last modified: 2019/12/11 22:34 by jrseti