nectarchain.makers.component.charges_component.ChargesComponent#

class ChargesComponent(**kwargs: Any)[source]#

Bases: ArrayDataComponent

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.

charges_hg

Returns the charges for a specific trigger type as a NumPy array of unsigned 16-bit integers.

charges_lg

Returns the charges for a specific trigger type as a NumPy array of unsigned 16-bit integers.

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.

compute_charges

Compute charge from waveforms.

create_from_waveforms

Create a ChargesContainer object from waveforms using the specified charge extraction method.

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

Create an output container for the specified trigger type and method.

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.

histo_hg

Computes histogram of high gain charges from a ChargesContainer object.

histo_lg

Computes histogram of low gain charges from a ChargesContainer object.

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

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.

peak_hg

Returns the peak charges for a specific trigger type as a NumPy array of unsigned 16-bit integers.

peak_lg

Returns the peak charges for a specific trigger type as a NumPy array of unsigned 16-bit integers.

section_names

return section names as a list

select_charges_hg

Selects the charges from the ChargesContainer object for the given pixel_id and returns the result transposed.

select_charges_lg

Selects the charges from the ChargesContainer object for the given pixel_id and returns the result transposed.

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

sort

Sorts the charges in a ChargesContainer object based on the specified method.

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

CAMERA

CAMERA_NAME

The camera name

SubComponents

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

TEL_ID

The telescope ID

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.

extractor_kwargs

The kwargs to be pass to the charge extractor method

method

the charge extraction method

npixels

nsamples

Returns a deep copy of the nsamples attribute.

parent

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

pixels_id

run_number

subarray

SubComponents#

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

charges_hg(trigger)[source]#

Returns the charges for a specific trigger type as a NumPy array of unsigned 16-bit integers.

Parameters:
triggerEventType

The specific trigger type.

Returns:
: np.ndarray

The charges for the specific trigger type.

charges_lg(trigger)[source]#

Returns the charges for a specific trigger type as a NumPy array of unsigned 16-bit integers.

Parameters:
triggerEventType

The specific trigger type.

Returns:
: np.ndarray

The charges for the specific trigger type.

static compute_charges(waveformsContainer, channel, subarray, method='FullWaveformSum', tel_id=None, **kwargs)[source]#

Compute charge from waveforms.

Parameters:
waveformsContainerWaveformsContainer

The waveforms container object.

subarraySubarrayDescription

The subarray to work on.

channelint

The channel to compute charges for.

methodstr, optional

The charge extraction method to use (default is FullWaveformSum).

tel_idint, optional

The telescope ID on which charges will be computed.

kwargs

Additional keyword arguments to pass to the charge extraction method.

Returns:
: tuple

A tuple containing the computed charges and peak times.

Raises:
ArgumentError

If the extraction method is unknown.

ArgumentError

If the channel is unknown.

static create_from_waveforms(waveformsContainer, subarray=<class 'ctapipe.instrument.subarray.SubarrayDescription'>, method='FullWaveformSum', **kwargs)[source]#

Create a ChargesContainer object from waveforms using the specified charge extraction method.

Return type:

ChargesContainer

Parameters:
waveformsContainerWaveformsContainer

The waveforms container object.

methodstr, optional

The charge extraction method to use (default is FullWaveformSum).

kwargs

Additional keyword arguments to pass to the charge extraction method.

Returns:
chargesContainerChargesContainer

The charges container object containing the computed charges and peak times.

extractor_kwargs#

The kwargs to be pass to the charge extractor method

finish(*args, **kwargs)[source]#

Create an output container for the specified trigger type and method.

Parameters:
trigger_type (EventType): The type of trigger.
method (str): The name of the charge extraction method.
args: Additional positional arguments.
kwargs: Additional keyword arguments.
Returns:
list: A list of ChargesContainer objects.
static histo_hg(chargesContainer, n_bins=1000, autoscale=True)[source]#

Computes histogram of high gain charges from a ChargesContainer object.

Return type:

MaskedArray

Parameters:
chargesContainerChargesContainer

A ChargesContainer object that holds information about charges from a specific run.

n_binsint, optional

The number of bins in the charge histogram. Defaults to 1000.

autoscalebool, optional

Whether to automatically detect the number of bins based on the pixel data. Defaults to True.

Returns:
: ma.masked_array

A masked array representing the charge histogram, where each row corresponds to an event and each column corresponds to a bin in the histogram.

static histo_lg(chargesContainer, n_bins=1000, autoscale=True)[source]#

Computes histogram of low gain charges from a ChargesContainer object.

Return type:

MaskedArray

Parameters:
chargesContainerChargesContainer

A ChargesContainer object that holds information about charges from a specific run.

n_binsint, optional

The number of bins in the charge histogram. Defaults to 1000.

autoscalebool, optional

Whether to automatically detect the number of bins based on the pixel data. Defaults to True.

Returns:
: ma.masked_array

A masked array representing the charge histogram, where each row corresponds to an event and each column corresponds to a bin in the histogram.

method#

the charge extraction method

peak_hg(trigger)[source]#

Returns the peak charges for a specific trigger type as a NumPy array of unsigned 16-bit integers.

Parameters:
triggerEventType

The specific trigger type.

Returns:
: np.ndarray

The peak charges for the specific trigger type.

peak_lg(trigger)[source]#

Returns the peak charges for a specific trigger type as a NumPy array of unsigned 16-bit integers.

Parameters:
triggerEventType

The specific trigger type.

Returns:
: np.ndarray

The peak charges for the specific trigger type.

static select_charges_hg(chargesContainer, pixel_id)[source]#

Selects the charges from the ChargesContainer object for the given pixel_id and returns the result transposed.

Parameters:
chargesContainerChargesContainer

The ChargesContainer object.

pixel_idnp.ndarray

An array of pixel IDs.

Returns:
resnp.ndarray

The selected charges from the ChargesContainer object for the given pixel_id, transposed.

static select_charges_lg(chargesContainer, pixel_id)[source]#

Selects the charges from the ChargesContainer object for the given pixel_id and returns the result transposed.

Parameters:
chargesContainerChargesContainer

The ChargesContainer object.

pixel_idnp.ndarray

An array of pixel IDs.

Returns:
resnp.ndarray

The selected charges from the ChargesContainer object for the given pixel_id, transposed.

static sort(chargesContainer, method='event_id')[source]#

Sorts the charges in a ChargesContainer object based on the specified method.

Parameters:
chargesContainerChargesContainer

The ChargesContainer object to be sorted.

methodstr, optional

The sorting method. Defaults to ‘event_id’.

Returns:
ChargesContainer:

A new ChargesContainer object with the charges sorted based on the specified method.

Raises:
ArgumentError:

If the specified method is not valid.