Creating command-line Tools

[1]:
from ctapipe.core import Tool, Component, TelescopeComponent
from ctapipe.core.traits import (
    Integer, Float, List, Dict, Unicode,
    TraitError, observe, FloatTelescopeParameter,
    Path,
)
import logging
from time import sleep
from astropy import units as u
from ctapipe.utils import get_dataset_path
/usr/local/lib/python3.8/site-packages/setuptools_scm/git.py:68: UserWarning: "/github/workspace" is shallow and may cause errors
  warnings.warn('"{}" is shallow and may cause errors'.format(wd.path))
[2]:
GAMMA_FILE = get_dataset_path('gamma_test.simtel.gz')
Downloading gamma_test.simtel.gz:  85%|████████▍ | 12.2M/14.4M [00:01<00:01, 1.86MB/s]

see https://github.com/ipython/traitlets/blob/master/examples/myapp.py

Setup:

Create a few Components that we will use later in a Tool:

[3]:
class MyComponent(Component):
    """ A Component that does stuff """

    value = Integer(default_value=-1, help="Value to use").tag(config=True)

    def do_thing(self):
        self.log.debug("Did thing")


# in order to have 2 of the same components at once
class SecondaryMyComponent(MyComponent):
    pass


class AdvancedComponent(Component):
    """ An advanced technique """

    value1 = Integer(default_value=-1, help="Value to use").tag(config=True)
    infile = Path(
        help="input file name",
        exists=None,  # set to True to require existing, False for requiring non-existing
        directory_ok=False,
    ).tag(config=True)
    outfile = Path(
        help="output file name",
        exists=False, directory_ok=False
    ).tag(config=True)

    def __init__(self, config=None, parent=None, **kwargs):
        super().__init__(config=config, parent=parent, **kwargs)
        # components can have sub components, but these must have
        # then parent=self as argument and be assigned as member
        # so the full config can be received later
        self.subcompent = MyComponent(parent=self)

    @observe("outfile")
    def on_outfile_changed(self, change):
        self.log.warning("Outfile was changed to '{}'".format(change))


class TelescopeWiseComponent(TelescopeComponent):
    """ a component that contains parameters that are per-telescope configurable """

    param = FloatTelescopeParameter(
        help="Something configurable with telescope patterns", default_value=5.0
    ).tag(config=True)
[4]:
MyComponent()
[4]:
MyComponent

A Component that does stuff

value -1 Value to use (default: -1)
[5]:
AdvancedComponent()
[5]:
AdvancedComponent

An advanced technique

infile None input file name (default: None)
outfile None output file name (default: None)
value1 -1 Value to use (default: -1)

