Skip to content
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

Update docs #2373

Merged
merged 38 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0c13026
Update environment.yml and setup.cfg to latest version of sphinx
aknierim Jul 4, 2023
501f2a9
Moved docs/_static/theme_overrides.css to docs/_static/ctapipe.css
aknierim Jul 4, 2023
135df80
Added logos dark/light
aknierim Jul 4, 2023
11275ed
Updated docs, added version switcher
aknierim Jul 4, 2023
c1eef15
Update setup.cfg pydata dependency
aknierim Jul 4, 2023
a76a43d
Added sphinx-design
aknierim Jul 4, 2023
c60a81e
Update environment.yml and setup.cfg to latest version of sphinx
aknierim Jul 4, 2023
658fb6a
Moved docs/_static/theme_overrides.css to docs/_static/ctapipe.css
aknierim Jul 4, 2023
d2a6d54
Added logos dark/light
aknierim Jul 4, 2023
b97b531
Updated docs, added version switcher
aknierim Jul 4, 2023
40aab03
Update setup.cfg pydata dependency
aknierim Jul 4, 2023
bc9d6d7
Added sphinx-design
aknierim Jul 4, 2023
1050126
Merge branch 'update-docs' of github.com:aknierim/ctapipe into update…
aknierim Jul 4, 2023
07ce4ba
Fixed sphinx warning for ctapipe.compat.StrEnum
aknierim Jul 4, 2023
c025fe3
Fixed sphinx warnings for `ctapipe.instrument`
aknierim Jul 5, 2023
2aed4de
Attempt at a temporary workaround
aknierim Jul 5, 2023
8b60b9a
Added ``:noindex:`` option to certain rst files
aknierim Jul 5, 2023
f3f6d00
Workarounds for duplicate reference warnings
aknierim Jul 7, 2023
958e5d9
Fix heading issue
aknierim Jul 7, 2023
1618eb1
Not adding to __all__ fixes automodapi warnings
aknierim Jul 9, 2023
a99555b
Change back to automodapi, rework docs front page
aknierim Jul 9, 2023
246639f
Ignore unused import warnings
aknierim Jul 10, 2023
3c0223b
Fix isort failing in ctapipe/instrument/camera/__init__.py
aknierim Jul 10, 2023
099f601
Remove html_sidebars option from conf.py
aknierim Jul 10, 2023
57d348f
Fix duplicated reference warning for muon components
maxnoe Jul 17, 2023
c0dc668
Fix broken html syntax in Component.__repr_html__
maxnoe Jul 17, 2023
2f16d23
Clear notebook outputs
maxnoe Jul 17, 2023
4f5f051
Fix add_css_file call in docs/conf.py
maxnoe Jul 17, 2023
63b9e63
Fix Tool repr_html and add html escaping
maxnoe Jul 17, 2023
beb5fad
Simplify __init__.py
maxnoe Jul 17, 2023
02798cb
Remove version switcher from navbar
aknierim Jul 17, 2023
a089c49
Add sidebar to all pages
aknierim Jul 17, 2023
61547d2
Fix for failed CI/lint
aknierim Jul 17, 2023
22d2062
Move content of caution admonition to announcement banner
aknierim Jul 18, 2023
2a6b6ed
Add sphinx conf path to .readthedocs.yml
aknierim Jul 18, 2023
854a84e
Add sidebars again
aknierim Jul 18, 2023
c782ba0
Add navbar version switcher
aknierim Jul 19, 2023
05cc382
Fix versions in switcher.json
aknierim Jul 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,6 @@ def setup(app):
("py:class", "ctapipe.compat.StrEnum"),
]

# temporary workaround to ignore reference warnings and ensure build
nitpick_ignore += [
("py:obj", "ctapipe.calib.CameraCalibrator"),
("py:obj", "ctapipe.calib.GainSelector"),
("py:obj", "CameraGeometry"),
("py:obj", "ctapipe.instrument.camera.CameraGeometry"),
("py:obj", "ctapipe.instrument.camera.CameraDescription"),
("py:obj", "ctapipe.instrument.camera.PixelShape"),
("py:obj", "ctapipe.instrument.camera.CameraReadout"),
]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
Expand Down
29 changes: 23 additions & 6 deletions docs/ctapipe_api/calib/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
.. _calib:

