Core Structures and Base Classes (core)#

Introduction#

The ctapipe.core module contains base classes the provide developers with the core functionality to implement an application that processes data.

Container provides a common data class, Component lets one define a module (worker, maker, etc.) for a particular algorithm along with its user-editable configuration parameters, and Tool defines a command-line application, complete with configuration file or command-line parameter processing, and logging setup. In the future this will also handle provenance metadata.

All ctapipe applications should derive from these classes in order to provide a common interface and to make use of the configuration system.

For details about creating command-line tools, see Command-line Tools (tools)

The following shows the conceptual difference between Tools and Components with overall pipelines and stages. Serialization and Deserialization are simply specialized Components that perform data access.

../../_images/tool-component.png

Reference/API#

ctapipe.core Package#

Core functionality of ctapipe

Functions#

non_abstract_children(base)

Return all non-abstract subclasses of a base class recursively.

get_module_version(name)

Get the version of a python module, something you can import.

run_tool(tool[, argv, cwd, raises])

Utility run a certain tool in a python session without exiting.

Classes#

Component(*args, **kwargs)

Base class of all Components.

TelescopeComponent(*args, **kwargs)

A component that needs a SubarrayDescription to be constructed, and which contains configurable TelescopeParameter fields that must be configured on construction.

Container([prefix])

Generic class that can hold and accumulate data to be passed

Tool(*args, **kwargs)

A base class for all executable tools (applications) that handles configuration loading/saving, logging, command-line processing, and provenance meta-data handling.

Field()

Class for storing data in a Container.

FeatureGenerator(*args, **kwargs)

Generate features for astropy.table.Table.

DeprecatedField(default[, description, ...])

used to mark which fields may be removed in next version

Map

A dictionary of sub-containers that can be added to a Container.

Provenance(*args, **kw)

Manage the provenance info for a stack of activities

ToolConfigurationError(message)

QualityQuery(*args, **kwargs)

Manages a set of user-configurable (at runtime or in a config file) selection criteria that operate on the same type of input.

QualityCriteriaError

Signal a problem with a user-defined selection criteria function

FieldValidationError

ExpressionEngine(expressions)

Compile expressions on init, evaluate on call.

TimeResolution(*values)

Determines which format is used for storing astropy Time objects.

ctapipe.core.env Module#

Environment variables to configure ctapipe.

Variables#

ctapipe.core.component Module#

Class to handle configuration for algorithms

Functions#

non_abstract_children(base)

Return all non-abstract subclasses of a base class recursively.

Classes#

Component(*args, **kwargs)

Base class of all Components.

ctapipe.core.telescope_component Module#

This module defines classes to enable per-telescope configuration of trait values

Classes#

TelescopeComponent(*args, **kwargs)

A component that needs a SubarrayDescription to be constructed, and which contains configurable TelescopeParameter fields that must be configured on construction.

TelescopeParameter(trait[, default_value])

Allow a parameter value to be specified as a simple value (of type dtype), or as a list of patterns that match different telescopes.

TelescopeParameterLookup(...)

TelescopePatternList(*args)

Representation for a list of telescope pattern tuples.

ctapipe.core.tool Module#

Classes to handle configurable command-line user interfaces.

Classes#

Tool(*args, **kwargs)

A base class for all executable tools (applications) that handles configuration loading/saving, logging, command-line processing, and provenance meta-data handling.

ToolConfigurationError(message)

ctapipe.core.container Module#

Classes#

Container([prefix])

Generic class that can hold and accumulate data to be passed

Field()

Class for storing data in a Container.

FieldValidationError

Map

A dictionary of sub-containers that can be added to a Container.

TimeResolution(*values)

Determines which format is used for storing astropy Time objects.

ctapipe.core.expression_engine Module#

Expression Engine

Classes#

ExpressionEngine(expressions)

Compile expressions on init, evaluate on call.

ExpressionError

Signal a problem with a user-defined selection criteria function

ctapipe.core.traits Module#

Traitlet implementations for ctapipe

Functions#

classes_with_traits(base_class)

Returns a list of the base class plus its non-abstract children if they have traits

create_class_enum_trait(base_class, ...[, ...])

create a configurable CaselessStrEnum traitlet from baseclass

has_traits(cls[, ignore])

True if cls has any traits apart from the usual ones

flag(name, configurable[, set_help, unset_help])

Helper for building basic --trait, --no-trait flags.

observe(*names[, type])

A decorator which can be used to observe Traits on a class.

Classes#

AstroQuantity([physical_type])

A trait containing an astropy.units quantity.

AstroTime([default_value, allow_none, ...])

A trait representing a point in Time, as understood by astropy.time.

BoolTelescopeParameter(**kwargs)

a TelescopeParameter with Bool trait type

IntTelescopeParameter(**kwargs)

a TelescopeParameter with Int trait type

FloatTelescopeParameter(**kwargs)

a TelescopeParameter with Float trait type

Path([default_value, allow_none, exists, ...])

A path Trait for input/output files.

Bool([default_value, allow_none, read_only, ...])

A boolean (True, False) trait.

CRegExp([default_value, allow_none, ...])

A casting compiled regular expression trait.

CaselessStrEnum(values[, default_value])

An enum of strings where the case should be ignored.

CInt([default_value, allow_none, read_only, ...])

A casting version of the int trait.

Dict()

An instance of a Python dict.

Enum(values[, default_value, allow_none, ...])

An enum whose value must be in a given sequence.

Float([default_value, allow_none, ...])

A float trait.

Int([default_value, allow_none, read_only, ...])

An integer trait.

List()

An instance of a Python list.

Set()

An instance of a Python set.

TraitError

Tuple()

An instance of a Python tuple.

Unicode([default_value, allow_none, ...])

A trait for unicode strings.

NoneDefaultNotAllowedWarning

For the default_value=None, allow_none=False case.