TelescopeComponents need to have a subarray given to them in order to work (since they need one to turn a TelescopeParameter into a concrete list of values for each telescope. Here we will give a dummy one:

[6]:
from ctapipe.instrument import SubarrayDescription, TelescopeDescription

subarray = SubarrayDescription(
    "Junk",
    tel_positions={1: (0.0, 0.0, 0.0) * u.m, 2: (1.0, 1.0, 0.0) * u.m},
    tel_descriptions={
        1: TelescopeDescription.from_name("LST", "LSTCam"),
        2: TelescopeDescription.from_name("MST", "NectarCam"),
    },
)
subarray.info()
Downloading gamma_test.simtel.gz: 100%|██████████| 14.4M/14.4M [00:01<00:00, 11.9MB/s]
Resorting to default CameraReadout, File does not exist: (LSTCam.camreadout)
Downloading optics.ecsv.txt: 100%|██████████| 1.04k/1.04k [00:00<00:00, 200kB/s]
Downloading NectarCam.camgeom.fits.gz: 100%|██████████| 23.1k/23.1k [00:00<00:00, 231kB/s]
Resorting to default CameraReadout, File does not exist: (NectarCam.camreadout)
Subarray : Junk
Num Tels : 2
Footprint: 0.00 km2

                TYPE  Num IDmin  IDmax
=====================================
      LST_LST_LSTCam    1    1 ..   1
   MST_MST_NectarCam    1    2 ..   2
[7]:
TelescopeWiseComponent(subarray=subarray)
[7]:
TelescopeWiseComponent

a component that contains parameters that are per-telescope configurable

param [('type', '*', 5.0)] Something configurable with telescope patterns (default: traitlets.Undefined)

This TelescopeParameters can then be set using a list of patterns like:

component.param = [
    ("type", "LST*",3.0),
    ("type", "MST*", 2.0),
    (id, 25, 4.0)
]

These get translated into per-telescope-id values once the subarray is registered. After that one acccess the per-telescope id values via:

component.param.tel[tel_id]

Now create an executable Tool that contains the Components

[8]:
class MyTool(Tool):
    name="mytool"
    description="do some things and stuff"
    aliases = dict(
        infile='AdvancedComponent.infile',
        iterations='MyTool.iterations'
    )

    # Which classes are registered for configuration
    classes = List([MyComponent, AdvancedComponent, SecondaryMyComponent, TelescopeWiseComponent])

    # local configuration parameters
    iterations = Integer(5,help="Number of times to run",allow_none=False).tag(config=True)

    def setup(self):
        self.comp = MyComponent(parent=self)
        self.comp2 = SecondaryMyComponent(parent=self)
        self.comp3 = TelescopeWiseComponent(parent=self, subarray=subarray)
        self.advanced = AdvancedComponent(parent=self)


    def start(self):
        self.log.info("Performing {} iterations...".format(self.iterations))
        for ii in range(self.iterations):
            self.log.info("ITERATION {}".format(ii))
            self.comp.do_thing()
            self.comp2.do_thing()
            sleep(0.1)

    def finish(self):
        self.log.warning("Shutting down.")

Get Help info

The following allows you to print the help info within a Jupyter notebook, but this same inforamtion would be displayed if the user types:

mytool --help
[9]:
tool=MyTool()
[10]:
tool.print_help()
do some things and stuff

Options
=======
The options below are convenience aliases to configurable class-options,
as listed in the "Equivalent to" description-line of the aliases.
To see all configurable class-options for some <cmd>, use:
    <cmd> --help-all

--debug
    Set log-level to debug, for the most verbose logging.
    Equivalent to: [--Application.log_level=10]
--show-config
    Show the application's configuration (human-readable format)
    Equivalent to: [--Application.show_config=True]
--show-config-json
    Show the application's configuration (json format)
    Equivalent to: [--Application.show_config_json=True]
-q
    Disable console logging.
    Equivalent to: [--Tool.quiet=True]
--no-q
    set Tool.quiet=False
    Equivalent to: [--Tool.quiet=False]
--infile=<Path>
    input file name
    Default: None
    Equivalent to: [--AdvancedComponent.infile]
--iterations=<Int>
    Number of times to run
    Default: 5
    Equivalent to: [--MyTool.iterations]
--config=<Path>
    name of a configuration file with parameters to load in addition to command-
    line parameters
    Default: None
    Equivalent to: [--Tool.config_file]
--log-level=<Enum>
    Set the log level by value or name.
    Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']
    Default: 30
    Equivalent to: [--Tool.log_level]
--log-file=<Path>
    Filename for the log
    Default: None
    Equivalent to: [--Tool.log_file]
--log=<Path>
    Filename for the log
    Default: None
    Equivalent to: [--Tool.log_file]
-l=<Path>
    Filename for the log
    Default: None
    Equivalent to: [--Tool.log_file]
--log-file-level=<Enum>
    Logging Level for File Logging
    Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']
    Default: 'INFO'
    Equivalent to: [--Tool.log_file_level]

To see all available configurables, use `--help-all`.

The following is equivalant to the user typing mytool --help-all

[11]:
tool.print_help(classes=True)
do some things and stuff

Options
=======
The options below are convenience aliases to configurable class-options,
as listed in the "Equivalent to" description-line of the aliases.
To see all configurable class-options for some <cmd>, use:
    <cmd> --help-all

--debug
    Set log-level to debug, for the most verbose logging.
    Equivalent to: [--Application.log_level=10]
--show-config
    Show the application's configuration (human-readable format)
    Equivalent to: [--Application.show_config=True]
--show-config-json
    Show the application's configuration (json format)
    Equivalent to: [--Application.show_config_json=True]
-q
    Disable console logging.
    Equivalent to: [--Tool.quiet=True]
--no-q
    set Tool.quiet=False
    Equivalent to: [--Tool.quiet=False]
--infile=<Path>
    input file name
    Default: None
    Equivalent to: [--AdvancedComponent.infile]
--iterations=<Int>
    Number of times to run
    Default: 5
    Equivalent to: [--MyTool.iterations]
--config=<Path>
    name of a configuration file with parameters to load in addition to command-
    line parameters
    Default: None
    Equivalent to: [--Tool.config_file]
--log-level=<Enum>
    Set the log level by value or name.
    Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']
    Default: 30
    Equivalent to: [--Tool.log_level]
--log-file=<Path>
    Filename for the log
    Default: None
    Equivalent to: [--Tool.log_file]
--log=<Path>
    Filename for the log
    Default: None
    Equivalent to: [--Tool.log_file]
-l=<Path>
    Filename for the log
    Default: None
    Equivalent to: [--Tool.log_file]
--log-file-level=<Enum>
    Logging Level for File Logging
    Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']
    Default: 'INFO'
    Equivalent to: [--Tool.log_file_level]

Class options
=============
The command-line option below sets the respective configurable class-parameter:
    --Class.parameter=value
This line is evaluated in Python, so simple expressions are allowed.
For instance, to set `C.a=[0,1,2]`, you may type this:
    --C.a='range(3)'

Application(SingletonConfigurable) options
------------------------------------------
--Application.log_datefmt=<Unicode>
    The date format used by logging formatters for %(asctime)s
    Default: '%Y-%m-%d %H:%M:%S'
--Application.log_format=<Unicode>
    The Logging format template
    Default: '[%(name)s]%(highlevel)s %(message)s'
--Application.log_level=<Enum>
    Set the log level by value or name.
    Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']
    Default: 30
--Application.show_config=<Bool>
    Instead of starting the Application, dump configuration to stdout
    Default: False
--Application.show_config_json=<Bool>
    Instead of starting the Application, dump configuration to stdout (as JSON)
    Default: False

Tool(Application) options
-------------------------
--Tool.config_file=<Path>
    name of a configuration file with parameters to load in addition to command-
    line parameters
    Default: None
--Tool.log_config=<key-1>=<value-1>...
    Default: {'version': 1, 'disable_existing_loggers': False, 'formatters...
--Tool.log_datefmt=<Unicode>
    The date format used by logging formatters for %(asctime)s
    Default: '%Y-%m-%d %H:%M:%S'
--Tool.log_file=<Path>
    Filename for the log
    Default: None
--Tool.log_file_level=<Enum>
    Logging Level for File Logging
    Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']
    Default: 'INFO'
--Tool.log_format=<Unicode>
    The Logging format template
    Default: '[%(name)s]%(highlevel)s %(message)s'
--Tool.log_level=<Enum>
    Set the log level by value or name.
    Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']
    Default: 30
--Tool.provenance_log=<Path>
    Default: None
--Tool.quiet=<Bool>
    Default: False
--Tool.show_config=<Bool>
    Instead of starting the Application, dump configuration to stdout
    Default: False
--Tool.show_config_json=<Bool>
    Instead of starting the Application, dump configuration to stdout (as JSON)
    Default: False

MyTool(Tool) options
--------------------
--MyTool.config_file=<Path>
    name of a configuration file with parameters to load in addition to command-
    line parameters
    Default: None
--MyTool.iterations=<Int>
    Number of times to run
    Default: 5
--MyTool.log_config=<key-1>=<value-1>...
    Default: {'version': 1, 'disable_existing_loggers': False, 'formatters...
--MyTool.log_datefmt=<Unicode>
    The date format used by logging formatters for %(asctime)s
    Default: '%Y-%m-%d %H:%M:%S'
--MyTool.log_file=<Path>
    Filename for the log
    Default: None
--MyTool.log_file_level=<Enum>
    Logging Level for File Logging
    Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']
    Default: 'INFO'
--MyTool.log_format=<Unicode>
    The Logging format template
    Default: '[%(name)s]%(highlevel)s %(message)s'
--MyTool.log_level=<Enum>
    Set the log level by value or name.
    Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']
    Default: 30
--MyTool.provenance_log=<Path>
    Default: None
--MyTool.quiet=<Bool>
    Default: False
--MyTool.show_config=<Bool>
    Instead of starting the Application, dump configuration to stdout
    Default: False
--MyTool.show_config_json=<Bool>
    Instead of starting the Application, dump configuration to stdout (as JSON)
    Default: False

MyComponent(Component) options
------------------------------
--MyComponent.value=<Int>
    Value to use
    Default: -1

AdvancedComponent(Component) options
------------------------------------
--AdvancedComponent.infile=<Path>
    input file name
    Default: None
--AdvancedComponent.outfile=<Path>
    output file name
    Default: None
--AdvancedComponent.value1=<Int>
    Value to use
    Default: -1

SecondaryMyComponent(MyComponent) options
-----------------------------------------
--SecondaryMyComponent.value=<Int>
    Value to use
    Default: -1

TelescopeWiseComponent(TelescopeComponent) options
--------------------------------------------------
--TelescopeWiseComponent.param=<floattelescopeparameter-item-1>...
    Something configurable with telescope patterns
    Default: [('type', '*', 5.0)]

Run the tool

here we pass in argv since it is a Notebook, but if argv is not specified it’s read from sys.argv, so the following is the same as running:

mytool --log_level=INFO --infile gamma_test.simtel.gz --iterations=3

As Tools are intended to be exectutables, they are raising SystemExit on exit. Here, we use them to demonstrate how it would work, so we catch the SystemExit.

[12]:
try:
    tool.run(argv=['--infile',  str(GAMMA_FILE)])
except SystemExit as e:
    assert e.code == 0, f'Tool returned with error status {e}'
2020-12-01 09:29:40,799 WARNING [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.finish): Shutting down.
[13]:
tool.log_format = "%(asctime)s : %(levelname)s [%(name)s %(funcName)s] %(message)s"


try:
    tool.run(argv=['--log-level','INFO','--infile', str(GAMMA_FILE), '--iterations','3'])
except SystemExit as e:
    assert e.code == 0, f'Tool returned with error status {e}'
/usr/local/lib/python3.8/site-packages/traitlets/config/application.py:204: RuntimeWarning: No Handler found on <Logger ctapipe.mytool (WARNING)>, setting log_format will have no effect
  warnings.warn(
2020-12-01 09:29:40,822 INFO [ctapipe.mytool] (tool.initialize): ctapipe version 0.1.dev1+gddc003f
2020-12-01 09:29:40,823 INFO [ctapipe.mytool] (tool.run): Starting: mytool
2020-12-01 09:29:40,838 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): Performing 3 iterations...
2020-12-01 09:29:40,839 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 0
2020-12-01 09:29:40,940 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 1
2020-12-01 09:29:41,041 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 2
2020-12-01 09:29:41,142 WARNING [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.finish): Shutting down.
2020-12-01 09:29:41,143 INFO [ctapipe.mytool] (tool.run): Finished: mytool
2020-12-01 09:29:41,146 INFO [ctapipe.mytool] (tool.write_provenance): Output:
2020-12-01 09:29:41,147 INFO [ctapipe.mytool] (tool.write_provenance): Output:

here we change the log-level to DEBUG:

[14]:
try:
    tool.run(argv=['--log-level','DEBUG','--infile', str(GAMMA_FILE)])
except SystemExit as e:
    assert e.code == 0, f'Tool returned with error status {e}'
2020-12-01 09:29:41,165 DEBUG [ctapipe.mytool] (application._config_changed): Config changed: {'AdvancedComponent': {'infile': '/github/home/.cache/ctapipe/gamma_test.simtel.gz'}, 'attach_subarray': <LazyConfigValue {}>, 'MyTool': {'log_level': 'DEBUG', 'iterations': 3}}
2020-12-01 09:29:41,169 INFO [ctapipe.mytool] (tool.initialize): ctapipe version 0.1.dev1+gddc003f
2020-12-01 09:29:41,170 INFO [ctapipe.mytool] (tool.run): Starting: mytool
2020-12-01 09:29:41,179 DEBUG [ctapipe.core.provenance] (provenance.start_activity): started activity: mytool
2020-12-01 09:29:41,182 DEBUG [ctapipe.core.traits] (traits.attach_subarray): argument '*' matched: ['LST_LST_LSTCam', 'MST_MST_NectarCam']
2020-12-01 09:29:41,186 DEBUG [ctapipe.mytool] (tool.run): CONFIG: {'MyTool': {'config_file': None, 'iterations': 3, 'log_config': {'version': 1, 'disable_existing_loggers': False, 'formatters': {'file': {'()': <class 'ctapipe.core.logging.PlainFormatter'>, 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}, 'console': {'()': <class 'ctapipe.core.logging.ColoredFormatter'>, 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}}, 'handlers': {'ctapipe-console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 10}, 'console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 'NOTSET'}}, 'loggers': {'ctapipe': {'level': 10, 'handlers': ['ctapipe-console'], 'propagate': False}}}, 'log_datefmt': '%Y-%m-%d %H:%M:%S', 'log_file': None, 'log_file_level': 'INFO', 'log_format': '%(asctime)s : %(levelname)s [%(name)s %(funcName)s] %(message)s', 'log_level': 10, 'provenance_log': PosixPath('/github/workspace/docs/examples/mytool.provenance.log'), 'quiet': False, 'show_config': False, 'show_config_json': False, 'MyComponent': {'value': -1}, 'SecondaryMyComponent': {'value': -1}, 'TelescopeWiseComponent': {'param': [('type', '*', 5.0)]}, 'AdvancedComponent': {'infile': PosixPath('/github/home/.cache/ctapipe/gamma_test.simtel.gz'), 'outfile': None, 'value1': -1, 'MyComponent': {'value': -1}}}}
2020-12-01 09:29:41,187 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): Performing 3 iterations...
2020-12-01 09:29:41,189 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 0
2020-12-01 09:29:41,190 DEBUG [ctapipe.mytool.MyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:41,190 DEBUG [ctapipe.mytool.SecondaryMyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:41,291 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 1
2020-12-01 09:29:41,292 DEBUG [ctapipe.mytool.MyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:41,294 DEBUG [ctapipe.mytool.SecondaryMyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:41,396 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 2
2020-12-01 09:29:41,397 DEBUG [ctapipe.mytool.MyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:41,399 DEBUG [ctapipe.mytool.SecondaryMyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:41,500 WARNING [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.finish): Shutting down.
2020-12-01 09:29:41,501 INFO [ctapipe.mytool] (tool.run): Finished: mytool
2020-12-01 09:29:41,504 DEBUG [ctapipe.core.provenance] (provenance.finish_activity): finished activity: mytool
2020-12-01 09:29:41,507 INFO [ctapipe.mytool] (tool.write_provenance): Output:
2020-12-01 09:29:41,507 INFO [ctapipe.mytool] (tool.write_provenance): Output:
2020-12-01 09:29:41,508 INFO [ctapipe.mytool] (tool.write_provenance): Output:
2020-12-01 09:29:41,510 DEBUG [ctapipe.mytool] (tool.write_provenance): PROVENANCE: '[
   {
      "activity_name": "mytool",
      "activity_uuid": "844f88f2-417e-4f3c-8eea-eff158207ac1",
      "start": {
         "time_utc": "2020-12-01T09:29:40.285"
      },
      "stop": {
         "time_utc": "2020-12-01T09:29:40.801"
      },
      "system": {
         "ctapipe_version": "0.1.dev1+gddc003f",
         "ctapipe_resources_version": "not installed",
         "eventio_version": "1.4.2",
         "ctapipe_svc_path": null,
         "executable": "/usr/local/bin/python3",
         "platform": {
            "architecture_bits": "64bit",
            "architecture_linkage": "",
            "machine": "x86_64",
            "processor": "",
            "node": "e54bc70aaa4e",
            "version": "#32~18.04.1-Ubuntu SMP Tue Oct 6 10:03:22 UTC 2020",
            "system": "Linux",
            "release": "5.4.0-1031-azure",
            "libcver": [
               "glibc",
               "2.28"
            ],
            "num_cpus": 2,
            "boot_time": "2020-12-01T09:25:05.000"
         },
         "python": {
            "version_string": "3.8.2 (default, Feb 26 2020, 15:09:34) \n[GCC 8.3.0]",
            "version": [
               "3",
               "8",
               "2"
            ],
            "compiler": "GCC 8.3.0",
            "implementation": "CPython"
         },
         "environment": {
            "CONDA_DEFAULT_ENV": null,
            "CONDA_PREFIX": null,
            "CONDA_PYTHON_EXE": null,
            "CONDA_EXE": null,
            "CONDA_PROMPT_MODIFIER": null,
            "CONDA_SHLVL": null,
            "PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LD_LIBRARY_PATH": null,
            "DYLD_LIBRARY_PATH": null,
            "USER": null,
            "HOME": "/github/home",
            "SHELL": null
         },
         "arguments": [
            "/usr/local/lib/python3.8/site-packages/ipykernel_launcher.py",
            "-f",
            "/tmp/tmpdsi7xlox.json",
            "--HistoryManager.hist_file=:memory:"
         ],
         "start_time_utc": "2020-12-01T09:29:40.293"
      },
      "input": [],
      "output": [],
      "config": {
         "MyTool": {
            "config_file": null,
            "iterations": 5,
            "log_config": {
               "version": 1,
               "disable_existing_loggers": false,
               "formatters": {
                  "file": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  },
                  "console": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  }
               },
               "handlers": {
                  "ctapipe-console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": 10
                  },
                  "console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": "NOTSET"
                  }
               },
               "loggers": {
                  "ctapipe": {
                     "level": 10,
                     "handlers": [
                        "ctapipe-console"
                     ],
                     "propagate": false
                  }
               }
            },
            "log_datefmt": "%Y-%m-%d %H:%M:%S",
            "log_file": null,
            "log_file_level": "INFO",
            "log_format": "[%(name)s]%(highlevel)s %(message)s",
            "log_level": 30,
            "provenance_log": "/github/workspace/docs/examples/mytool.provenance.log",
            "quiet": false,
            "show_config": false,
            "show_config_json": false,
            "MyComponent": {
               "value": -1
            },
            "SecondaryMyComponent": {
               "value": -1
            },
            "TelescopeWiseComponent": {
               "param": [
                  [
                     "type",
                     "*",
                     5.0
                  ]
               ]
            },
            "AdvancedComponent": {
               "infile": "/github/home/.cache/ctapipe/gamma_test.simtel.gz",
               "outfile": null,
               "value1": -1,
               "MyComponent": {
                  "value": -1
               }
            }
         }
      },
      "status": "completed",
      "duration_min": 0.008599999999896468
   },
   {
      "activity_name": "mytool",
      "activity_uuid": "51e487ab-7075-4812-af30-e00bd8a5eefe",
      "start": {
         "time_utc": "2020-12-01T09:29:40.825"
      },
      "stop": {
         "time_utc": "2020-12-01T09:29:41.145"
      },
      "system": {
         "ctapipe_version": "0.1.dev1+gddc003f",
         "ctapipe_resources_version": "not installed",
         "eventio_version": "1.4.2",
         "ctapipe_svc_path": null,
         "executable": "/usr/local/bin/python3",
         "platform": {
            "architecture_bits": "64bit",
            "architecture_linkage": "",
            "machine": "x86_64",
            "processor": "",
            "node": "e54bc70aaa4e",
            "version": "#32~18.04.1-Ubuntu SMP Tue Oct 6 10:03:22 UTC 2020",
            "system": "Linux",
            "release": "5.4.0-1031-azure",
            "libcver": [
               "glibc",
               "2.28"
            ],
            "num_cpus": 2,
            "boot_time": "2020-12-01T09:25:05.000"
         },
         "python": {
            "version_string": "3.8.2 (default, Feb 26 2020, 15:09:34) \n[GCC 8.3.0]",
            "version": [
               "3",
               "8",
               "2"
            ],
            "compiler": "GCC 8.3.0",
            "implementation": "CPython"
         },
         "environment": {
            "CONDA_DEFAULT_ENV": null,
            "CONDA_PREFIX": null,
            "CONDA_PYTHON_EXE": null,
            "CONDA_EXE": null,
            "CONDA_PROMPT_MODIFIER": null,
            "CONDA_SHLVL": null,
            "PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LD_LIBRARY_PATH": null,
            "DYLD_LIBRARY_PATH": null,
            "USER": null,
            "HOME": "/github/home",
            "SHELL": null
         },
         "arguments": [
            "/usr/local/lib/python3.8/site-packages/ipykernel_launcher.py",
            "-f",
            "/tmp/tmpdsi7xlox.json",
            "--HistoryManager.hist_file=:memory:"
         ],
         "start_time_utc": "2020-12-01T09:29:40.834"
      },
      "input": [],
      "output": [],
      "config": {
         "MyTool": {
            "config_file": null,
            "iterations": 3,
            "log_config": {
               "version": 1,
               "disable_existing_loggers": false,
               "formatters": {
                  "file": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  },
                  "console": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  }
               },
               "handlers": {
                  "ctapipe-console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": 10
                  },
                  "console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": "NOTSET"
                  }
               },
               "loggers": {
                  "ctapipe": {
                     "level": 10,
                     "handlers": [
                        "ctapipe-console"
                     ],
                     "propagate": false
                  }
               }
            },
            "log_datefmt": "%Y-%m-%d %H:%M:%S",
            "log_file": null,
            "log_file_level": "INFO",
            "log_format": "%(asctime)s : %(levelname)s [%(name)s %(funcName)s] %(message)s",
            "log_level": 20,
            "provenance_log": "/github/workspace/docs/examples/mytool.provenance.log",
            "quiet": false,
            "show_config": false,
            "show_config_json": false,
            "MyComponent": {
               "value": -1
            },
            "SecondaryMyComponent": {
               "value": -1
            },
            "TelescopeWiseComponent": {
               "param": [
                  [
                     "type",
                     "*",
                     5.0
                  ]
               ]
            },
            "AdvancedComponent": {
               "infile": "/github/home/.cache/ctapipe/gamma_test.simtel.gz",
               "outfile": null,
               "value1": -1,
               "MyComponent": {
                  "value": -1
               }
            }
         }
      },
      "status": "completed",
      "duration_min": 0.005333333333288337
   },
   {
      "activity_name": "mytool",
      "activity_uuid": "fb567af4-255f-482e-b11c-09c077e4ef4e",
      "start": {
         "time_utc": "2020-12-01T09:29:41.171"
      },
      "stop": {
         "time_utc": "2020-12-01T09:29:41.502"
      },
      "system": {
         "ctapipe_version": "0.1.dev1+gddc003f",
         "ctapipe_resources_version": "not installed",
         "eventio_version": "1.4.2",
         "ctapipe_svc_path": null,
         "executable": "/usr/local/bin/python3",
         "platform": {
            "architecture_bits": "64bit",
            "architecture_linkage": "",
            "machine": "x86_64",
            "processor": "",
            "node": "e54bc70aaa4e",
            "version": "#32~18.04.1-Ubuntu SMP Tue Oct 6 10:03:22 UTC 2020",
            "system": "Linux",
            "release": "5.4.0-1031-azure",
            "libcver": [
               "glibc",
               "2.28"
            ],
            "num_cpus": 2,
            "boot_time": "2020-12-01T09:25:05.000"
         },
         "python": {
            "version_string": "3.8.2 (default, Feb 26 2020, 15:09:34) \n[GCC 8.3.0]",
            "version": [
               "3",
               "8",
               "2"
            ],
            "compiler": "GCC 8.3.0",
            "implementation": "CPython"
         },
         "environment": {
            "CONDA_DEFAULT_ENV": null,
            "CONDA_PREFIX": null,
            "CONDA_PYTHON_EXE": null,
            "CONDA_EXE": null,
            "CONDA_PROMPT_MODIFIER": null,
            "CONDA_SHLVL": null,
            "PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LD_LIBRARY_PATH": null,
            "DYLD_LIBRARY_PATH": null,
            "USER": null,
            "HOME": "/github/home",
            "SHELL": null
         },
         "arguments": [
            "/usr/local/lib/python3.8/site-packages/ipykernel_launcher.py",
            "-f",
            "/tmp/tmpdsi7xlox.json",
            "--HistoryManager.hist_file=:memory:"
         ],
         "start_time_utc": "2020-12-01T09:29:41.179"
      },
      "input": [],
      "output": [],
      "config": {
         "MyTool": {
            "config_file": null,
            "iterations": 3,
            "log_config": {
               "version": 1,
               "disable_existing_loggers": false,
               "formatters": {
                  "file": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  },
                  "console": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  }
               },
               "handlers": {
                  "ctapipe-console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": 10
                  },
                  "console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": "NOTSET"
                  }
               },
               "loggers": {
                  "ctapipe": {
                     "level": 10,
                     "handlers": [
                        "ctapipe-console"
                     ],
                     "propagate": false
                  }
               }
            },
            "log_datefmt": "%Y-%m-%d %H:%M:%S",
            "log_file": null,
            "log_file_level": "INFO",
            "log_format": "%(asctime)s : %(levelname)s [%(name)s %(funcName)s] %(message)s",
            "log_level": 10,
            "provenance_log": "/github/workspace/docs/examples/mytool.provenance.log",
            "quiet": false,
            "show_config": false,
            "show_config_json": false,
            "MyComponent": {
               "value": -1
            },
            "SecondaryMyComponent": {
               "value": -1
            },
            "TelescopeWiseComponent": {
               "param": [
                  [
                     "type",
                     "*",
                     5.0
                  ]
               ]
            },
            "AdvancedComponent": {
               "infile": "/github/home/.cache/ctapipe/gamma_test.simtel.gz",
               "outfile": null,
               "value1": -1,
               "MyComponent": {
                  "value": -1
               }
            }
         }
      },
      "status": "completed",
      "duration_min": 0.005516666666602887
   }
]'
2020-12-01 09:29:41,513 DEBUG [ctapipe.mytool] (application.exit): Exiting application: mytool