===============================
Calibration (`~ctapipe.calib`)
===============================
.. temporary worakaround to at least have calib in the title,
the reason is the usage of autosummary in the Reference/API
section below

========================================
Calibration (``calib``)
========================================

.. currentmodule:: ctapipe.calib

Expand Down Expand Up @@ -44,6 +48,19 @@ Submodules
Reference/API
=============

.. automodapi:: ctapipe.calib
:no-inheritance-diagram:
:noindex:
.. What follows is a *temporary* workaround to circumvent
various warnings of duplicate references caused by
calling automodapi on the camera package.

ctapipe.calib Package
---------------------

Calibration

.. raw:: html

<h3>Classes</h3>
maxnoe marked this conversation as resolved.
Show resolved Hide resolved

.. autosummary::
~camera.CameraCalibrator
~camera.GainSelector
28 changes: 22 additions & 6 deletions docs/ctapipe_api/instrument/camera.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
Camera Description
==================

The `CameraDescription` contains classes holding information about the
Cherenkov camera, namely the `CameraGeometry` and `CameraReadout` classes.
The `~CameraDescription` contains classes holding information about the
Cherenkov camera, namely the `~CameraGeometry` and `~CameraReadout` classes.


.. toctree::
Expand All @@ -17,12 +17,28 @@ Cherenkov camera, namely the `CameraGeometry` and `CameraReadout` classes.


Reference/API
-------------
=============

.. What follows is a temporary workaround to circumvent
various warnings of duplicate references caused by
calling automodapi on the camera package.

ctapipe.instrument.camera Package
---------------------------------

.. raw:: html

<h3>Classes</h3>


.. autosummary::

~CameraDescription
~CameraGeometry
~PixelShape
~camera.geometry.UnknownPixelShapeWarning
~CameraReadout

.. automodapi:: ctapipe.instrument.camera
:no-inheritance-diagram:

.. automodapi:: ctapipe.instrument.camera.description
:no-inheritance-diagram:
:noindex:
45 changes: 22 additions & 23 deletions docs/ctapipe_api/instrument/camera_geometry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Camera Geometries
=================

The `CameraGeometry` provides an easy way to work with images or data
The `~ctapipe.instrument.CameraGeometry` provides an easy way to work with images or data
cubes related to Cherenkov Cameras. In *ctapipe*, a camera image is
simply a flat 1D array (or 2D if time information is included), where
there is one value per pixel. Of course, to work with such an array,
Expand All @@ -14,67 +14,67 @@ Since CTA has at least 6 different camera types, and may have multiple
versions of each as revisions are made, it is necessary to have a
common way to describe all cameras.

So far there are several ways to construct a `CameraGeometry`:
So far there are several ways to construct a `~ctapipe.instrument.CameraGeometry`:

* `~ctapipe.io.EventSource` instances have a ``subarray`` attribute,
* `~ctapipe.io.EventSource` instances have a :attr:`~ctapipe.io.EventSource.subarray` attribute,
e.g. to obtain the geometry for the telescope with id 1, use:
``source.subarray.tel[1].camera.geometry``.
`~ctapipe.io.TableLoader` also has the ``.subarray`` attribute.
``source.subarray.tel[1].camera.geometry``. The
`~ctapipe.io.TableLoader` instance also has the ``.subarray`` attribute.

* use the `CameraGeometry` constructor, where one has to specify all
* use the `~ctapipe.instrument.CameraGeometry` constructor, where one has to specify all
necessary information (pixel positions, types, areas, etc)

