Changeset 1865


Ignore:
Timestamp:
08/05/10 17:43:28 (14 years ago)
Author:
Malte Marquarding
Message:

Fixed docstrings fro sphinx

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/linecatalog.py

    r1859 r1865  
    1 """
     1"""\
    22A representation of a spectral line catalog.
    3 
    4 Author: Malte Marquarding
    5 
    63"""
    74__revision__ = "$Revision$"
     
    118
    129class linecatalog(lcbase):
    13     """
     10    """\
    1411    This class is a warpper for line catalogs. These can be either ASCII tables
    1512    or the tables saved from this class.
     13
    1614    ASCII tables have the following restrictions:
    17     Comments can be present through lines starting with '#'.
    18     The first column contains the name of the Molecule. This can't contain spaces,
    19     if it does it has to be wrapped in ""
    20     The second column contains the frequency of the transition.
    21     The third column contains the error in frequency.
    22     The fourth column contains a value describing the intensity
     15
     16        * Comments can be present through lines starting with '#'.
     17
     18        * The first column contains the name of the Molecule. This can't contain
     19          spaces, if it does it has to be wrapped in double-quotes.
     20
     21        * The second column contains the frequency of the transition.
     22
     23        * The third column contains the error in frequency.
     24
     25        * The fourth column contains a value describing the intensity.
     26
    2327    """
    2428
     
    4549
    4650    def set_name(self, name, mode="pattern"):
    47         """
     51        """\
    4852        Set a name restriction on the table. This can be a standard unix-style
    4953        pattern or a regular expression.
     54
    5055        Parameters:
     56
    5157            name:       the name patterrn/regex
     58
    5259            mode:       the matching mode, i.e. "pattern" (default) or "regex"
     60
    5361        """
    5462        validmodes = "pattern regex".split()
     
    5866
    5967    def set_frequency_limits(self, fmin=1.0, fmax=120.0, unit="GHz"):
    60         """
     68        """\
    6169        Set frequency limits on the table.
     70
    6271        Parameters:
     72
    6373            fmin:       the lower bound
     74
    6475            fmax:       the upper bound
     76
    6577            unit:       the frequency unit (default "GHz")
    6678
    67         Note:
    68             The underlying table conatins frequency values in MHz
     79        .. note:: The underlying table contains frequency values in MHz
    6980        """
    7081        base = { "GHz": 1000.0, "MHz": 1.0 }
     
    7586
    7687    def set_strength_limits(self, smin, smax):
    77         """
     88        """\
    7889        Set line strength limits on the table (arbitrary units)
     90
    7991        Parameters:
     92
    8093            smin:       the lower bound
     94
    8195            smax:       the upper bound
     96
    8297        """
    8398        lcbase.set_strength_limits(self, smin, smax)
    8499
    85100    def save(self, name, overwrite=False):
    86         """
     101        """\
    87102        Save the subset of the table to disk. This uses an internal data format
    88103        and can be read in again.
     
    96111
    97112    def reset(self):
    98         """
    99         Reset the table to its initial state, i.e. undo all calls to set_
     113        """\
     114        Reset the table to its initial state, i.e. undo all calls to ``set_``.
    100115        """
    101116        lcbase.reset(self)
    102117
    103118    def get_row(self, row=0):
     119        """\
     120        Get the values in a specified row of the table.
     121
     122        Parameters:
     123
     124              row:        the row to retrieve
     125
    104126        """
    105         Get the values in a specified row of the table.
    106         Parameters:
    107               row:        the row to retrieve
    108         """
     127        if row < 0 or row > len(self)-1:
     128            raise IndexError("Row index out of bounds.")
    109129        freq = lcbase.get_frequency(self, row)
    110130        name = lcbase.get_name(self, row)
     
    115135
    116136    def __getitem__(self, k):
    117         if k < 0: k = self.nrow()-k
     137        if k < 0:
     138            k = self.nrow()-k
    118139        return self.get_row(k)
Note: See TracChangeset for help on using the changeset viewer.