you can also set parameters directly in the class, rather than using the argument/configfile parser. This is useful if you are calling the Tool from a script rather than the command-line

[15]:
tool.iterations = 1
tool.log_level = 0

try:
    tool.run(['--infile', str(GAMMA_FILE)])
except SystemExit as e:
    assert e.code == 0, f'Tool returned with error status {e}'
2020-12-01 09:29:41,529 DEBUG [ctapipe.mytool] (application._config_changed): Config changed: {'AdvancedComponent': {'infile': '/github/home/.cache/ctapipe/gamma_test.simtel.gz'}, 'attach_subarray': <LazyConfigValue {}>, 'MyTool': {'log_level': 'DEBUG', 'iterations': 3}}
2020-12-01 09:29:41,534 DEBUG [ctapipe.mytool] (application._config_changed): Config changed: {'AdvancedComponent': {'infile': '/github/home/.cache/ctapipe/gamma_test.simtel.gz'}, 'attach_subarray': <LazyConfigValue {}>, 'MyTool': {'log_level': 'DEBUG', 'iterations': 3}}
2020-12-01 09:29:41,537 INFO [ctapipe.mytool] (tool.initialize): ctapipe version 0.1.dev1+gddc003f
2020-12-01 09:29:41,537 INFO [ctapipe.mytool] (tool.run): Starting: mytool
2020-12-01 09:29:41,548 DEBUG [ctapipe.core.provenance] (provenance.start_activity): started activity: mytool
2020-12-01 09:29:41,551 DEBUG [ctapipe.core.traits] (traits.attach_subarray): argument '*' matched: ['LST_LST_LSTCam', 'MST_MST_NectarCam']
2020-12-01 09:29:41,554 DEBUG [ctapipe.mytool] (tool.run): CONFIG: {'MyTool': {'config_file': None, 'iterations': 3, 'log_config': {'version': 1, 'disable_existing_loggers': False, 'formatters': {'file': {'()': <class 'ctapipe.core.logging.PlainFormatter'>, 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}, 'console': {'()': <class 'ctapipe.core.logging.ColoredFormatter'>, 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}}, 'handlers': {'ctapipe-console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 10}, 'console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 'NOTSET'}}, 'loggers': {'ctapipe': {'level': 10, 'handlers': ['ctapipe-console'], 'propagate': False}}}, 'log_datefmt': '%Y-%m-%d %H:%M:%S', 'log_file': None, 'log_file_level': 'INFO', 'log_format': '%(asctime)s : %(levelname)s [%(name)s %(funcName)s] %(message)s', 'log_level': 10, 'provenance_log': PosixPath('/github/workspace/docs/examples/mytool.provenance.log'), 'quiet': False, 'show_config': False, 'show_config_json': False, 'MyComponent': {'value': -1}, 'SecondaryMyComponent': {'value': -1}, 'TelescopeWiseComponent': {'param': [('type', '*', 5.0)]}, 'AdvancedComponent': {'infile': PosixPath('/github/home/.cache/ctapipe/gamma_test.simtel.gz'), 'outfile': None, 'value1': -1, 'MyComponent': {'value': -1}}}}
2020-12-01 09:29:41,555 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): Performing 3 iterations...
2020-12-01 09:29:41,556 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 0
2020-12-01 09:29:41,557 DEBUG [ctapipe.mytool.MyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:41,559 DEBUG [ctapipe.mytool.SecondaryMyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:41,660 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 1
2020-12-01 09:29:41,661 DEBUG [ctapipe.mytool.MyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:41,664 DEBUG [ctapipe.mytool.SecondaryMyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:41,765 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 2
2020-12-01 09:29:41,766 DEBUG [ctapipe.mytool.MyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:41,766 DEBUG [ctapipe.mytool.SecondaryMyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:41,867 WARNING [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.finish): Shutting down.
2020-12-01 09:29:41,868 INFO [ctapipe.mytool] (tool.run): Finished: mytool
2020-12-01 09:29:41,871 DEBUG [ctapipe.core.provenance] (provenance.finish_activity): finished activity: mytool
2020-12-01 09:29:41,872 INFO [ctapipe.mytool] (tool.write_provenance): Output:
2020-12-01 09:29:41,872 INFO [ctapipe.mytool] (tool.write_provenance): Output:
2020-12-01 09:29:41,873 INFO [ctapipe.mytool] (tool.write_provenance): Output:
2020-12-01 09:29:41,874 INFO [ctapipe.mytool] (tool.write_provenance): Output:
2020-12-01 09:29:41,876 DEBUG [ctapipe.mytool] (tool.write_provenance): PROVENANCE: '[
   {
      "activity_name": "mytool",
      "activity_uuid": "844f88f2-417e-4f3c-8eea-eff158207ac1",
      "start": {
         "time_utc": "2020-12-01T09:29:40.285"
      },
      "stop": {
         "time_utc": "2020-12-01T09:29:40.801"
      },
      "system": {
         "ctapipe_version": "0.1.dev1+gddc003f",
         "ctapipe_resources_version": "not installed",
         "eventio_version": "1.4.2",
         "ctapipe_svc_path": null,
         "executable": "/usr/local/bin/python3",
         "platform": {
            "architecture_bits": "64bit",
            "architecture_linkage": "",
            "machine": "x86_64",
            "processor": "",
            "node": "e54bc70aaa4e",
            "version": "#32~18.04.1-Ubuntu SMP Tue Oct 6 10:03:22 UTC 2020",
            "system": "Linux",
            "release": "5.4.0-1031-azure",
            "libcver": [
               "glibc",
               "2.28"
            ],
            "num_cpus": 2,
            "boot_time": "2020-12-01T09:25:05.000"
         },
         "python": {
            "version_string": "3.8.2 (default, Feb 26 2020, 15:09:34) \n[GCC 8.3.0]",
            "version": [
               "3",
               "8",
               "2"
            ],
            "compiler": "GCC 8.3.0",
            "implementation": "CPython"
         },
         "environment": {
            "CONDA_DEFAULT_ENV": null,
            "CONDA_PREFIX": null,
            "CONDA_PYTHON_EXE": null,
            "CONDA_EXE": null,
            "CONDA_PROMPT_MODIFIER": null,
            "CONDA_SHLVL": null,
            "PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LD_LIBRARY_PATH": null,
            "DYLD_LIBRARY_PATH": null,
            "USER": null,
            "HOME": "/github/home",
            "SHELL": null
         },
         "arguments": [
            "/usr/local/lib/python3.8/site-packages/ipykernel_launcher.py",
            "-f",
            "/tmp/tmpdsi7xlox.json",
            "--HistoryManager.hist_file=:memory:"
         ],
         "start_time_utc": "2020-12-01T09:29:40.293"
      },
      "input": [],
      "output": [],
      "config": {
         "MyTool": {
            "config_file": null,
            "iterations": 5,
            "log_config": {
               "version": 1,
               "disable_existing_loggers": false,
               "formatters": {
                  "file": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  },
                  "console": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  }
               },
               "handlers": {
                  "ctapipe-console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": 10
                  },
                  "console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": "NOTSET"
                  }
               },
               "loggers": {
                  "ctapipe": {
                     "level": 10,
                     "handlers": [
                        "ctapipe-console"
                     ],
                     "propagate": false
                  }
               }
            },
            "log_datefmt": "%Y-%m-%d %H:%M:%S",
            "log_file": null,
            "log_file_level": "INFO",
            "log_format": "[%(name)s]%(highlevel)s %(message)s",
            "log_level": 30,
            "provenance_log": "/github/workspace/docs/examples/mytool.provenance.log",
            "quiet": false,
            "show_config": false,
            "show_config_json": false,
            "MyComponent": {
               "value": -1
            },
            "SecondaryMyComponent": {
               "value": -1
            },
            "TelescopeWiseComponent": {
               "param": [
                  [
                     "type",
                     "*",
                     5.0
                  ]
               ]
            },
            "AdvancedComponent": {
               "infile": "/github/home/.cache/ctapipe/gamma_test.simtel.gz",
               "outfile": null,
               "value1": -1,
               "MyComponent": {
                  "value": -1
               }
            }
         }
      },
      "status": "completed",
      "duration_min": 0.008599999999896468
   },
   {
      "activity_name": "mytool",
      "activity_uuid": "51e487ab-7075-4812-af30-e00bd8a5eefe",
      "start": {
         "time_utc": "2020-12-01T09:29:40.825"
      },
      "stop": {
         "time_utc": "2020-12-01T09:29:41.145"
      },
      "system": {
         "ctapipe_version": "0.1.dev1+gddc003f",
         "ctapipe_resources_version": "not installed",
         "eventio_version": "1.4.2",
         "ctapipe_svc_path": null,
         "executable": "/usr/local/bin/python3",
         "platform": {
            "architecture_bits": "64bit",
            "architecture_linkage": "",
            "machine": "x86_64",
            "processor": "",
            "node": "e54bc70aaa4e",
            "version": "#32~18.04.1-Ubuntu SMP Tue Oct 6 10:03:22 UTC 2020",
            "system": "Linux",
            "release": "5.4.0-1031-azure",
            "libcver": [
               "glibc",
               "2.28"
            ],
            "num_cpus": 2,
            "boot_time": "2020-12-01T09:25:05.000"
         },
         "python": {
            "version_string": "3.8.2 (default, Feb 26 2020, 15:09:34) \n[GCC 8.3.0]",
            "version": [
               "3",
               "8",
               "2"
            ],
            "compiler": "GCC 8.3.0",
            "implementation": "CPython"
         },
         "environment": {
            "CONDA_DEFAULT_ENV": null,
            "CONDA_PREFIX": null,
            "CONDA_PYTHON_EXE": null,
            "CONDA_EXE": null,
            "CONDA_PROMPT_MODIFIER": null,
            "CONDA_SHLVL": null,
            "PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LD_LIBRARY_PATH": null,
            "DYLD_LIBRARY_PATH": null,
            "USER": null,
            "HOME": "/github/home",
            "SHELL": null
         },
         "arguments": [
            "/usr/local/lib/python3.8/site-packages/ipykernel_launcher.py",
            "-f",
            "/tmp/tmpdsi7xlox.json",
            "--HistoryManager.hist_file=:memory:"
         ],
         "start_time_utc": "2020-12-01T09:29:40.834"
      },
      "input": [],
      "output": [],
      "config": {
         "MyTool": {
            "config_file": null,
            "iterations": 3,
            "log_config": {
               "version": 1,
               "disable_existing_loggers": false,
               "formatters": {
                  "file": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  },
                  "console": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  }
               },
               "handlers": {
                  "ctapipe-console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": 10
                  },
                  "console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": "NOTSET"
                  }
               },
               "loggers": {
                  "ctapipe": {
                     "level": 10,
                     "handlers": [
                        "ctapipe-console"
                     ],
                     "propagate": false
                  }
               }
            },
            "log_datefmt": "%Y-%m-%d %H:%M:%S",
            "log_file": null,
            "log_file_level": "INFO",
            "log_format": "%(asctime)s : %(levelname)s [%(name)s %(funcName)s] %(message)s",
            "log_level": 20,
            "provenance_log": "/github/workspace/docs/examples/mytool.provenance.log",
            "quiet": false,
            "show_config": false,
            "show_config_json": false,
            "MyComponent": {
               "value": -1
            },
            "SecondaryMyComponent": {
               "value": -1
            },
            "TelescopeWiseComponent": {
               "param": [
                  [
                     "type",
                     "*",
                     5.0
                  ]
               ]
            },
            "AdvancedComponent": {
               "infile": "/github/home/.cache/ctapipe/gamma_test.simtel.gz",
               "outfile": null,
               "value1": -1,
               "MyComponent": {
                  "value": -1
               }
            }
         }
      },
      "status": "completed",
      "duration_min": 0.005333333333288337
   },
   {
      "activity_name": "mytool",
      "activity_uuid": "fb567af4-255f-482e-b11c-09c077e4ef4e",
      "start": {
         "time_utc": "2020-12-01T09:29:41.171"
      },
      "stop": {
         "time_utc": "2020-12-01T09:29:41.502"
      },
      "system": {
         "ctapipe_version": "0.1.dev1+gddc003f",
         "ctapipe_resources_version": "not installed",
         "eventio_version": "1.4.2",
         "ctapipe_svc_path": null,
         "executable": "/usr/local/bin/python3",
         "platform": {
            "architecture_bits": "64bit",
            "architecture_linkage": "",
            "machine": "x86_64",
            "processor": "",
            "node": "e54bc70aaa4e",
            "version": "#32~18.04.1-Ubuntu SMP Tue Oct 6 10:03:22 UTC 2020",
            "system": "Linux",
            "release": "5.4.0-1031-azure",
            "libcver": [
               "glibc",
               "2.28"
            ],
            "num_cpus": 2,
            "boot_time": "2020-12-01T09:25:05.000"
         },
         "python": {
            "version_string": "3.8.2 (default, Feb 26 2020, 15:09:34) \n[GCC 8.3.0]",
            "version": [
               "3",
               "8",
               "2"
            ],
            "compiler": "GCC 8.3.0",
            "implementation": "CPython"
         },
         "environment": {
            "CONDA_DEFAULT_ENV": null,
            "CONDA_PREFIX": null,
            "CONDA_PYTHON_EXE": null,
            "CONDA_EXE": null,
            "CONDA_PROMPT_MODIFIER": null,
            "CONDA_SHLVL": null,
            "PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LD_LIBRARY_PATH": null,
            "DYLD_LIBRARY_PATH": null,
            "USER": null,
            "HOME": "/github/home",
            "SHELL": null
         },
         "arguments": [
            "/usr/local/lib/python3.8/site-packages/ipykernel_launcher.py",
            "-f",
            "/tmp/tmpdsi7xlox.json",
            "--HistoryManager.hist_file=:memory:"
         ],
         "start_time_utc": "2020-12-01T09:29:41.179"
      },
      "input": [],
      "output": [],
      "config": {
         "MyTool": {
            "config_file": null,
            "iterations": 3,
            "log_config": {
               "version": 1,
               "disable_existing_loggers": false,
               "formatters": {
                  "file": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  },
                  "console": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  }
               },
               "handlers": {
                  "ctapipe-console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": 10
                  },
                  "console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": "NOTSET"
                  }
               },
               "loggers": {
                  "ctapipe": {
                     "level": 10,
                     "handlers": [
                        "ctapipe-console"
                     ],
                     "propagate": false
                  }
               }
            },
            "log_datefmt": "%Y-%m-%d %H:%M:%S",
            "log_file": null,
            "log_file_level": "INFO",
            "log_format": "%(asctime)s : %(levelname)s [%(name)s %(funcName)s] %(message)s",
            "log_level": 10,
            "provenance_log": "/github/workspace/docs/examples/mytool.provenance.log",
            "quiet": false,
            "show_config": false,
            "show_config_json": false,
            "MyComponent": {
               "value": -1
            },
            "SecondaryMyComponent": {
               "value": -1
            },
            "TelescopeWiseComponent": {
               "param": [
                  [
                     "type",
                     "*",
                     5.0
                  ]
               ]
            },
            "AdvancedComponent": {
               "infile": "/github/home/.cache/ctapipe/gamma_test.simtel.gz",
               "outfile": null,
               "value1": -1,
               "MyComponent": {
                  "value": -1
               }
            }
         }
      },
      "status": "completed",
      "duration_min": 0.005516666666602887
   },
   {
      "activity_name": "mytool",
      "activity_uuid": "43bee70b-4a4a-4191-956b-fb3960099e82",
      "start": {
         "time_utc": "2020-12-01T09:29:41.539"
      },
      "stop": {
         "time_utc": "2020-12-01T09:29:41.869"
      },
      "system": {
         "ctapipe_version": "0.1.dev1+gddc003f",
         "ctapipe_resources_version": "not installed",
         "eventio_version": "1.4.2",
         "ctapipe_svc_path": null,
         "executable": "/usr/local/bin/python3",
         "platform": {
            "architecture_bits": "64bit",
            "architecture_linkage": "",
            "machine": "x86_64",
            "processor": "",
            "node": "e54bc70aaa4e",
            "version": "#32~18.04.1-Ubuntu SMP Tue Oct 6 10:03:22 UTC 2020",
            "system": "Linux",
            "release": "5.4.0-1031-azure",
            "libcver": [
               "glibc",
               "2.28"
            ],
            "num_cpus": 2,
            "boot_time": "2020-12-01T09:25:05.000"
         },
         "python": {
            "version_string": "3.8.2 (default, Feb 26 2020, 15:09:34) \n[GCC 8.3.0]",
            "version": [
               "3",
               "8",
               "2"
            ],
            "compiler": "GCC 8.3.0",
            "implementation": "CPython"
         },
         "environment": {
            "CONDA_DEFAULT_ENV": null,
            "CONDA_PREFIX": null,
            "CONDA_PYTHON_EXE": null,
            "CONDA_EXE": null,
            "CONDA_PROMPT_MODIFIER": null,
            "CONDA_SHLVL": null,
            "PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LD_LIBRARY_PATH": null,
            "DYLD_LIBRARY_PATH": null,
            "USER": null,
            "HOME": "/github/home",
            "SHELL": null
         },
         "arguments": [
            "/usr/local/lib/python3.8/site-packages/ipykernel_launcher.py",
            "-f",
            "/tmp/tmpdsi7xlox.json",
            "--HistoryManager.hist_file=:memory:"
         ],
         "start_time_utc": "2020-12-01T09:29:41.548"
      },
      "input": [],
      "output": [],
      "config": {
         "MyTool": {
            "config_file": null,
            "iterations": 3,
            "log_config": {
               "version": 1,
               "disable_existing_loggers": false,
               "formatters": {
                  "file": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  },
                  "console": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  }
               },
               "handlers": {
                  "ctapipe-console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": 10
                  },
                  "console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": "NOTSET"
                  }
               },
               "loggers": {
                  "ctapipe": {
                     "level": 10,
                     "handlers": [
                        "ctapipe-console"
                     ],
                     "propagate": false
                  }
               }
            },
            "log_datefmt": "%Y-%m-%d %H:%M:%S",
            "log_file": null,
            "log_file_level": "INFO",
            "log_format": "%(asctime)s : %(levelname)s [%(name)s %(funcName)s] %(message)s",
            "log_level": 10,
            "provenance_log": "/github/workspace/docs/examples/mytool.provenance.log",
            "quiet": false,
            "show_config": false,
            "show_config_json": false,
            "MyComponent": {
               "value": -1
            },
            "SecondaryMyComponent": {
               "value": -1
            },
            "TelescopeWiseComponent": {
               "param": [
                  [
                     "type",
                     "*",
                     5.0
                  ]
               ]
            },
            "AdvancedComponent": {
               "infile": "/github/home/.cache/ctapipe/gamma_test.simtel.gz",
               "outfile": null,
               "value1": -1,
               "MyComponent": {
                  "value": -1
               }
            }
         }
      },
      "status": "completed",
      "duration_min": 0.005500000000076
   }
]'
2020-12-01 09:29:41,883 DEBUG [ctapipe.mytool] (application.exit): Exiting application: mytool

