Skip to content

Commit

Permalink
API example in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Jan 2, 2024
1 parent 4a1795c commit fe4e929
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@ This plugin allows choosing which column in the underlying data should be used a
throughout the app (when plotting and in any data analysis plugins).


.. code-block:: python
from lcviz import LCviz
lc = search_lightcurve("HAT-P-11", mission="Kepler",
cadence="long", quarter=10).download().flatten()
lcviz = LCviz()
lcviz.load_data(lc)
lcviz.show()
flux_origin = lcviz.plugins['Flux Origin']
print(flux_origin.flux_origin.choices)
flux_origin.flux_origin = 'sap_flux'
.. seealso::

This plugin reproduces the behavior also available in ``lightkurve`` as:

* :meth:`lightkurve.LightCurve.select_flux`


.. _plot-options:

Plot Options
Expand Down
12 changes: 12 additions & 0 deletions lcviz/tests/test_plugin_flux_origin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
from numpy.testing import assert_allclose


def test_docs_snippets(helper, light_curve_like_kepler_quarter):
lcviz, lc = helper, light_curve_like_kepler_quarter

lcviz.load_data(lc)
# lcviz.show()

flux_origin = lcviz.plugins['Flux Origin']
print(flux_origin.flux_origin.choices)
# NOTE: choices for docs example are: ['sap_flux', 'sap_bkg', 'pdcsap_flux']
flux_origin.flux_origin = 'flux_alt'


def test_plugin_flux_origin(helper, light_curve_like_kepler_quarter):
helper.load_data(light_curve_like_kepler_quarter)

Expand Down

0 comments on commit fe4e929

Please sign in to comment.