* load it from a pre-written file (which can be in any format
supported by ``astropy.table``, as long as that format allows for
supported by `astropy.table`, as long as that format allows for
header-keywords as well as table entries.


Once loaded, the `CameraGeometry` object gives you access the pixel
Once loaded, the `~ctapipe.instrument.CameraGeometry` object gives you access the pixel
positions, areas, neighbors, and shapes.

`CameraGeometry` is used by most image processing algorithms in the
`~ctapipe.instrument.CameraGeometry` is used by most image processing algorithms in the
`ctapipe.image` module, as well as displays in the
`ctapipe.visualization` module.

Input/Output
------------

You can write out a `CameraGeometry` by using the `CameraGeometry.to_table()`
method to turn it into an `astropy.table.Table`, and then call its `~astropy.table.Table.write`
function. Reading it back in can be done with `CameraGeometry.from_table()`
You can write out a `~ctapipe.instrument.CameraGeometry` by using the `CameraGeometry.to_table()`
method to turn it into an `astropy.table.Table`, and then call its `~astropy.table.Table.write`
function. Reading it back in can be done with `~ctapipe.instrument.CameraGeometry.from_table()`

.. code-block:: python

geom = CameraGeometry(...) # constructed elsewhere
geom = ~ctapipe.instrument.CameraGeometry(...) # constructed elsewhere

geom.to_table().write('mycam.fits.gz') # FITS output
geom.to_table().write('mycam.h5', path='/cameras/mycam') # hdf5 output
geom.to_table().write('mycam.ecsv', format='ascii.ecsv') # text table

# later read back in:

geom = CameraGeometry.from_table('mycam.ecsv', format='ascii.ecsv')
geom = CameraGeometry.from_table('mycam.fits.gz')
geom = CameraGeometry.from_table('mycam.h5', path='/cameras/mycam')
geom = ~ctapipe.instrument.CameraGeometry.from_table('mycam.ecsv', format='ascii.ecsv')
geom = ~ctapipe.instrument.CameraGeometry.from_table('mycam.fits.gz')
geom = ~ctapipe.instrument.CameraGeometry.from_table('mycam.h5', path='/cameras/mycam')


A note on Pixel Neighbors
-------------------------

The `CameraGeometry` object provides two pixel-neighbor
representations: a *neighbor adjacency list* (in the ``neighbors``
attribute) and a *pixel adjacency matrix* (in the ``neighbor_matrix``
The `~ctapipe.instrument.CameraGeometry` object provides two pixel-neighbor
representations: a *neighbor adjacency list* (in the :attr:`~CameraGeometry.neighbors`
attribute) and a *pixel adjacency matrix* (in the :attr:`~CameraGeometry.neighbor_matrix`
attribute). The former is a list of lists, where element *i* is a
list of neighbors *j* of the *i*th pixel. The latter is a 2D matrix
where row *i* is a boolean mask of pixels that are neighbors. It is
not necessary to load or specify either of these neighbor
representations when constructing a `CameraGeometry`, since they
representations when constructing a `~ctapipe.instrument.CameraGeometry`, since they
will be computed on-the-fly if left blank, using a KD-tree
nearest-neighbor algorithm.

It is recommended that all algorithms that need to be computationally
fast use the ``neighbor_matrix`` attribute, particularly in conjunction
with ``numpy`` operations, since it is quite speed-efficient.
fast use the :attr:`~CameraGeometry.neighbor_matrix` attribute, particularly in conjunction
with `numpy` operations, since it is quite speed-efficient.

Examples
--------
Expand All @@ -92,4 +92,3 @@ Reference/API

.. automodapi:: ctapipe.instrument.camera.geometry
:no-inheritance-diagram:
:noindex:
1 change: 0 additions & 1 deletion docs/ctapipe_api/instrument/camera_readout.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@ Reference/API

.. automodapi:: ctapipe.instrument.camera.readout
:no-inheritance-diagram:
:noindex:
3 changes: 2 additions & 1 deletion docs/ctapipe_api/instrument/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Instrument (`~ctapipe.instrument`)

.. currentmodule:: ctapipe.instrument


Introduction
============

The `ctapipe.instrument` module contains classes and methods for
The `~ctapipe.instrument` module contains classes and methods for
describing the instrumental layout and configuration.

This module is under heavy restructuring and should not be considered
Expand Down
1 change: 1 addition & 0 deletions docs/ctapipe_api/instrument/telescope.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Reference/API
-------------

.. automodapi:: ctapipe.instrument.telescope
:no-inheritance-diagram: