Skip to content

Commit

Permalink
Merge branch 'main' into improve_resource_handling
Browse files Browse the repository at this point in the history
  • Loading branch information
HealthyPear committed Sep 19, 2024
2 parents bb1ea75 + 4dc1d28 commit 9f69958
Show file tree
Hide file tree
Showing 16 changed files with 355 additions and 226 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
PYTHON_VERSION: ${{ matrix.python-version }}
run: |
# setup correct python version
sed -i -e "s/- python=.*/- python=$PYTHON_VERSION/g" environment.yml
sed -i -e "s/- python.*/- python=$PYTHON_VERSION/g" environment.yml
- name: mamba setup
if: matrix.install-method == 'mamba' && contains(github.event.pull_request.labels.*.name, 'documentation-only') == false
Expand Down
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ repos:
- id: check-yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.1
rev: v0.4.10
hooks:
# Run the linter.
- id: ruff
args: [--fix]
types_or: [ python, pyi, jupyter ]
args: [ --fix ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi, jupyter ]
- repo: https://github.com/rstcheck/rstcheck
rev: "v6.2.0"
hooks:
Expand Down
22 changes: 15 additions & 7 deletions docs/source/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,33 @@ Reference API
Command-line tools
==================

.. argparse::
:module: iact_estimator.scripts.main
:func: parser
:prog: iact-estimator
:nosubcommands:

.. _iact-estimator-cfg:

iact-estimator-cfg
-------------------
Get the default config file
---------------------------

.. argparse::
:module: iact_estimator.scripts.get_config
:module: iact_estimator.scripts.main
:func: parser
:prog: iact-estimator-cfg
:prog: iact-estimator
:path: config

.. _iact-estimator:

iact-estimator
---------------
Run the estimation process
--------------------------

.. argparse::
:module: iact_estimator.scripts.estimator
:module: iact_estimator.scripts.main
:func: parser
:prog: iact-estimator
:path: run

Package resources
=================
Expand Down
2 changes: 2 additions & 0 deletions docs/source/changes/18.changed.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Grouped all CLI into a single executable with subcommands.
Also added an new configuration option to disable the plotting figures windows.
4 changes: 3 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from pathlib import Path
import tomllib

import gammapy

from iact_estimator.version import __version__

PROJECT_ROOT_DIR = Path(__file__).parent.parent.parent.resolve()
Expand Down Expand Up @@ -83,7 +85,7 @@
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"astropy": ("https://docs.astropy.org/en/latest/", None),
"gammapy": ("https://docs.python.org/3", None),
"gammapy": (f"https://docs.gammapy.org/{gammapy.__version__}/", None),
"matplotlib": ("https://matplotlib.org/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
Expand Down
29 changes: 29 additions & 0 deletions docs/source/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,35 @@ A simple template for a function is the following,
Please, see the `numpydoc style guide <https://numpydoc.readthedocs.io/en/latest/format.html>`_ for more details.

Changelog
---------

This project is supported by a changelog to let users know what has been fixed
or improved.

Whenever you add a new contribution, you should always open first a new issue to track it,
then a Pull Request (PR) that closes that issue.

Every PR needs to add at least one *news fragment*, a small *.rst* file under ``docs/source/changes``
containing a description of what was changed in a way that is usefull for the user.

The name of the file has to follow the template ``PULL_REQUEST_ID.CONTRIBUTION_TYPE.rst``,
where ``CONTRIBUTION_TYPE`` has to be one of the following:

- removed
- deprecated
- added
- changed
- fixed

For example: a bug fix was found and an issue was opened.
A PR with ID #5 was opened to fix the bug and it introduced the file ``5.fixed.rst``
which reads,

.. code-block::
Fixed a terrible bug which caused this function to output this nonsense result.
.. _contribute_auth:

Authorship
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies:
- sphinx-autoapi
- sphinx-copybutton
- sphinxcontrib-towncrier
- towncrier<24.7
# Testing
- pytest
- pytest-console-scripts
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = [
]
description = "Estimate the performance of an IACT telescope system to an observation."
readme = "README.md"
requires-python = ">=3.11"
requires-python = ">=3.9"
keywords = ["iact", "cherenkov", "astronomy"]
license = { text = "BSD-3-Clause" }
classifiers = [
Expand Down Expand Up @@ -41,13 +41,13 @@ docs = [
"sphinx-autoapi",
"sphinx-copybutton",
"sphinxcontrib-towncrier",
"towncrier<24.7"
]
dev = ["pre-commit", "ruff", "iact_estimator[docs]", "iact_estimator[tests]"]
tests = ["pytest", "pytest-console-scripts"]

[project.scripts]
iact-estimator = "iact_estimator.scripts.estimator:main"
iact-estimator-cfg = "iact_estimator.scripts.get_config:main"
iact-estimator = "iact_estimator.scripts.main:main"

[tool.setuptools_scm]
write_to = "src/iact_estimator/_version.py"
Expand Down
1 change: 1 addition & 0 deletions src/iact_estimator/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pulsar_mode:
pulsar_off_range: 0.25 # range of OFF phases used for pulsar mode# global variables (DO NOT MODIFY)

plotting_options:
show: False
figure_size: [20, 10]
bbox_inches: "tight"
min_energy: "40 GeV"
Expand Down
184 changes: 0 additions & 184 deletions src/iact_estimator/scripts/estimator.py

This file was deleted.

28 changes: 0 additions & 28 deletions src/iact_estimator/scripts/get_config.py

This file was deleted.

Loading

0 comments on commit 9f69958

Please sign in to comment.