Skip to content

Commit

Permalink
Merge pull request #18 from cta-observatory/cli-group_commands
Browse files Browse the repository at this point in the history
Group CLI into single executable with subcommands
  • Loading branch information
HealthyPear authored Sep 19, 2024
2 parents f216460 + db0f40b commit 4dc1d28
Show file tree
Hide file tree
Showing 10 changed files with 278 additions and 206 deletions.
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
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 @@ -31,6 +31,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
167 changes: 0 additions & 167 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 4dc1d28

Please sign in to comment.