scripts - Command line tools#

gammapy#

Gammapy command line interface (CLI).

Gammapy is a Python package for gamma-ray astronomy.

Use --help to see available sub-commands, as well as the available arguments and options for each sub-command.

For further information, see https://gammapy.org/ and https://docs.gammapy.org/

Examples
——–
$ gammapy –help
$ gammapy –version
$ gammapy info –help
$ gammapy info
gammapy [OPTIONS] COMMAND [ARGS]...

Options

--log-level <log_level>#

Logging verbosity level.

Options

debug | info | warning | error

--ignore-warnings#

Ignore warnings?

--version#

Print version and exit.

analysis#

Automation of configuration driven data reduction process.

Examples
——–
$ gammapy analysis config
$ gammapy analysis run
$ gammapy analysis config –overwrite
$ gammapy analysis config –filename myconfig.yaml
$ gammapy analysis run –filename myconfig.yaml
gammapy analysis [OPTIONS] COMMAND [ARGS]...

config#

Writes default configuration file.

gammapy analysis config [OPTIONS]

Options

--filename <filename>#

Filename to store the default configuration values.

Default

config.yaml

--overwrite#

Overwrite existing file.

run#

Performs automated data reduction process.

gammapy analysis run [OPTIONS]

Options

--filename <filename>#

Filename with default configuration values.

Default

config.yaml

--out <out>#

Output folder where reduced datasets are stored.

Default

datasets

--overwrite#

Overwrite existing datasets.

check#

Run checks for Gammapy

gammapy check [OPTIONS] COMMAND [ARGS]...

logging#

Check logging

gammapy check logging [OPTIONS]

download#

Download notebooks and datasets.

Download notebooks published in the Gammapy documentation as well as the
related datasets needed to execute them.
- The option notebooks will download the notebook files into a gammapy-notebooks
folder created at the current working directory.
- The option datasets will download the datasets used in the documentation into a
gammapy-datasets folder created at the current working directory.
Examples
——–
$ gammapy download datasets –out localfolder
$ gammapy download notebooks –release 0.18 –out localfolder
gammapy download [OPTIONS] COMMAND [ARGS]...

datasets#

Download datasets

gammapy download datasets [OPTIONS]

Options

--out <out>#

Destination folder.

Default

gammapy-datasets

notebooks#

Download notebooks

gammapy download notebooks [OPTIONS]

Options

--release <release>#

Required Number of stable release - ex: 0.18.2)

--out <out>#

Path where the versioned notebook files will be copied.

Default

gammapy-notebooks

info#

Display information about Gammapy

gammapy info [OPTIONS]

Options

--system, --no-system#

Show system info

--version, --no-version#

Show version

--dependencies, --no-dependencies#

Show dependencies

--envvar, --no-envvar#

Show environment variables

jupyter#

Perform a series of actions on Jupyter notebooks.

The chosen action is applied by default for every Jupyter notebook present in the current working directory.

Examples
——–
$ gammapy jupyter strip
$ gammapy jupyter –src my/notebook.ipynb run
$ gammapy jupyter –src my/folder test
$ gammapy jupyter –src my/recursive/folder –r black
gammapy jupyter [OPTIONS] COMMAND [ARGS]...

Options

--src <src>#

Local folder or Jupyter notebook filename.

--r#

Apply to notebooks found recursively in folder.

black#

Format code cells with black.

gammapy jupyter black [OPTIONS]

run#

Execute Jupyter notebooks.

gammapy jupyter run [OPTIONS]

Options

--tutor#

Tutorials environment?

Default

False

--kernel <kernel>#

Kernel name

Default

python3

strip#

Strip output cells.

gammapy jupyter strip [OPTIONS]

tar#

Create a tar file with the notebooks in docs.

gammapy jupyter tar [OPTIONS]

Options

--out <out>#

Path and filename for the tar file that will be created.

Default

notebooks.tar

test#

Check if Jupyter notebooks are broken.

gammapy jupyter test [OPTIONS]

Options

--tutor#

Tutorials environment?

Default

False

--kernel <kernel>#

Kernel name

Default

python3