User Tools

Site Tools


python_commenting

Python Commenting

Module Example, at top

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""Determine flux densities of sources based on Perley and Butler, 2016.
Using the method defined in Perley and Butler, 2016:
https://arxiv.org/pdf/1609.05940.pdf calculate the flux densities of various
sources from 1 to 10GHz and optionally produce a graph that is automatically
displayed in a browser.

Author: Jon Richards, jrseti@gmail.com

Example:

    Provide usage examples here

"""

Function 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.txt · Last modified: 2019/12/11 23:33 by jrseti