Skip to content

Commit

Permalink
Fix docs and include new pages in it
Browse files Browse the repository at this point in the history
Co-authored-by: Michele Peresano <michele.peresano@cea.fr>
Co-authored-by: Lukas Nickel <lukas.nickel@tu-dortmund.de>
  • Loading branch information
3 people committed Sep 18, 2020
1 parent 036ef64 commit 9b448b8
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 44 deletions.
41 changes: 21 additions & 20 deletions .travis.yml
@@ -1,9 +1,9 @@
language: generic

env:
global:
- PYTHONIOENCODING=UTF8
- MPLBACKEND=Agg
global:
- PYTHONIOENCODING=UTF8
- MPLBACKEND=Agg

matrix:
include:
Expand All @@ -20,28 +20,29 @@ matrix:
- CONDA=true

before_install:

- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- . $HOME/miniconda/etc/profile.d/conda.sh
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda # get latest conda version
- conda info -a # Useful for debugging any issues with conda
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- . $HOME/miniconda/etc/profile.d/conda.sh
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda # get latest conda version
- conda info -a # Useful for debugging any issues with conda

install:
- conda env create -f environment.yml
- conda activate pyirf
- pip install travis-sphinx codecov pytest-cov
- python setup.py install
- sed -i -e "s/- python=.*/- python=$PYTHON_VERSION/g" environment.yml
- conda env create -f environment.yml
- conda activate pyirf-dev
- pip install travis-sphinx codecov pytest-cov
- pip install .
- python --version

script:
- pytest --cov=pyirf
- pytest --cov=pyirf

after_script:
- if [[ "$CONDA" == "true" ]];then
conda deactivate
fi
- if [[ "$CONDA" == "true" ]];then
conda deactivate
fi

after_success:
- codecov
- codecov
11 changes: 11 additions & 0 deletions docs/binning.rst
@@ -0,0 +1,11 @@
.. _binning:

Binning and Histogram Utilities
===============================


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

.. automodapi:: pyirf.binning
:no-inheritance-diagram:
9 changes: 3 additions & 6 deletions docs/conf.py
Expand Up @@ -40,10 +40,9 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"rinoh.frontend.sphinx",
"sphinx_automodapi.automodapi",
"sphinx.ext.autodoc",
"numpydoc",
"nbsphinx",
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
Expand All @@ -55,8 +54,6 @@
"sphinx.ext.napoleon",
"sphinx_automodapi.automodapi",
"sphinx_automodapi.smart_resolver",
"nbsphinx",
"IPython.sphinxext.ipython_console_highlighting",
]

# nbsphinx
Expand All @@ -79,7 +76,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "alabaster"
html_theme = "sphinx_rtd_theme"

html_theme_options = {
"github_user": "cta-observatory",
Expand Down
10 changes: 10 additions & 0 deletions docs/index.rst
Expand Up @@ -52,14 +52,24 @@ which this documentation is linked.
:caption: Structure
:maxdepth: 1

spectral
binning
io/index
resources/index
perf/index
scripts/index


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

.. automodapi:: pyirf
:no-inheritance-diagram:

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

16 changes: 0 additions & 16 deletions docs/requirements.txt

This file was deleted.

11 changes: 11 additions & 0 deletions docs/spectral.rst
@@ -0,0 +1,11 @@
.. _spectral:

Event Weighting and Spectrum Definitions
========================================


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

.. automodapi:: pyirf.spectral
:no-inheritance-diagram:
8 changes: 8 additions & 0 deletions environment.yml
Expand Up @@ -4,6 +4,7 @@ name: pyirf-dev
channels:
- default
dependencies:
- python=3.7
- astropy
- numpy
- ipython
Expand All @@ -12,6 +13,13 @@ dependencies:
- pytest
- scipy
- setuptools
# docs
- numpydoc
- sphinx
- sphinx_rtd_theme
- pip
- pip:
- rinohtype
- nbsphinx
- gammapy~=0.8.0
- sphinx_automodapi
4 changes: 2 additions & 2 deletions pyirf/spectral.py
Expand Up @@ -135,8 +135,8 @@ def __call__(self, energy):
e_ref=1 * u.GeV,
)

# From "Description of CTA Instrument Response Functions (Production 3b Simulation)"
# section 4.3.1
#: Proton spectrum definition defined in the CTA Prod3b IRF Document
#: From "Description of CTA Instrument Response Functions (Production 3b Simulation), section 4.3.1
IRFDOC_PROTON_SPECTRUM = PowerLaw(
flux_normalization=9.8e-6 / (u.cm**2 * u.s * u.TeV * u.sr),
spectral_index=-2.62,
Expand Down
11 changes: 11 additions & 0 deletions setup.py
Expand Up @@ -15,5 +15,16 @@
"pandas",
"scipy",
"tables",
"gammapy~=0.8.0",
],
extras_require={
'docs': [
'rinohtype',
'sphinx',
'sphinx_rtd_theme',
'sphinx_automodapi',
'numpydoc',
'nbsphinx'
]
}
)

0 comments on commit 9b448b8

Please sign in to comment.