-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntax highlighting in docs #1768
Changes from all commits
8b1762e
f0b6a30
aff3a84
72ef2b4
bec3222
8b1150a
4359eb5
0bac798
3fc90a6
8bfa80a
8c06e82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
.. image:: docs/logos/jdaviz.svg | ||
:width: 400 | ||
:alt: Jdaviz logo | ||
:width: 400 | ||
:alt: Jdaviz logo | ||
:align: center | ||
|
||
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5513927.svg | ||
:target: https://doi.org/10.5281/zenodo.5513927 | ||
:alt: Zenodo DOI | ||
:target: https://doi.org/10.5281/zenodo.5513927 | ||
:alt: Zenodo DOI | ||
|
||
.. image:: https://github.com/spacetelescope/jdaviz/workflows/CI/badge.svg | ||
:target: https://github.com/spacetelescope/jdaviz/actions | ||
|
@@ -49,12 +50,16 @@ Installing | |
---------- | ||
|
||
You may want to consider installing ``jdaviz`` in a new virtual or conda environment to avoid | ||
version conflicts with other packages you may have installed, for example:: | ||
version conflicts with other packages you may have installed, for example: | ||
|
||
.. code-block:: bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if this does anything different in GitHub view but I guess it does not hurt. |
||
|
||
conda create -n jdaviz-env python=3.9 | ||
conda activate jdaviz-env | ||
|
||
Installing the released version can be done using pip:: | ||
Installing the released version can be done using pip: | ||
|
||
.. code-block:: bash | ||
|
||
pip install jdaviz --upgrade | ||
|
||
|
@@ -70,19 +75,23 @@ As a Web Application | |
++++++++++++++++++++ | ||
|
||
``jdaviz`` provides a command-line tool to start the web application. To see the syntax and usage, | ||
from a terminal, type:: | ||
from a terminal, type: | ||
|
||
.. code-block:: bash | ||
|
||
jdaviz --help | ||
jdaviz specviz /path/to/data/spectral_file | ||
|
||
For more information on the command line interface, see the | ||
`Jdaviz Quickstart <https://jdaviz.readthedocs.io/en/latest/quickstart.html>`_. | ||
For more information on the command line interfaces for each tool, see the | ||
`Jdaviz docs <https://jdaviz.readthedocs.io/en/latest/index.html>`_. | ||
|
||
|
||
In a Jupyter Notebook | ||
+++++++++++++++++++++ | ||
|
||
The power of ``jdaviz`` is that it can integrated into your Jupyter notebook workflow:: | ||
The power of ``jdaviz`` is that it can integrated into your Jupyter notebook workflow: | ||
|
||
.. code-block:: python | ||
|
||
from jdaviz import Specviz | ||
|
||
|
@@ -93,8 +102,10 @@ To learn more about the various ``jdaviz`` application configurations and loadin | |
`specviz <https://jdaviz.readthedocs.io/en/latest/specviz/import_data.html>`_, `cubeviz <https://jdaviz.readthedocs.io/en/latest/cubeviz/import_data.html>`_, `mosviz <https://jdaviz.readthedocs.io/en/latest/mosviz/import_data.html>`_, or `imviz <https://jdaviz.readthedocs.io/en/latest/imviz/import_data.html>`_ tools. | ||
|
||
``jdaviz`` also provides a directory of `sample notebooks <https://jdaviz.readthedocs.io/en/latest/sample_notebooks.html>`_ to test the application, located in the ``notebooks`` sub-directory | ||
of the git repository. ``CubevizExample.ipynb`` is provided as an example that loads a SDSS MaNGA IFU data cube with the | ||
``Cubeviz`` configuration. To run the provided example, start the jupyter kernel with the notebook path:: | ||
of the git repository. ``CubevizExample.ipynb`` is provided as an example that loads a JWST data cube with the | ||
``Cubeviz`` configuration. To run the provided example, start the Jupyter kernel with the notebook path: | ||
|
||
.. code-block:: bash | ||
|
||
jupyter notebook /path/to/jdaviz/notebooks/CubevizExample.ipynb | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,9 @@ To then extract your data from Cubeviz, please see the :ref:`cubeviz-notebook` s | |
Importing data through the Command Line | ||
======================================= | ||
|
||
You can load your data into the Cubeviz application through the command line:: | ||
You can load your data into the Cubeviz application through the command line: | ||
|
||
.. code-block:: bash | ||
|
||
jdaviz cubeviz /my/directory/cube.fits | ||
|
||
|
@@ -70,13 +72,15 @@ Importing data via the API | |
|
||
Alternatively, users who work in a coding environment like a Jupyter | ||
notebook can access the Cubeviz helper class API. Using this API, users can | ||
load data into the application through code with the :meth:`~jdaviz.configs.specviz.helper.Specviz.load_spectrum` | ||
load data into the application through code with the :py:meth:`~jdaviz.configs.specviz.helper.Specviz.load_spectrum` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't think |
||
method, which takes as input a :class:`~specutils.Spectrum1D` object. | ||
|
||
FITS Files | ||
---------- | ||
|
||
The example below loads a FITS file into Cubeviz:: | ||
The example below loads a FITS file into Cubeviz: | ||
|
||
.. code-block:: python | ||
|
||
from jdaviz import Cubeviz | ||
cubeviz = Cubeviz() | ||
|
@@ -88,7 +92,9 @@ Spectrum1D (from file) | |
|
||
For cases where the built-in parser is unable to understand your file format, | ||
you can try the `~specutils.Spectrum1D` parser directly and then pass the object to the | ||
:meth:`~jdaviz.core.helpers.ConfigHelper.load_data` method:: | ||
:py:meth:`~jdaviz.core.helpers.ConfigHelper.load_data` method: | ||
|
||
.. code-block:: python | ||
|
||
from specutils import Spectrum1D | ||
from jdaviz import Cubeviz | ||
|
@@ -100,7 +106,9 @@ you can try the `~specutils.Spectrum1D` parser directly and then pass the object | |
Spectrum1D (from array) | ||
----------------------- | ||
|
||
You can create your own `~specutils.Spectrum1D` object by hand to load into Cubeviz:: | ||
You can create your own :class:`~specutils.Spectrum1D` object by hand to load into Cubeviz: | ||
|
||
.. code-block:: python | ||
|
||
import numpy as np | ||
from astropy import units as u | ||
|
@@ -124,7 +132,9 @@ JWST datamodels | |
--------------- | ||
|
||
If you have a `jwst.datamodels <https://jwst-pipeline.readthedocs.io/en/latest/jwst/datamodels/index.html>`_ | ||
object, you can load it into Cubeviz as follows:: | ||
object, you can load it into Cubeviz as follows: | ||
|
||
.. code-block:: python | ||
|
||
import numpy as np | ||
import astropy.wcs as fitswcs | ||
|
@@ -162,19 +172,23 @@ Importing regions via the API | |
============================= | ||
|
||
If you have a region file supported by :ref:`regions:regions_io`, you | ||
can load the regions into Cubeviz as follows:: | ||
can load the regions into Cubeviz as follows: | ||
|
||
.. code-block:: python | ||
|
||
cubeviz.load_regions_from_file("/path/to/data/myregions.reg") | ||
|
||
Unsupported regions will be skipped and trigger a warning. Those that | ||
failed to load, if any, can be returned as a list of tuples of the | ||
form ``(region, reason)``:: | ||
form ``(region, reason)``: | ||
|
||
.. code-block:: python | ||
|
||
bad_regions = cubeviz.load_regions_from_file("/path/to/data/myregions.reg", return_bad_regions=True) | ||
|
||
.. note:: Sky regions are currently unsupported in Cubeviz, unlike Imviz. | ||
|
||
For more details on the API, please see | ||
:meth:`~jdaviz.core.helpers.ImageConfigHelper.load_regions_from_file` | ||
and :meth:`~jdaviz.core.helpers.ImageConfigHelper.load_regions` methods | ||
:py:meth:`~jdaviz.core.helpers.ImageConfigHelper.load_regions_from_file` | ||
and :py:meth:`~jdaviz.core.helpers.ImageConfigHelper.load_regions` methods | ||
in Cubeviz. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this align has any effect on the GitHub rendering. Should we just remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly, it does, but not always? This is a feature I've wanted for a long time in GH renders of rst docs, and it works in some repos but not this one... not sure why?