ctapipe_io_zfits#

EventSource implementations for protozfits files.

class ctapipe_io_zfits.ProtozfitsDL0EventSource(input_url=traitlets.Undefined, config=None, parent=None, **kwargs)#

DL0 Protozfits EventSource.

The input_url must be the subarray trigger file, the source will then look for the other data files according to the filename and directory schema laid out in the draft of the ACADA - DPPS ICD.

Attributes:
allowed_tels

list of allowed tel_ids, others will be ignored. If None, all telescopes in the input stream will be included

atmosphere_density_profile

atmosphere density profile that can be integrated to

config
cross_validation_lock

A contextmanager for running a block with our cross validation lock set to True.

datalevels

The datalevels provided by this event source

input_url

Path to the input file containing events.

is_simulation

Whether the currently opened file is simulated

is_stream

Bool indicating if input is a stream.

max_events

Maximum number of events that will be read from the file

obs_ids

The observation ids of the runs located in the file Unmerged files should only contain a single obs id.

observation_blocks

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

parent
scheduling_blocks

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

simulated_shower_distributions

The distribution of simulated showers for each obs_id.

simulation_config

The simulation configurations of all observations provided by the

subarray

Obtain the subarray from the EventSource

subarray_id
warn_missing

Methods

add_traits(**traits)

Dynamically add trait attributes to the HasTraits instance.

class_config_rst_doc()

Generate rST documentation for this class' config options.

class_config_section([classes])

Get the config section for this class.

class_get_help([inst])

Get the help string for this class in ReST format.

class_get_trait_help(trait[, inst, helptext])

Get the helptext string for a single trait.

class_own_trait_events(name)

Get a dict of all event handlers defined on this class, not a parent.

class_own_traits(**metadata)

Get a dict of all the traitlets defined on this class, not a parent.

class_print_help([inst])

Get the help string for a single trait and print it.

class_trait_names(**metadata)

Get a list of all the names of this class' traits.

class_traits(**metadata)

Get a dict of all the traits of this class.

close()

Close underlying files.

from_name(name[, config, parent])

Obtain an instance of a subclass via its name

get_current_config()

return the current configuration as a dict (e.g. the values of all traits, even if they were not set during configuration).

has_any_datalevel(datalevels)

Check if any of datalevels is in self.datalevels

has_trait(name)

Returns True if the object has a trait with the specified name.

hold_trait_notifications()

Context manager for bundling trait change notifications and cross validation.

is_compatible(file_path)

Return True if the given file can be read by this source.

non_abstract_subclasses()

Get a dict of all non-abstract subclasses of this class.

notify_change(change)

Notify observers of a change event

observe(handler[, names, type])

Setup a handler to be called when a trait changes.

on_trait_change([handler, name, remove])

DEPRECATED: Setup a handler to be called when a trait changes.

section_names()

return section names as a list

set_trait(name, value)

Forcibly sets trait attribute, including read-only attributes.

setup_instance(*args, **kwargs)

This is called before self.__init__ is called.

trait_defaults(*names, **metadata)

Return a trait's default value or a dictionary of them

trait_events([name])

Get a dict of all the event handlers of this class.

trait_has_value(name)

Returns True if the specified trait has a value.

trait_metadata(traitname, key[, default])

Get metadata values for trait by key.

trait_names(**metadata)

Get a list of all the names of this class' traits.

trait_values(**metadata)

A dict of trait names and their values.

traits(**metadata)

Get a dict of all the traits of this class.

unobserve(handler[, names, type])

Remove a trait change handler.

unobserve_all([name])

Remove trait change handlers of any type for the specified name.

update_config(config)

Update config and load the new values

close()#

Close underlying files.

property datalevels: tuple[DataLevel]#

The datalevels provided by this event source

Returns:
tuple[ctapipe.io.DataLevel]
static is_compatible(file_path)#

Return True if the given file can be read by this source.

property is_simulation: bool#

Whether the currently opened file is simulated

Returns:
bool
property observation_blocks: dict[int, ObservationBlockContainer]#

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

property scheduling_blocks: dict[int, SchedulingBlockContainer]#

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

property subarray: SubarrayDescription#

Obtain the subarray from the EventSource

Returns:
ctapipe.instrument.SubarrayDecription
class ctapipe_io_zfits.ProtozfitsDL0TelescopeEventSource(input_url=traitlets.Undefined, config=None, parent=None, **kwargs)#