see what happens when a value is set that is not of the correct type:

[16]:
try:
    tool.iterations = "badval"
except TraitError as E:
    print("bad value:",E)
except SystemExit as e:
    assert e.code == 0, f'Tool returned with error status {e}'
bad value: The 'iterations' trait of a MyTool instance expected an int, not the str 'badval'.

Example of what happens when you change a parameter that is being “observed” in a class. It’s handler is called:

[17]:
tool.advanced.outfile = "Another.txt"
2020-12-01 09:29:41,902 WARNING [ctapipe.mytool.AdvancedComponent] (<ipython-input-1-a087b1827cdf>.on_outfile_changed): Outfile was changed to '{'name': 'outfile', 'old': None, 'new': PosixPath('/github/workspace/docs/examples/Another.txt'), 'owner': <__main__.AdvancedComponent object at 0x7f6b1bf54790>, 'type': 'change'}'

we see that the handler for outfile was called, and it receive a change dict that shows the old and new values.

create a tool using a config file:

[18]:
tool2 = MyTool()
[19]:
try:
    tool2.run(argv=['--config', 'Tools.json'])
except SystemExit as e:
    assert e.code == 0, f'Tool returned with error status {e}'
2020-12-01 09:29:41,928 INFO [ctapipe.mytool] (tool.initialize): ctapipe version 0.1.dev1+gddc003f
2020-12-01 09:29:41,929 INFO [ctapipe.mytool] (tool.run): Starting: mytool
2020-12-01 09:29:41,939 DEBUG [ctapipe.core.provenance] (provenance.start_activity): started activity: mytool
2020-12-01 09:29:41,942 DEBUG [ctapipe.core.traits] (traits.attach_subarray): argument '*' matched: ['LST_LST_LSTCam', 'MST_MST_NectarCam']
2020-12-01 09:29:41,945 DEBUG [ctapipe.mytool] (tool.run): CONFIG: {'MyTool': {'config_file': PosixPath('/github/workspace/docs/examples/Tools.json'), 'iterations': 5, 'log_config': {'version': 1, 'disable_existing_loggers': False, 'formatters': {'file': {'()': <class 'ctapipe.core.logging.PlainFormatter'>, 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}, 'console': {'()': <class 'ctapipe.core.logging.ColoredFormatter'>, 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}}, 'handlers': {'ctapipe-console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 10}, 'console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 'NOTSET'}}, 'loggers': {'ctapipe': {'level': 10, 'handlers': ['ctapipe-console'], 'propagate': False}}}, 'log_datefmt': '%Y-%m-%d %H:%M:%S', 'log_file': None, 'log_file_level': 'INFO', 'log_format': '[%(name)s]%(highlevel)s %(message)s', 'log_level': 10, 'provenance_log': PosixPath('/github/workspace/docs/examples/mytool.provenance.log'), 'quiet': False, 'show_config': False, 'show_config_json': False, 'MyComponent': {'value': -1}, 'SecondaryMyComponent': {'value': -1}, 'TelescopeWiseComponent': {'param': [('type', '*', 5.0)]}, 'AdvancedComponent': {'infile': PosixPath('/github/workspace/docs/examples/something.txt'), 'outfile': None, 'value1': -1, 'MyComponent': {'value': -1}}}}
2020-12-01 09:29:41,947 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): Performing 5 iterations...
2020-12-01 09:29:41,948 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 0
2020-12-01 09:29:41,949 DEBUG [ctapipe.mytool.MyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:41,950 DEBUG [ctapipe.mytool.SecondaryMyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:42,053 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 1
2020-12-01 09:29:42,053 DEBUG [ctapipe.mytool.MyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:42,056 DEBUG [ctapipe.mytool.SecondaryMyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:42,157 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 2
2020-12-01 09:29:42,159 DEBUG [ctapipe.mytool.MyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:42,161 DEBUG [ctapipe.mytool.SecondaryMyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:42,262 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 3
2020-12-01 09:29:42,263 DEBUG [ctapipe.mytool.MyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:42,264 DEBUG [ctapipe.mytool.SecondaryMyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:42,366 INFO [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.start): ITERATION 4
2020-12-01 09:29:42,367 DEBUG [ctapipe.mytool.MyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:42,368 DEBUG [ctapipe.mytool.SecondaryMyComponent] (<ipython-input-1-a087b1827cdf>.do_thing): Did thing
2020-12-01 09:29:42,469 WARNING [ctapipe.mytool] (<ipython-input-1-d7fc398e7046>.finish): Shutting down.
2020-12-01 09:29:42,470 INFO [ctapipe.mytool] (tool.run): Finished: mytool
2020-12-01 09:29:42,473 DEBUG [ctapipe.core.provenance] (provenance.finish_activity): finished activity: mytool
2020-12-01 09:29:42,474 INFO [ctapipe.mytool] (tool.write_provenance): Output:
2020-12-01 09:29:42,477 INFO [ctapipe.mytool] (tool.write_provenance): Output:
2020-12-01 09:29:42,478 INFO [ctapipe.mytool] (tool.write_provenance): Output:
2020-12-01 09:29:42,481 INFO [ctapipe.mytool] (tool.write_provenance): Output:
2020-12-01 09:29:42,482 INFO [ctapipe.mytool] (tool.write_provenance): Output:
2020-12-01 09:29:42,485 DEBUG [ctapipe.mytool] (tool.write_provenance): PROVENANCE: '[
   {
      "activity_name": "mytool",
      "activity_uuid": "844f88f2-417e-4f3c-8eea-eff158207ac1",
      "start": {
         "time_utc": "2020-12-01T09:29:40.285"
      },
      "stop": {
         "time_utc": "2020-12-01T09:29:40.801"
      },
      "system": {
         "ctapipe_version": "0.1.dev1+gddc003f",
         "ctapipe_resources_version": "not installed",
         "eventio_version": "1.4.2",
         "ctapipe_svc_path": null,
         "executable": "/usr/local/bin/python3",
         "platform": {
            "architecture_bits": "64bit",
            "architecture_linkage": "",
            "machine": "x86_64",
            "processor": "",
            "node": "e54bc70aaa4e",
            "version": "#32~18.04.1-Ubuntu SMP Tue Oct 6 10:03:22 UTC 2020",
            "system": "Linux",
            "release": "5.4.0-1031-azure",
            "libcver": [
               "glibc",
               "2.28"
            ],
            "num_cpus": 2,
            "boot_time": "2020-12-01T09:25:05.000"
         },
         "python": {
            "version_string": "3.8.2 (default, Feb 26 2020, 15:09:34) \n[GCC 8.3.0]",
            "version": [
               "3",
               "8",
               "2"
            ],
            "compiler": "GCC 8.3.0",
            "implementation": "CPython"
         },
         "environment": {
            "CONDA_DEFAULT_ENV": null,
            "CONDA_PREFIX": null,
            "CONDA_PYTHON_EXE": null,
            "CONDA_EXE": null,
            "CONDA_PROMPT_MODIFIER": null,
            "CONDA_SHLVL": null,
            "PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LD_LIBRARY_PATH": null,
            "DYLD_LIBRARY_PATH": null,
            "USER": null,
            "HOME": "/github/home",
            "SHELL": null
         },
         "arguments": [
            "/usr/local/lib/python3.8/site-packages/ipykernel_launcher.py",
            "-f",
            "/tmp/tmpdsi7xlox.json",
            "--HistoryManager.hist_file=:memory:"
         ],
         "start_time_utc": "2020-12-01T09:29:40.293"
      },
      "input": [],
      "output": [],
      "config": {
         "MyTool": {
            "config_file": null,
            "iterations": 5,
            "log_config": {
               "version": 1,
               "disable_existing_loggers": false,
               "formatters": {
                  "file": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  },
                  "console": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  }
               },
               "handlers": {
                  "ctapipe-console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": 10
                  },
                  "console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": "NOTSET"
                  }
               },
               "loggers": {
                  "ctapipe": {
                     "level": 10,
                     "handlers": [
                        "ctapipe-console"
                     ],
                     "propagate": false
                  }
               }
            },
            "log_datefmt": "%Y-%m-%d %H:%M:%S",
            "log_file": null,
            "log_file_level": "INFO",
            "log_format": "[%(name)s]%(highlevel)s %(message)s",
            "log_level": 30,
            "provenance_log": "/github/workspace/docs/examples/mytool.provenance.log",
            "quiet": false,
            "show_config": false,
            "show_config_json": false,
            "MyComponent": {
               "value": -1
            },
            "SecondaryMyComponent": {
               "value": -1
            },
            "TelescopeWiseComponent": {
               "param": [
                  [
                     "type",
                     "*",
                     5.0
                  ]
               ]
            },
            "AdvancedComponent": {
               "infile": "/github/home/.cache/ctapipe/gamma_test.simtel.gz",
               "outfile": null,
               "value1": -1,
               "MyComponent": {
                  "value": -1
               }
            }
         }
      },
      "status": "completed",
      "duration_min": 0.008599999999896468
   },
   {
      "activity_name": "mytool",
      "activity_uuid": "51e487ab-7075-4812-af30-e00bd8a5eefe",
      "start": {
         "time_utc": "2020-12-01T09:29:40.825"
      },
      "stop": {
         "time_utc": "2020-12-01T09:29:41.145"
      },
      "system": {
         "ctapipe_version": "0.1.dev1+gddc003f",
         "ctapipe_resources_version": "not installed",
         "eventio_version": "1.4.2",
         "ctapipe_svc_path": null,
         "executable": "/usr/local/bin/python3",
         "platform": {
            "architecture_bits": "64bit",
            "architecture_linkage": "",
            "machine": "x86_64",
            "processor": "",
            "node": "e54bc70aaa4e",
            "version": "#32~18.04.1-Ubuntu SMP Tue Oct 6 10:03:22 UTC 2020",
            "system": "Linux",
            "release": "5.4.0-1031-azure",
            "libcver": [
               "glibc",
               "2.28"
            ],
            "num_cpus": 2,
            "boot_time": "2020-12-01T09:25:05.000"
         },
         "python": {
            "version_string": "3.8.2 (default, Feb 26 2020, 15:09:34) \n[GCC 8.3.0]",
            "version": [
               "3",
               "8",
               "2"
            ],
            "compiler": "GCC 8.3.0",
            "implementation": "CPython"
         },
         "environment": {
            "CONDA_DEFAULT_ENV": null,
            "CONDA_PREFIX": null,
            "CONDA_PYTHON_EXE": null,
            "CONDA_EXE": null,
            "CONDA_PROMPT_MODIFIER": null,
            "CONDA_SHLVL": null,
            "PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LD_LIBRARY_PATH": null,
            "DYLD_LIBRARY_PATH": null,
            "USER": null,
            "HOME": "/github/home",
            "SHELL": null
         },
         "arguments": [
            "/usr/local/lib/python3.8/site-packages/ipykernel_launcher.py",
            "-f",
            "/tmp/tmpdsi7xlox.json",
            "--HistoryManager.hist_file=:memory:"
         ],
         "start_time_utc": "2020-12-01T09:29:40.834"
      },
      "input": [],
      "output": [],
      "config": {
         "MyTool": {
            "config_file": null,
            "iterations": 3,
            "log_config": {
               "version": 1,
               "disable_existing_loggers": false,
               "formatters": {
                  "file": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  },
                  "console": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  }
               },
               "handlers": {
                  "ctapipe-console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": 10
                  },
                  "console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": "NOTSET"
                  }
               },
               "loggers": {
                  "ctapipe": {
                     "level": 10,
                     "handlers": [
                        "ctapipe-console"
                     ],
                     "propagate": false
                  }
               }
            },
            "log_datefmt": "%Y-%m-%d %H:%M:%S",
            "log_file": null,
            "log_file_level": "INFO",
            "log_format": "%(asctime)s : %(levelname)s [%(name)s %(funcName)s] %(message)s",
            "log_level": 20,
            "provenance_log": "/github/workspace/docs/examples/mytool.provenance.log",
            "quiet": false,
            "show_config": false,
            "show_config_json": false,
            "MyComponent": {
               "value": -1
            },
            "SecondaryMyComponent": {
               "value": -1
            },
            "TelescopeWiseComponent": {
               "param": [
                  [
                     "type",
                     "*",
                     5.0
                  ]
               ]
            },
            "AdvancedComponent": {
               "infile": "/github/home/.cache/ctapipe/gamma_test.simtel.gz",
               "outfile": null,
               "value1": -1,
               "MyComponent": {
                  "value": -1
               }
            }
         }
      },
      "status": "completed",
      "duration_min": 0.005333333333288337
   },
   {
      "activity_name": "mytool",
      "activity_uuid": "fb567af4-255f-482e-b11c-09c077e4ef4e",
      "start": {
         "time_utc": "2020-12-01T09:29:41.171"
      },
      "stop": {
         "time_utc": "2020-12-01T09:29:41.502"
      },
      "system": {
         "ctapipe_version": "0.1.dev1+gddc003f",
         "ctapipe_resources_version": "not installed",
         "eventio_version": "1.4.2",
         "ctapipe_svc_path": null,
         "executable": "/usr/local/bin/python3",
         "platform": {
            "architecture_bits": "64bit",
            "architecture_linkage": "",
            "machine": "x86_64",
            "processor": "",
            "node": "e54bc70aaa4e",
            "version": "#32~18.04.1-Ubuntu SMP Tue Oct 6 10:03:22 UTC 2020",
            "system": "Linux",
            "release": "5.4.0-1031-azure",
            "libcver": [
               "glibc",
               "2.28"
            ],
            "num_cpus": 2,
            "boot_time": "2020-12-01T09:25:05.000"
         },
         "python": {
            "version_string": "3.8.2 (default, Feb 26 2020, 15:09:34) \n[GCC 8.3.0]",
            "version": [
               "3",
               "8",
               "2"
            ],
            "compiler": "GCC 8.3.0",
            "implementation": "CPython"
         },
         "environment": {
            "CONDA_DEFAULT_ENV": null,
            "CONDA_PREFIX": null,
            "CONDA_PYTHON_EXE": null,
            "CONDA_EXE": null,
            "CONDA_PROMPT_MODIFIER": null,
            "CONDA_SHLVL": null,
            "PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LD_LIBRARY_PATH": null,
            "DYLD_LIBRARY_PATH": null,
            "USER": null,
            "HOME": "/github/home",
            "SHELL": null
         },
         "arguments": [
            "/usr/local/lib/python3.8/site-packages/ipykernel_launcher.py",
            "-f",
            "/tmp/tmpdsi7xlox.json",
            "--HistoryManager.hist_file=:memory:"
         ],
         "start_time_utc": "2020-12-01T09:29:41.179"
      },
      "input": [],
      "output": [],
      "config": {
         "MyTool": {
            "config_file": null,
            "iterations": 3,
            "log_config": {
               "version": 1,
               "disable_existing_loggers": false,
               "formatters": {
                  "file": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  },
                  "console": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  }
               },
               "handlers": {
                  "ctapipe-console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": 10
                  },
                  "console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": "NOTSET"
                  }
               },
               "loggers": {
                  "ctapipe": {
                     "level": 10,
                     "handlers": [
                        "ctapipe-console"
                     ],
                     "propagate": false
                  }
               }
            },
            "log_datefmt": "%Y-%m-%d %H:%M:%S",
            "log_file": null,
            "log_file_level": "INFO",
            "log_format": "%(asctime)s : %(levelname)s [%(name)s %(funcName)s] %(message)s",
            "log_level": 10,
            "provenance_log": "/github/workspace/docs/examples/mytool.provenance.log",
            "quiet": false,
            "show_config": false,
            "show_config_json": false,
            "MyComponent": {
               "value": -1
            },
            "SecondaryMyComponent": {
               "value": -1
            },
            "TelescopeWiseComponent": {
               "param": [
                  [
                     "type",
                     "*",
                     5.0
                  ]
               ]
            },
            "AdvancedComponent": {
               "infile": "/github/home/.cache/ctapipe/gamma_test.simtel.gz",
               "outfile": null,
               "value1": -1,
               "MyComponent": {
                  "value": -1
               }
            }
         }
      },
      "status": "completed",
      "duration_min": 0.005516666666602887
   },
   {
      "activity_name": "mytool",
      "activity_uuid": "43bee70b-4a4a-4191-956b-fb3960099e82",
      "start": {
         "time_utc": "2020-12-01T09:29:41.539"
      },
      "stop": {
         "time_utc": "2020-12-01T09:29:41.869"
      },
      "system": {
         "ctapipe_version": "0.1.dev1+gddc003f",
         "ctapipe_resources_version": "not installed",
         "eventio_version": "1.4.2",
         "ctapipe_svc_path": null,
         "executable": "/usr/local/bin/python3",
         "platform": {
            "architecture_bits": "64bit",
            "architecture_linkage": "",
            "machine": "x86_64",
            "processor": "",
            "node": "e54bc70aaa4e",
            "version": "#32~18.04.1-Ubuntu SMP Tue Oct 6 10:03:22 UTC 2020",
            "system": "Linux",
            "release": "5.4.0-1031-azure",
            "libcver": [
               "glibc",
               "2.28"
            ],
            "num_cpus": 2,
            "boot_time": "2020-12-01T09:25:05.000"
         },
         "python": {
            "version_string": "3.8.2 (default, Feb 26 2020, 15:09:34) \n[GCC 8.3.0]",
            "version": [
               "3",
               "8",
               "2"
            ],
            "compiler": "GCC 8.3.0",
            "implementation": "CPython"
         },
         "environment": {
            "CONDA_DEFAULT_ENV": null,
            "CONDA_PREFIX": null,
            "CONDA_PYTHON_EXE": null,
            "CONDA_EXE": null,
            "CONDA_PROMPT_MODIFIER": null,
            "CONDA_SHLVL": null,
            "PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LD_LIBRARY_PATH": null,
            "DYLD_LIBRARY_PATH": null,
            "USER": null,
            "HOME": "/github/home",
            "SHELL": null
         },
         "arguments": [
            "/usr/local/lib/python3.8/site-packages/ipykernel_launcher.py",
            "-f",
            "/tmp/tmpdsi7xlox.json",
            "--HistoryManager.hist_file=:memory:"
         ],
         "start_time_utc": "2020-12-01T09:29:41.548"
      },
      "input": [],
      "output": [],
      "config": {
         "MyTool": {
            "config_file": null,
            "iterations": 3,
            "log_config": {
               "version": 1,
               "disable_existing_loggers": false,
               "formatters": {
                  "file": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  },
                  "console": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  }
               },
               "handlers": {
                  "ctapipe-console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": 10
                  },
                  "console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": "NOTSET"
                  }
               },
               "loggers": {
                  "ctapipe": {
                     "level": 10,
                     "handlers": [
                        "ctapipe-console"
                     ],
                     "propagate": false
                  }
               }
            },
            "log_datefmt": "%Y-%m-%d %H:%M:%S",
            "log_file": null,
            "log_file_level": "INFO",
            "log_format": "%(asctime)s : %(levelname)s [%(name)s %(funcName)s] %(message)s",
            "log_level": 10,
            "provenance_log": "/github/workspace/docs/examples/mytool.provenance.log",
            "quiet": false,
            "show_config": false,
            "show_config_json": false,
            "MyComponent": {
               "value": -1
            },
            "SecondaryMyComponent": {
               "value": -1
            },
            "TelescopeWiseComponent": {
               "param": [
                  [
                     "type",
                     "*",
                     5.0
                  ]
               ]
            },
            "AdvancedComponent": {
               "infile": "/github/home/.cache/ctapipe/gamma_test.simtel.gz",
               "outfile": null,
               "value1": -1,
               "MyComponent": {
                  "value": -1
               }
            }
         }
      },
      "status": "completed",
      "duration_min": 0.005500000000076
   },
   {
      "activity_name": "mytool",
      "activity_uuid": "16894117-6be5-4ad6-b15f-36bce493d2ba",
      "start": {
         "time_utc": "2020-12-01T09:29:41.930"
      },
      "stop": {
         "time_utc": "2020-12-01T09:29:42.471"
      },
      "system": {
         "ctapipe_version": "0.1.dev1+gddc003f",
         "ctapipe_resources_version": "not installed",
         "eventio_version": "1.4.2",
         "ctapipe_svc_path": null,
         "executable": "/usr/local/bin/python3",
         "platform": {
            "architecture_bits": "64bit",
            "architecture_linkage": "",
            "machine": "x86_64",
            "processor": "",
            "node": "e54bc70aaa4e",
            "version": "#32~18.04.1-Ubuntu SMP Tue Oct 6 10:03:22 UTC 2020",
            "system": "Linux",
            "release": "5.4.0-1031-azure",
            "libcver": [
               "glibc",
               "2.28"
            ],
            "num_cpus": 2,
            "boot_time": "2020-12-01T09:25:05.000"
         },
         "python": {
            "version_string": "3.8.2 (default, Feb 26 2020, 15:09:34) \n[GCC 8.3.0]",
            "version": [
               "3",
               "8",
               "2"
            ],
            "compiler": "GCC 8.3.0",
            "implementation": "CPython"
         },
         "environment": {
            "CONDA_DEFAULT_ENV": null,
            "CONDA_PREFIX": null,
            "CONDA_PYTHON_EXE": null,
            "CONDA_EXE": null,
            "CONDA_PROMPT_MODIFIER": null,
            "CONDA_SHLVL": null,
            "PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LD_LIBRARY_PATH": null,
            "DYLD_LIBRARY_PATH": null,
            "USER": null,
            "HOME": "/github/home",
            "SHELL": null
         },
         "arguments": [
            "/usr/local/lib/python3.8/site-packages/ipykernel_launcher.py",
            "-f",
            "/tmp/tmpdsi7xlox.json",
            "--HistoryManager.hist_file=:memory:"
         ],
         "start_time_utc": "2020-12-01T09:29:41.939"
      },
      "input": [],
      "output": [],
      "config": {
         "MyTool": {
            "config_file": "/github/workspace/docs/examples/Tools.json",
            "iterations": 5,
            "log_config": {
               "version": 1,
               "disable_existing_loggers": false,
               "formatters": {
                  "file": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  },
                  "console": {
                     "()": null,
                     "fmt": "%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s"
                  }
               },
               "handlers": {
                  "ctapipe-console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": 10
                  },
                  "console": {
                     "class": "logging.StreamHandler",
                     "formatter": "console",
                     "stream": "ext://sys.stderr",
                     "level": "NOTSET"
                  }
               },
               "loggers": {
                  "ctapipe": {
                     "level": 10,
                     "handlers": [
                        "ctapipe-console"
                     ],
                     "propagate": false
                  }
               }
            },
            "log_datefmt": "%Y-%m-%d %H:%M:%S",
            "log_file": null,
            "log_file_level": "INFO",
            "log_format": "[%(name)s]%(highlevel)s %(message)s",
            "log_level": 10,
            "provenance_log": "/github/workspace/docs/examples/mytool.provenance.log",
            "quiet": false,
            "show_config": false,
            "show_config_json": false,
            "MyComponent": {
               "value": -1
            },
            "SecondaryMyComponent": {
               "value": -1
            },
            "TelescopeWiseComponent": {
               "param": [
                  [
                     "type",
                     "*",
                     5.0
                  ]
               ]
            },
            "AdvancedComponent": {
               "infile": "/github/workspace/docs/examples/something.txt",
               "outfile": null,
               "value1": -1,
               "MyComponent": {
                  "value": -1
               }
            }
         }
      },
      "status": "completed",
      "duration_min": 0.009016666666585849
   }
]'
2020-12-01 09:29:42,490 DEBUG [ctapipe.mytool] (application.exit): Exiting application: mytool
[20]:
print(tool2.advanced.infile)
/github/workspace/docs/examples/something.txt
[21]:
print(tool2.config)
{'MyTool': {'config_file': 'Tools.json', 'log_level': 'DEBUG'}, 'AdvancedComponent': {'infile': 'something.txt'}, 'attach_subarray': <LazyConfigValue {}>}
[22]:
tool2.is_setup
[22]:
True
[23]:
tool3 = MyTool()
[24]:
tool3.is_setup
[24]:
False
[25]:
tool3.initialize(argv=[])
[26]:
tool3.is_setup
[26]:
False
[27]:
tool3
[27]:
MyTool

