ctapipe is not stable yet, so expect large and rapid changes to structure and functionality as we explore various design choices before the 1.0 release.

Field#

class ctapipe.core.container.Field(default=None, description='', unit=None, ucd=None, dtype=None, type=None, ndim=None, allow_none=True, max_length=None, default_factory=None)[source]#

Bases: object

Class for storing data in a Container.

Parameters:
default

Default value of the item. This will be set when the Container is constructed, as well as when Container.reset is called. This should only be used for immutable values. For mutable values, use default_factory instead.

descriptionstr

Help text associated with the item

unitstr or astropy.units.core.UnitBase

unit to convert to when writing output, or None for no conversion

ucdstr

universal content descriptor (see Virtual Observatory standards)

typetype

expected type of value

dtypestr or np.dtype

expected data type of the value, None to ignore in validation. Means value is expected to be a numpy array or astropy quantity

ndimint or None

expected dimensionality of the data, for arrays, None to ignore

allow_nonebool

if the value of None is given to this Field, skip validation

max_lenint

if type is str, max_len is the maximum number of bytes of the utf-8 encoded string to be used.

default_factoryCallable

A callable providing a fresh instance as default value.

Methods Summary

validate(value)

check that a given value is appropriate for this Field

Methods Documentation

validate(value)[source]#

check that a given value is appropriate for this Field

Parameters:
value: Any

the value to test

Raises:
FieldValidationError:

if the value is not valid