nectarchain.makers.component.core.ArrayDataComponent#

class ArrayDataComponent(*args: t.Any, **kwargs: t.Any)[source]#

Bases: NectarCAMComponent

A NectarCAMComponent that accumulates event data into arrays.

Stores per-trigger-type data such as event IDs, timestamps, counters, trigger patterns, and broken-pixel flags. Provides methods to retrieve these data as arrays and to merge containers.

Initializes the ArrayDataComponent.

Parameters:
subarrayctapipe.core.SubarrayDescription

The subarray description.

configctapipe.core.Config, optional

Configuration object.

parentComponent, optional

Parent component.

*args

Additional positional arguments forwarded to NectarCAMComponent.

**kwargs

Additional keyword arguments forwarded to NectarCAMComponent.

Methods

add_traits

Dynamically add trait attributes to the HasTraits instance.

broken_pixels_hg

Returns an array of broken pixels for high gain for the specified trigger type.

broken_pixels_lg

Returns an array of broken pixels for low gain for the specified trigger type.

class_config_rst_doc

Generate rST documentation for this class' config options.

class_config_section

Get the config section for this class.

class_get_help

Get the help string for this class in ReST format.

class_get_trait_help

Get the helptext string for a single trait.

class_own_trait_events

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

class_own_traits

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

class_print_help

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

class_trait_names

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

class_traits

Get a dict of all the traits of this class.

event_id

Returns an array of event IDs for the specified trigger type.

event_type

Returns an array of event types for the specified trigger type.

finish

Finalize processing.

from_name

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_trait

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.

merge

Method to merge 2 ArrayDataContainer into one single ArrayDataContainer.

merge_along_slices

Merges a sequence of ArrayDataContainer objects along the slice axis.

multiplicity

Returns an array of multiplicities for the specified trigger type.

nevents

Returns the number of events for the specified trigger type.

non_abstract_subclasses

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

notify_change

Notify observers of a change event

observe

Setup a handler to be called when a trait changes.

on_trait_change

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

section_names

return section names as a list

select_container_array_field

Selects specific fields from an ArrayDataContainer object based on a given list of pixel IDs.

set_trait

Forcibly sets trait attribute, including read-only attributes.

setup_instance

trait_defaults

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

trait_events

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

trait_has_value

Returns True if the specified trait has a value.

trait_metadata

Get metadata values for trait by key.

trait_names

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

trait_values

A dict of trait names and their values.

traits

Get a dict of all the traits of this class.

trig_pattern

Returns an array of trigger patterns for the specified trigger type.

trig_pattern_all

Returns an array of trigger patterns for all events for the specified trigger type.

ucts_busy_counter

Returns an array of UCTS busy counters for the specified trigger type.

ucts_event_counter

Returns an array of UCTS event counters for the specified trigger type.

ucts_timestamp

Returns an array of UCTS timestamps for the specified trigger type.

unobserve

Remove a trait change handler.

unobserve_all

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

update_config

Update config and load the new values

Attributes

SubComponents

List of Component names that are used inside current component, this is used to resolve recursively the configurable traits defined in sub-components.

camera

Returns the camera description.

camera_name

Returns the camera name.

config

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

cross_validation_lock

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

npixels

Returns a deep copy of the number of pixels.

nsamples

Returns a deep copy of the nsamples attribute.

parent

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

pixels_id

Returns a deep copy of the pixel IDs array.

run_number

Returns a deep copy of the run number.

subarray

tel_id

Returns the telescope ID.

__call__(event: NectarCAMDataContainer, *args, **kwargs)[source]#

Method to extract data from the event.

Parameters:
event: NectarCAMDataContainer

The event object.

trigger: EventType

The trigger type.

args

Additional arguments that can be passed to the method.

kwargs

Additional keyword arguments that can be passed to the method.

Returns:
get_wfs_hg, get_wfs_lg

If the return_wfs keyword argument is True, the method returns the high and low gain waveforms from the event.

broken_pixels_hg(trigger: EventType)[source]#

Returns an array of broken pixels for high gain for the specified trigger type.

Args:

trigger (EventType): The trigger type for which the broken pixels for high gain are requested.

Returns:

np.ndarray: An array of broken pixels for high gain for the specified trigger type.