do some things and stuff

config_file None name of a configuration file with parameters to load in addition to command-line parameters (default: None)
iterations 5 Number of times to run (default: 5)
log_config {'version': 1, 'disable_existing_loggers': False, 'formatters': {'file': {'()': , 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}, 'console': {'()': , 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}}, 'handlers': {'ctapipe-console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 30}, 'console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 'NOTSET'}}, 'loggers': {'ctapipe': {'level': 30, 'handlers': ['ctapipe-console'], 'propagate': False}}} (default: traitlets.Undefined)
log_datefmt %Y-%m-%d %H:%M:%S The date format used by logging formatters for %(asctime)s (default: %Y-%m-%d %H:%M:%S)
log_file None Filename for the log (default: None)
log_file_level INFO Logging Level for File Logging (default: INFO)
log_format [%(name)s]%(highlevel)s %(message)s The Logging format template (default: [%(name)s]%(highlevel)s %(message)s)
log_level 30 Set the log level by value or name. (default: 30)
provenance_log /github/workspace/docs/examples/mytool.provenance.log (default: None)
quiet False (default: False)
show_config False Instead of starting the Application, dump configuration to stdout (default: False)
show_config_json False Instead of starting the Application, dump configuration to stdout (as JSON) (default: False)

Components: MyTool, MyComponent, AdvancedComponent, SecondaryMyComponent, TelescopeWiseComponent

