From 33f71910ae56a1236ce6f528372d5821cab7f774 Mon Sep 17 00:00:00 2001 From: "J.D.Eisenhamer" Date: Wed, 28 Dec 2016 14:09:47 -0500 Subject: [PATCH] Full documentation of the core code WIP #237 --- docs/source/api.rst | 46 ++++++++++++++++++++++++++++++++++----- specviz/core/comms.py | 2 +- specviz/core/data.py | 12 ++++++++-- specviz/core/linelist.py | 8 +++++-- specviz/core/plots.py | 30 +++++++++++++++---------- specviz/core/threads.py | 6 ++++- specviz/io/yaml_loader.py | 9 +++++--- 7 files changed, 87 insertions(+), 26 deletions(-) diff --git a/docs/source/api.rst b/docs/source/api.rst index eccc7402..cdc97d05 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -4,22 +4,58 @@ SpecViz API Analysis Functions ------------------ .. automodapi:: specviz.analysis - :no-heading: + :no-heading: SpecViz core ------------ -.. automodapi:: specviz.core - :no-heading: +Data Objects +^^^^^^^^^^^^ +.. automodapi:: specviz.core.data + :no-heading: + :no-main-docstr: + :headings:"" +Object Event Handling +^^^^^^^^^^^^^^^^^^^^^ +.. automodapi:: specviz.core.comms + :no-heading: + :no-main-docstr: + :headings:"" + +Spectrum Layer Plotting +^^^^^^^^^^^^^^^^^^^^^^^ +.. automodapi:: specviz.core.plots + :no-heading: + :no-main-docstr: + :headings:"" + +Emission/Absorption Line list utilities +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. automodapi:: specviz.core.linelist + :no-heading: + :no-main-docstr: + :headings:"" + +Thread Helpers +^^^^^^^^^^^^^^ +.. automodapi:: specviz.core.threads + :no-heading: + :no-main-docstr: + :headings:"" + + Interfaces ---------- .. automodapi:: specviz.interfaces - :no-heading: + :no-heading: I/O module ---------- .. automodapi:: specviz.io - :no-heading: + :no-heading: + +.. automodapi:: specviz.io.yaml_loader + :no-heading: diff --git a/specviz/core/comms.py b/specviz/core/comms.py index 0e87b9c0..847f8a09 100644 --- a/specviz/core/comms.py +++ b/specviz/core/comms.py @@ -1,7 +1,7 @@ """ Object Event Handling -Elevator Pitch: The singleton `Dispatch` object manages the +The singleton `Dispatch` object manages the set of `EventNode` events. Handlers or **listeners** are attached to `EventNode`s. The `DispatchHandle` decorator is used to decorate classes that handle events. diff --git a/specviz/core/data.py b/specviz/core/data.py index b46effdc..f89c24fb 100644 --- a/specviz/core/data.py +++ b/specviz/core/data.py @@ -1,10 +1,11 @@ -"""This module handles spectrum data objects.""" +""" +Data Objects +""" from __future__ import (absolute_import, division, print_function, unicode_literals) # STDLIB import logging -logging.basicConfig(level=logging.INFO) import re # THIRD-PARTY @@ -13,6 +14,13 @@ from ..third_party.py_expression_eval import Parser from specutils.core.generic import Spectrum1DRef +logging.basicConfig(level=logging.INFO) + +__all__ = [ + 'Spectrum1DRefLayer', + 'Spectrum1DRefModelLayer', +] + class Spectrum1DRefLayer(Spectrum1DRef): """ diff --git a/specviz/core/linelist.py b/specviz/core/linelist.py index 2b2b0bd3..5a14369d 100644 --- a/specviz/core/linelist.py +++ b/specviz/core/linelist.py @@ -1,5 +1,5 @@ """ -Utilities and classes to handle Emission/Absorption Line lists +Emission/Absorption Line list utilities """ from __future__ import (absolute_import, division, print_function, unicode_literals) @@ -10,6 +10,11 @@ from astropy.table import Table, vstack +__all__ = [ + 'LineList', + 'ingest', +] + FORMAT = 'line_list' COLUMN_NAME = 'name' COLUMN_START = 'start' @@ -18,7 +23,6 @@ ID_COLUMN = 'Line ID' UNITS_COLUMN = 'units' - def ingest(range): """ Returns a list with LineList instances. diff --git a/specviz/core/plots.py b/specviz/core/plots.py index b13d2181..a034ed0e 100644 --- a/specviz/core/plots.py +++ b/specviz/core/plots.py @@ -1,5 +1,5 @@ """ -Line plotting classes +Spectrum Layer Plotting """ from __future__ import (absolute_import, division, print_function, unicode_literals) @@ -12,17 +12,23 @@ import logging import numpy as np -AVAILABLE_COLORS = cycle([(0, 0, 0), - (0.2980392156862745, 0.4470588235294118, 0.6901960784313725), - (0.3333333333333333, 0.6588235294117647, 0.40784313725490196), - (0.7686274509803922, 0.3058823529411765, 0.3215686274509804), - (0.5058823529411764, 0.4470588235294118, 0.6980392156862745), - (0.8, 0.7254901960784313, 0.4549019607843137), - (0.39215686274509803, 0.7098039215686275, 0.803921568627451), - (0.2980392156862745, 0.4470588235294118, 0.6901960784313725), - (0.3333333333333333, 0.6588235294117647, 0.40784313725490196), - (0.7686274509803922, 0.3058823529411765, 0.3215686274509804), - (0.5058823529411764, 0.4470588235294118, 0.6980392156862745)]) +__all__ = [ + 'LinePlot', +] + +AVAILABLE_COLORS = cycle([ + (0, 0, 0), + (0.2980392156862745, 0.4470588235294118, 0.6901960784313725), + (0.3333333333333333, 0.6588235294117647, 0.40784313725490196), + (0.7686274509803922, 0.3058823529411765, 0.3215686274509804), + (0.5058823529411764, 0.4470588235294118, 0.6980392156862745), + (0.8, 0.7254901960784313, 0.4549019607843137), + (0.39215686274509803, 0.7098039215686275, 0.803921568627451), + (0.2980392156862745, 0.4470588235294118, 0.6901960784313725), + (0.3333333333333333, 0.6588235294117647, 0.40784313725490196), + (0.7686274509803922, 0.3058823529411765, 0.3215686274509804), + (0.5058823529411764, 0.4470588235294118, 0.6980392156862745) +]) class LinePlot(object): diff --git a/specviz/core/threads.py b/specviz/core/threads.py index bb3e5172..52ddfca2 100644 --- a/specviz/core/threads.py +++ b/specviz/core/threads.py @@ -1,5 +1,5 @@ """ -Threaded tasks +Thread Helpers """ from qtpy.QtCore import QThread, Signal import os @@ -10,6 +10,10 @@ import astropy.io.registry as io_registry +__all__ = [ + 'FileLoadThread', + 'FitModelThread', +] class FileLoadThread(QThread): """ diff --git a/specviz/io/yaml_loader.py b/specviz/io/yaml_loader.py index 2ac1f731..229ba499 100644 --- a/specviz/io/yaml_loader.py +++ b/specviz/io/yaml_loader.py @@ -19,9 +19,12 @@ from specviz.core import linelist from specviz.core.linelist import LineList -__all__ = ['fits_reader', 'fits_identify', - 'ascii_reader', 'ascii_identify', - 'linelist_reader', 'linelist_identify'] +__all__ = [ + 'AsciiYamlRegister', + 'FitsYamlRegister', + 'LineListYamlRegister', + 'YamlRegister', +] # Loader automatically falls back to these units for some cases default_waveunit = u.Unit('Angstrom')