Skip to content

Commit

Permalink
Clarify docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
rosteen committed Apr 23, 2024
1 parent 7d6473f commit 890c9f5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions specutils/spectra/spectral_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def from_qtable(cls, table):
Parameters
----------
table : `~astropy.table.QTable`
An `~astropy.table.QTable` object with ``lower_bound`` and ``upper_bound`` columns.
Returns
-------
Expand All @@ -132,12 +133,13 @@ def from_qtable(cls, table):
@classmethod
def read(cls, filename):
"""
Read in the ecsv file format output by the SpectralRegion.write method.
Create a ``SpectralRegion`` from an ecsv file output by the
``SpectralRegion.write`` method.
Parameters
----------
filename : str
The name of the ecsv file on disk to be read in as a SpectralRegion.
The name of the ecsv file on disk to be read in as a ``SpectralRegion``.
"""
table = QTable.read(filename)
return cls.from_qtable(table)
Expand Down Expand Up @@ -386,11 +388,14 @@ def _table(self):
return QTable([lower_bounds, upper_bounds], names=("lower_bound", "upper_bound"))

def as_table(self):
"""Returns an `~astropy.table.QTable` with the upper and lower bound
of each subregion in the ``SpectralRegion``."""
return self._table

def write(self, filename="spectral_region.ecsv", overwrite=True):
"""
Write the SpectralRegion to an ecsv file using `~astropy.table.QTable`.
Overwrites by default.
"""
if not filename.endswith("ecsv"):
raise ValueError("SpectralRegions can only be written out to ecsv files.")
Expand Down

0 comments on commit 890c9f5

Please sign in to comment.