Field

class ctapipe.core.container.Field(default=None, description='', unit=None, ucd=None, dtype=None, type=None, ndim=None, allow_none=True)[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

description: str

Help text associated with the item

unit: str or astropy.units.core.UnitBase

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

ucd: str

universal content descriptor (see Virtual Observatory standards)

type: type

expected type of value

dtype: str 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

ndim: int or None

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

allow_none:

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

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