Command-line Tools (tools)#
Introduction#
ctapipe.tools contains the command line tools that use the ctapipe
framework.  All commandline tools inherit from ctapipe.core.Tool
which provides a common user-interface experience, complete with
command-line and configuration file handling, logging, and provenance
features.  See ctapipe.core documentation for examples.
Getting Started#
You can find out what ctapipe tools are installed using the
ctapipe-info command-line tool:
ctapipe-info --tools        # list all tools
ctapipe-info --version      # show ctapipe version
ctapipe-info --dependencies # list dependencies
To find out more about a specific tool, use it’s --help command-line option
Common Tool Functionality#
High-level command-line options can be seen with
--helpLow-level (Component) options can be seen with
--help-allYou can either specify options on the command-line, or in a config file (so far in JSON or python format, see the documentation for traitlets.config). Specify this configuration file using the
--config=FILENAMEoption.You can set the logging level of a tool using
--log_levelto a value or name in the list[0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']. By default, only warning messages are shown, but if you specify DEBUG you will get everything.
Developing a New Tool#
To create a new command-line Tool, follow the following procedure:
make a subclass of
ctapipe.core.Tooldefine any user-configurable parameters of the tool
register all configurable
ctapipe.core.Componentclasses that you want to be configured via the Tool via itsclassesattributeuse the
aliasesattribute to promote any parameters from one of the sub-Components to a high-level a command-line parameter (they can still be specified using the advanced command-line command syntax or via a config file if you do not do this, but if the parameter is commonly changed by the user, having it be high-level is more convenientoverload the
setup(self),start(self), andfinish(self)methods to implement the functinatlity of the tool (these will be called in order when you call therun()method.make sure you have a function called
main()that creates and runs your tool in the source file.add the file and
main()function you made in step 6 to the top-levelsetup.pyfile under the section calledentry_points['console_scripts']. This will automatically create an executable calledctapipe-*where*is the name of the source file of your tool (e.g.mytool.pywill becomectapipe-mytool.this new tool will be installed in the bin directory next time you run
make developat the top-level of ctapipe, or if you re-install the ctapipe package in non-developer mode.
Reference/API#
ctapipe.tools Package#
ctapipe command line tools.
ctapipe.tools.quickstart Module#
Create a working directory for ctapipe-process containing standard configuration files.
Classes#
  | 
Generate quick start files and directory structure.  | 
ctapipe.tools.process Module#
Generate DL1 (a or b) output files in HDF5 format from {R0,R1,DL0} inputs.
Classes#
  | 
Process data from lower-data levels up to DL1 and DL2, including image extraction and optionally image parameterization as well as muon analysis and shower reconstruction.  | 
ctapipe.tools.merge Module#
Merge multiple ctapipe HDF5 files into one
Classes#
  | 
Merge multiple ctapipe HDF5 files into one  | 
ctapipe.tools.train_energy_regressor Module#
Tool for training the EnergyRegressor
Classes#
  | 
Tool to train a   | 
ctapipe.tools.train_particle_classifier Module#
Tool for training the ParticleClassifier
Classes#
  | 
Tool to train a   | 
ctapipe.tools.train_disp_reconstructor Module#
Tool for training the DispReconstructor
Classes#
  | 
Tool to train a   | 
ctapipe.tools.apply_models Module#
Tool to apply machine learning models in bulk (as opposed to event by event).
Classes#
  | 
Apply machine learning models to data.  | 
ctapipe.tools.optimize_event_selection Module#
Tool to generate selections for IRFs production
Classes#
  | 
Tool to create optimized cuts for IRF generation  | 
ctapipe.tools.compute_irf Module#
Tool to generate IRFs
Classes#
  | 
Tool to create IRF files in GADF format  | 
ctapipe.tools.dump_instrument Module#
Dump instrumental descriptions in a monte-carlo (simtelarray) input file to FITS files that can be loaded independently (e.g. with CameraGeometry.from_table()). The name of the output files are automatically generated.
Classes#
  | 
ctapipe.tools.calculate_pixel_stats Module#
Perform statistics calculation from pixel-wise image data
Classes#
  | 
Perform statistics calculation for pixel-wise image data  | 
ctapipe.tools.store_astropy_cache Module#
Script to download astropy data needed for coordinate transformations.
Functions#
  | 
Download data needed for astropy coordinate transformations into a cache directory.  |