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 070f663
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,32 @@ 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).


.. admonition:: User API Example
:class: dropdown

See the :class:`~lcviz.plugins.plot_options.plot_options.PlotOptions` user API documentation for more details.

.. 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 070f663

Please sign in to comment.