DL0 Protozfits Telescope EventSource.

The input_url is one of the telescope events files.

Attributes:
allowed_tels

list of allowed tel_ids, others will be ignored. If None, all telescopes in the input stream will be included

atmosphere_density_profile

atmosphere density profile that can be integrated to

config
cross_validation_lock

A contextmanager for running a block with our cross validation lock set to True.

datalevels

The datalevels provided by this event source

ignore_samples_end
ignore_samples_start
input_url

Path to the input file containing events.

is_simulation

Whether the currently opened file is simulated

is_stream

Bool indicating if input is a stream.

max_events

Maximum number of events that will be read from the file

obs_ids

The observation ids of the runs located in the file Unmerged files should only contain a single obs id.

observation_blocks

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

parent
scheduling_blocks

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

simulated_shower_distributions

The distribution of simulated showers for each obs_id.

simulation_config

The simulation configurations of all observations provided by the

subarray

Obtain the subarray from the EventSource

subarray_id

Methods

add_traits(**traits)

Dynamically add trait attributes to the HasTraits instance.

class_config_rst_doc()

Generate rST documentation for this class' config options.

class_config_section([classes])

Get the config section for this class.

class_get_help([inst])

Get the help string for this class in ReST format.

class_get_trait_help(trait[, inst, helptext])

Get the helptext string for a single trait.

class_own_trait_events(name)

Get a dict of all event handlers defined on this class, not a parent.

class_own_traits(**metadata)

Get a dict of all the traitlets defined on this class, not a parent.

class_print_help([inst])

Get the help string for a single trait and print it.

class_trait_names(**metadata)

Get a list of all the names of this class' traits.

class_traits(**metadata)

Get a dict of all the traits of this class.

close()

Close this event source.

from_name(name[, config, parent])

Obtain an instance of a subclass via its name

get_current_config()

return the current configuration as a dict (e.g. the values of all traits, even if they were not set during configuration).

has_any_datalevel(datalevels)

Check if any of datalevels is in self.datalevels

has_trait(name)

Returns True if the object has a trait with the specified name.

hold_trait_notifications()

Context manager for bundling trait change notifications and cross validation.

is_compatible(input_url)

Abstract method to be defined in child class.

non_abstract_subclasses()

Get a dict of all non-abstract subclasses of this class.

notify_change(change)

Notify observers of a change event

observe(handler[, names, type])

Setup a handler to be called when a trait changes.

on_trait_change([handler, name, remove])

DEPRECATED: Setup a handler to be called when a trait changes.

section_names()

return section names as a list

set_trait(name, value)

Forcibly sets trait attribute, including read-only attributes.

setup_instance(*args, **kwargs)

This is called before self.__init__ is called.

trait_defaults(*names, **metadata)

Return a trait's default value or a dictionary of them

trait_events([name])

Get a dict of all the event handlers of this class.

trait_has_value(name)

Returns True if the specified trait has a value.

trait_metadata(traitname, key[, default])

Get metadata values for trait by key.

trait_names(**metadata)

Get a list of all the names of this class' traits.

trait_values(**metadata)

A dict of trait names and their values.

traits(**metadata)

Get a dict of all the traits of this class.

unobserve(handler[, names, type])

Remove a trait change handler.

unobserve_all([name])

Remove trait change handlers of any type for the specified name.

update_config(config)

Update config and load the new values

close()#

Close this event source.

No-op by default. Should be overridden by sources needing a cleanup-step

property datalevels: tuple[DataLevel]#

The datalevels provided by this event source

Returns:
tuple[ctapipe.io.DataLevel]
classmethod is_compatible(input_url)#

Abstract method to be defined in child class.

Perform a set of checks to see if the input file is compatible with this file event_source.

Parameters:
file_pathstr

File path to the event file.

Returns:
compatiblebool

True if file is compatible, False if it is incompatible

property is_simulation: bool#

Whether the currently opened file is simulated

Returns:
bool
property observation_blocks: dict[int, ObservationBlockContainer]#

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

property scheduling_blocks: dict[int, SchedulingBlockContainer]#

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

property subarray: SubarrayDescription#

Obtain the subarray from the EventSource

Returns:
ctapipe.instrument.SubarrayDecription