[28]:
tool
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/usr/local/lib/python3.8/site-packages/IPython/core/formatters.py in __call__(self, obj)
    343             method = get_real_method(obj, self.print_method)
    344             if method is not None:
--> 345                 return method()
    346             return None
    347         else:

/github/workspace/ctapipe/core/tool.py in _repr_html_(self)
    320         ]
    321         for key, val in self.get_current_config()[name].items():
--> 322             default = traits[key].default_value
    323             thehelp = f"{traits[key].help} (default: {default})"
    324             lines.append(f"<tr><th>{key}</th>")

KeyError: 'MyComponent'
[28]:
<__main__.MyTool at 0x7f6b1bf7a3d0>
[29]:
tool.comp2
[29]:
SecondaryMyComponent

Undocumented!

value -1 Value to use (default: -1)

Getting the configuration of an instance

[30]:
tool.get_current_config()
[30]:
{'MyTool': {'config_file': None,
  'iterations': 3,
  'log_config': {'version': 1,
   'disable_existing_loggers': False,
   'formatters': {'file': {'()': ctapipe.core.logging.PlainFormatter,
     'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'},
    'console': {'()': ctapipe.core.logging.ColoredFormatter,
     'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}},
   'handlers': {'ctapipe-console': {'class': 'logging.StreamHandler',
     'formatter': 'console',
     'stream': 'ext://sys.stderr',
     'level': 30},
    'console': {'class': 'logging.StreamHandler',
     'formatter': 'console',
     'stream': 'ext://sys.stderr',
     'level': 'NOTSET'}},
   'loggers': {'ctapipe': {'level': 30,
     'handlers': ['ctapipe-console'],
     'propagate': False}}},
  'log_datefmt': '%Y-%m-%d %H:%M:%S',
  'log_file': None,
  'log_file_level': 'INFO',
  'log_format': '%(asctime)s : %(levelname)s [%(name)s %(funcName)s] %(message)s',
  'log_level': 10,
  'provenance_log': PosixPath('/github/workspace/docs/examples/mytool.provenance.log'),
  'quiet': False,
  'show_config': False,
  'show_config_json': False,
  'MyComponent': {'value': -1},
  'SecondaryMyComponent': {'value': -1},
  'TelescopeWiseComponent': {'param': [('type', '*', 5.0)]},
  'AdvancedComponent': {'infile': PosixPath('/github/home/.cache/ctapipe/gamma_test.simtel.gz'),
   'outfile': PosixPath('/github/workspace/docs/examples/Another.txt'),
   'value1': -1,
   'MyComponent': {'value': -1}}}}
[31]:
tool.iterations = 12
tool.get_current_config()
[31]:
{'MyTool': {'config_file': None,
  'iterations': 12,
  'log_config': {'version': 1,
   'disable_existing_loggers': False,
   'formatters': {'file': {'()': ctapipe.core.logging.PlainFormatter,
     'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'},
    'console': {'()': ctapipe.core.logging.ColoredFormatter,
     'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}},
   'handlers': {'ctapipe-console': {'class': 'logging.StreamHandler',
     'formatter': 'console',
     'stream': 'ext://sys.stderr',
     'level': 30},
    'console': {'class': 'logging.StreamHandler',
     'formatter': 'console',
     'stream': 'ext://sys.stderr',
     'level': 'NOTSET'}},
   'loggers': {'ctapipe': {'level': 30,
     'handlers': ['ctapipe-console'],
     'propagate': False}}},
  'log_datefmt': '%Y-%m-%d %H:%M:%S',
  'log_file': None,
  'log_file_level': 'INFO',
  'log_format': '%(asctime)s : %(levelname)s [%(name)s %(funcName)s] %(message)s',
  'log_level': 10,
  'provenance_log': PosixPath('/github/workspace/docs/examples/mytool.provenance.log'),
  'quiet': False,
  'show_config': False,
  'show_config_json': False,
  'MyComponent': {'value': -1},
  'SecondaryMyComponent': {'value': -1},
  'TelescopeWiseComponent': {'param': [('type', '*', 5.0)]},
  'AdvancedComponent': {'infile': PosixPath('/github/home/.cache/ctapipe/gamma_test.simtel.gz'),
   'outfile': PosixPath('/github/workspace/docs/examples/Another.txt'),
   'value1': -1,
   'MyComponent': {'value': -1}}}}

Writing a Sample Config File

[32]:
print(tool.generate_config_file())
# Configuration file for mytool.

#------------------------------------------------------------------------------
# Application(SingletonConfigurable) configuration
#------------------------------------------------------------------------------
## This is an application.

## The date format used by logging formatters for %(asctime)s
#  Default: '%Y-%m-%d %H:%M:%S'
# c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S'

## The Logging format template
#  Default: '[%(name)s]%(highlevel)s %(message)s'
# c.Application.log_format = '[%(name)s]%(highlevel)s %(message)s'

## Set the log level by value or name.
#  Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']
#  Default: 30
# c.Application.log_level = 30

## Instead of starting the Application, dump configuration to stdout
#  Default: False
# c.Application.show_config = False

## Instead of starting the Application, dump configuration to stdout (as JSON)
#  Default: False
# c.Application.show_config_json = False

#------------------------------------------------------------------------------
# Tool(Application) configuration
#------------------------------------------------------------------------------
## This is an application.

## name of a configuration file with parameters to load in addition to command-
#  line parameters
#  Default: None
# c.Tool.config_file = None

#  Default: {'version': 1, 'disable_existing_loggers': False, 'formatters': {'file': {'()': <class 'ctapipe.core.logging.PlainFormatter'>, 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}, 'console': {'()': <class 'ctapipe.core.logging.ColoredFormatter'>, 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}}, 'handlers': {'ctapipe-console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 30}, 'console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 'NOTSET'}}, 'loggers': {'ctapipe': {'level': 30, 'handlers': ['ctapipe-console'], 'propagate': False}}}
# c.Tool.log_config = {'version': 1, 'disable_existing_loggers': False, 'formatters': {'file': {'()': <class 'ctapipe.core.logging.PlainFormatter'>, 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}, 'console': {'()': <class 'ctapipe.core.logging.ColoredFormatter'>, 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}}, 'handlers': {'ctapipe-console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 30}, 'console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 'NOTSET'}}, 'loggers': {'ctapipe': {'level': 30, 'handlers': ['ctapipe-console'], 'propagate': False}}}

## The date format used by logging formatters for %(asctime)s
#  See also: Application.log_datefmt
# c.Tool.log_datefmt = '%Y-%m-%d %H:%M:%S'

## Filename for the log
#  Default: None
# c.Tool.log_file = None

## Logging Level for File Logging
#  Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']
#  Default: 'INFO'
# c.Tool.log_file_level = 'INFO'

## The Logging format template
#  See also: Application.log_format
# c.Tool.log_format = '[%(name)s]%(highlevel)s %(message)s'

## Set the log level by value or name.
#  See also: Application.log_level
# c.Tool.log_level = 30

#  Default: None
# c.Tool.provenance_log = None

#  Default: False
# c.Tool.quiet = False

## Instead of starting the Application, dump configuration to stdout
#  See also: Application.show_config
# c.Tool.show_config = False

## Instead of starting the Application, dump configuration to stdout (as JSON)
#  See also: Application.show_config_json
# c.Tool.show_config_json = False

#------------------------------------------------------------------------------
# MyTool(Tool) configuration
#------------------------------------------------------------------------------
## name of a configuration file with parameters to load in addition to command-
#  line parameters
#  See also: Tool.config_file
# c.MyTool.config_file = None

## Number of times to run
#  Default: 5
# c.MyTool.iterations = 5

#  See also: Tool.log_config
# c.MyTool.log_config = {'version': 1, 'disable_existing_loggers': False, 'formatters': {'file': {'()': <class 'ctapipe.core.logging.PlainFormatter'>, 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}, 'console': {'()': <class 'ctapipe.core.logging.ColoredFormatter'>, 'fmt': '%(asctime)s %(levelname)s [%(name)s] (%(module)s.%(funcName)s): %(message)s'}}, 'handlers': {'ctapipe-console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 30}, 'console': {'class': 'logging.StreamHandler', 'formatter': 'console', 'stream': 'ext://sys.stderr', 'level': 'NOTSET'}}, 'loggers': {'ctapipe': {'level': 30, 'handlers': ['ctapipe-console'], 'propagate': False}}}

## The date format used by logging formatters for %(asctime)s
#  See also: Application.log_datefmt
# c.MyTool.log_datefmt = '%Y-%m-%d %H:%M:%S'

## Filename for the log
#  See also: Tool.log_file
# c.MyTool.log_file = None

## Logging Level for File Logging
#  See also: Tool.log_file_level
# c.MyTool.log_file_level = 'INFO'

## The Logging format template
#  See also: Application.log_format
# c.MyTool.log_format = '[%(name)s]%(highlevel)s %(message)s'

## Set the log level by value or name.
#  See also: Application.log_level
# c.MyTool.log_level = 30

#  See also: Tool.provenance_log
# c.MyTool.provenance_log = None

#  See also: Tool.quiet
# c.MyTool.quiet = False

## Instead of starting the Application, dump configuration to stdout
#  See also: Application.show_config
# c.MyTool.show_config = False

## Instead of starting the Application, dump configuration to stdout (as JSON)
#  See also: Application.show_config_json
# c.MyTool.show_config_json = False

#------------------------------------------------------------------------------
# MyComponent(Component) configuration
#------------------------------------------------------------------------------
## A Component that does stuff

## Value to use
#  Default: -1
# c.MyComponent.value = -1

#------------------------------------------------------------------------------
# AdvancedComponent(Component) configuration
#------------------------------------------------------------------------------
## An advanced technique

## input file name
#  Default: None
# c.AdvancedComponent.infile = None

## output file name
#  Default: None
# c.AdvancedComponent.outfile = None

## Value to use
#  Default: -1
# c.AdvancedComponent.value1 = -1

#------------------------------------------------------------------------------
# SecondaryMyComponent(MyComponent) configuration
#------------------------------------------------------------------------------
## Value to use
#  See also: MyComponent.value
# c.SecondaryMyComponent.value = -1

#------------------------------------------------------------------------------
# TelescopeWiseComponent(TelescopeComponent) configuration
#------------------------------------------------------------------------------
## a component that contains parameters that are per-telescope configurable

## Something configurable with telescope patterns
#  Default: [('type', '*', 5.0)]
# c.TelescopeWiseComponent.param = [('type', '*', 5.0)]