broken_pixels_lg(trigger: EventType)[source]#

Returns an array of broken pixels for low gain for the specified trigger type.

Args:

trigger (EventType): The trigger type for which the broken pixels for low gain are requested.

Returns:

np.ndarray: An array of broken pixels for low gain for the specified trigger type.

event_id(trigger: EventType)[source]#

Returns an array of event IDs for the specified trigger type.

Args:

trigger (EventType): The trigger type for which the event IDs are requested.

Returns:

np.ndarray: An array of event IDs for the specified trigger type.

event_type(trigger: EventType)[source]#

Returns an array of event types for the specified trigger type.

Args:

trigger (EventType): The trigger type for which the event types are requested.

Returns:

np.ndarray: An array of event types for the specified trigger type.

abstractmethod finish()[source]#

Finalize processing. Must be implemented by subclasses.

This method is called after all events have been processed to perform any final computations or cleanup.

static merge(container_a: ArrayDataContainer, container_b: ArrayDataContainer) → ArrayDataContainer[source]#

Method to merge 2 ArrayDataContainer into one single ArrayDataContainer.

Returns:

ArrayDataContainer: the merged object

static merge_along_slices(containers_generator: Iterable) → ArrayDataContainer[source]#

Merges a sequence of ArrayDataContainer objects along the slice axis.

Iterates over a generator of containers and merges them sequentially by deeply copying the first and then merging subsequent containers per trigger type.

Parameters:
containers_generatorIterable[ArrayDataContainer]

An iterable yielding ArrayDataContainer objects to merge.

Returns:
ArrayDataContainer

The merged container.

multiplicity(trigger: EventType)[source]#

Returns an array of multiplicities for the specified trigger type.

Args:

trigger (EventType): The trigger type for which the multiplicities are requested.

Returns:

np.ndarray: An array of multiplicities for the specified trigger type.

nevents(trigger: EventType)[source]#

Returns the number of events for the specified trigger type.

Args:

trigger (EventType): The trigger type for which the number of events is requested.

Returns:

int: The number of events for the specified trigger type.

property nsamples#

Returns a deep copy of the nsamples attribute.

Returns:

np.ndarray: A deep copy of the nsamples attribute.

static select_container_array_field(container: ArrayDataContainer, pixel_id: ndarray, field: str, pixel_id_axis=1) → ndarray[source]#

Selects specific fields from an ArrayDataContainer object based on a given list of pixel IDs.

Args:

container (ArrayDataContainer): An object of type ArrayDataContainer that contains the data. pixel_id (ndarray): An array of pixel IDs for which the data needs to be selected. field (str): The name of the field to be selected from the container. pixel_id_axis (int): The axis of the field associated to pixel IDs. Optional, default is 1. WARNING: This field have to be associated to an array indexed by pixels

Returns:

ndarray: An array containing the selected data for the given pixel IDs.

trig_pattern(trigger: EventType)[source]#

Returns an array of trigger patterns for the specified trigger type.

Args:

trigger (EventType): The trigger type for which the trigger patterns are requested.

Returns:

np.ndarray: An array of trigger patterns for the specified trigger type.

trig_pattern_all(trigger: EventType)[source]#

Returns an array of trigger patterns for all events for the specified trigger type.

Args:

trigger (EventType): The trigger type for which the trigger patterns for all events are requested.

Returns:

np.ndarray: An array of trigger patterns for all events for the specified trigger type.

ucts_busy_counter(trigger: EventType)[source]#

Returns an array of UCTS busy counters for the specified trigger type.

Args:

trigger (EventType): The trigger type for which the UCTS busy counters are requested.

Returns:

np.ndarray: An array of UCTS busy counters for the specified trigger type.

ucts_event_counter(trigger: EventType)[source]#

Returns an array of UCTS event counters for the specified trigger type.

Args:

trigger (EventType): The trigger type for which the UCTS event counters are requested.

Returns:

np.ndarray: An array of UCTS event counters for the specified trigger type.

ucts_timestamp(trigger: EventType)[source]#

Returns an array of UCTS timestamps for the specified trigger type.

Args:

trigger (EventType): The trigger type for which the UCTS timestamps are requested.

Returns:

np.ndarray: An array of UCTS timestamps for the specified trigger type.