Reference#

class ctapipe.io.metadata.Reference(*args: t.Any, **kwargs: t.Any)[source]#

Bases: HasTraits

Complete metadata record using the legacy CTA reference schema.

A reference combines contact, product, process, activity, and instrument metadata. Use to_dict() to flatten it into file-header attributes.

Attributes Summary

activity

A trait whose value must be an instance of a specified class.

contact

A trait whose value must be an instance of a specified class.

instrument

A trait whose value must be an instance of a specified class.

process

A trait whose value must be an instance of a specified class.

product

A trait whose value must be an instance of a specified class.

Methods Summary

from_dict(metadata)

Create a legacy reference record from flattened CTA metadata.

from_fits(header)

Create a legacy reference record from a FITS header.

from_json(json_data)

Create a legacy reference record from a JSON metadata mapping.

to_dict([fits])

Convert the reference metadata to a flat dictionary.

Attributes Documentation

activity#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

contact#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

instrument#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

product#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

Methods Documentation

classmethod from_dict(metadata)[source]#

Create a legacy reference record from flattened CTA metadata.

Parameters:
metadatacollections.abc.Mapping

Metadata containing flattened CTA ... keys. Unrelated keys are ignored.

Returns:
Reference

Parsed legacy reference metadata.

classmethod from_fits(header)[source]#

Create a legacy reference record from a FITS header.

classmethod from_json(json_data)[source]#

Create a legacy reference record from a JSON metadata mapping.

to_dict(fits=False)[source]#

Convert the reference metadata to a flat dictionary.

Parameters:
fitsbool

If true, prefix keys with HIERARCH for use in FITS headers.

Returns:
dict

Flattened legacy metadata with CTA header keywords.