Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from cdeil/setuptools-entrypoints
Move scripts to gammapy/scripts and use setuptools entry_points
- Loading branch information
Showing
72 changed files
with
1,707 additions
and
1,488 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,9 @@ htmlcov | |
# Sphinx | ||
_build | ||
|
||
# Pytest | ||
.cache | ||
|
||
# Packages/installer info | ||
*.egg | ||
*.egg-info | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,36 @@ | ||
.. _scripts: | ||
|
||
Command line tools | ||
================== | ||
*************************************** | ||
Command line tools (`gammapy.scripts`) | ||
*************************************** | ||
|
||
The ``gammapy/scripts`` folder contains command line tools | ||
that are also installed in the ``bin`` directory if you install Gammapy | ||
and are thus available to you if that is on your ``$PATH``. | ||
.. currentmodule:: gammapy.scripts | ||
|
||
TODO: explain better how to find out where the scripts were installed, | ||
i.e. what the user should add to their ``$PATH``. | ||
Introduction | ||
============ | ||
|
||
.. note:: For now the full list of scripts is only available here: | ||
https://github.com/gammapy/gammapy/tree/master/scripts | ||
|
||
We plan to integrate that into the online Sphinx docs ... | ||
please help if you know how to do this: | ||
https://github.com/gammapy/gammapy/issues/24 | ||
Currently the `gammapy.scripts` sub-package contains the Gammapy command line tools. | ||
|
||
Here's an example of a script listed by hand ... this should be auto-generated | ||
by ``build_sphinx``: | ||
This might change though ... see the notes here: | ||
https://github.com/gammapy/gammapy/pull/230 | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
To be able to use them you have to install Gammapy: | ||
|
||
gammapy-info | ||
.. code-block:: bash | ||
$ pip install --user . | ||
For Gammapy development we recommend you run this command so that you can edit | ||
Gammapy and the tools and don't have to re-install after every change. | ||
|
||
.. code-block:: bash | ||
$ pip install --user --editable . | ||
Reference/API | ||
============= | ||
|
||
.. automodapi:: gammapy.scripts | ||
:no-inheritance-diagram: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Licensed under a 3-clause BSD style license - see LICENSE.rst | ||
"""Gammapy command line tools. | ||
TODO: document how this works and how users should write their own | ||
command line tools. | ||
""" | ||
|
||
from .background_cube import * | ||
from .bin_cube import * | ||
from .bin_image import * | ||
from .check import * | ||
from .coordinate_images import * | ||
from .cwt import * | ||
from .derived_images import * | ||
from .detect import * | ||
from .find_runs import * | ||
from .image_decompose_a_trous import * | ||
from .info import * | ||
from .irf_info import * | ||
from .irf_root_to_fits import * | ||
from .iterative_source_detect import * | ||
from .look_up_image import * | ||
from .model_image import * | ||
from .pfmap import * | ||
from .pfsim import * | ||
from .pfspec import * | ||
from .reflected_regions import * | ||
from .residual_images import * | ||
from .root_to_fits import * | ||
from .sherpa_like import * | ||
from .sherpa_model_image import * | ||
from .significance_image import * | ||
from .simulate_source_catalog import * | ||
# from .ts_image import * | ||
from .xspec import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Licensed under a 3-clause BSD style license - see LICENSE.rst | ||
from __future__ import (absolute_import, division, print_function, | ||
unicode_literals) | ||
from ..utils.scripts import get_parser | ||
|
||
__all__ = ['background_cube'] | ||
|
||
|
||
def main(args=None): | ||
parser = get_parser(background_cube) | ||
parser.add_argument('run_list', type=str, | ||
help='Input run list file name') | ||
parser.add_argument('exclusion_list', type=str, | ||
help='Input exclusion list file name') | ||
parser.add_argument('reference_file', type=str, | ||
help='Input FITS reference cube file name') | ||
parser.add_argument('out_file', type=str, | ||
help='Output FITS counts cube file name') | ||
parser.add_argument('--overwrite', action='store_true', | ||
help='Overwrite existing output file?') | ||
args = parser.parse_args(args) | ||
background_cube(**vars(args)) | ||
|
||
|
||
def background_cube(run_list, | ||
exclusion_list, | ||
reference_file, | ||
out_file, | ||
overwrite): | ||
"""Create background model cube from off runs. | ||
TODO: explain a bit. | ||
""" | ||
import logging | ||
logging.basicConfig(level=logging.DEBUG, format='%(levelname)s - %(message)s') | ||
|
||
# TODO: implement | ||
raise NotImplementedError |
Oops, something went wrong.