nectarchain.makers.component.charges_component.ChargesComponent#
- class ChargesComponent(**kwargs: Any)[source]#
Bases:
ArrayDataComponentMethods
add_traitsDynamically add trait attributes to the HasTraits instance.
broken_pixels_hgReturns an array of broken pixels for high gain for the specified trigger type.
broken_pixels_lgReturns an array of broken pixels for low gain for the specified trigger type.
Returns the charges for a specific trigger type as a NumPy array of unsigned 16-bit integers.
Returns the charges for a specific trigger type as a NumPy array of unsigned 16-bit integers.
class_config_rst_docGenerate rST documentation for this class' config options.
class_config_sectionGet the config section for this class.
class_get_helpGet the help string for this class in ReST format.
class_get_trait_helpGet the helptext string for a single trait.
class_own_trait_eventsGet a dict of all event handlers defined on this class, not a parent.
class_own_traitsGet a dict of all the traitlets defined on this class, not a parent.
class_print_helpGet the help string for a single trait and print it.
class_trait_namesGet a list of all the names of this class' traits.
class_traitsGet a
dictof all the traits of this class.Compute charge from waveforms.
Create a ChargesContainer object from waveforms using the specified charge extraction method.
event_idReturns an array of event IDs for the specified trigger type.
event_typeReturns an array of event types for the specified trigger type.
Create an output container for the specified trigger type and method.
from_nameObtain an instance of a subclass via its name
get_current_configreturn the current configuration as a dict (e.g. the values of all traits, even if they were not set during configuration).
has_traitReturns True if the object has a trait with the specified name.
Computes histogram of high gain charges from a ChargesContainer object.
Computes histogram of low gain charges from a ChargesContainer object.
hold_trait_notificationsContext manager for bundling trait change notifications and cross validation.
mergeMethod to merge 2 ArrayDataContainer into one single ArrayDataContainer.
merge_along_slicesmultiplicityReturns an array of multiplicities for the specified trigger type.
neventsReturns the number of events for the specified trigger type.
non_abstract_subclassesGet a dict of all non-abstract subclasses of this class.
notify_changeNotify observers of a change event
observeSetup a handler to be called when a trait changes.
on_trait_changeDEPRECATED: Setup a handler to be called when a trait changes.
Returns the peak charges for a specific trigger type as a NumPy array of unsigned 16-bit integers.
Returns the peak charges for a specific trigger type as a NumPy array of unsigned 16-bit integers.
section_namesreturn section names as a list
Selects the charges from the ChargesContainer object for the given pixel_id and returns the result transposed.
Selects the charges from the ChargesContainer object for the given pixel_id and returns the result transposed.
select_container_array_fieldSelects specific fields from an ArrayDataContainer object based on a given list of pixel IDs.
set_traitForcibly sets trait attribute, including read-only attributes.
setup_instanceSorts the charges in a ChargesContainer object based on the specified method.
trait_defaultsReturn a trait's default value or a dictionary of them
trait_eventsGet a
dictof all the event handlers of this class.trait_has_valueReturns True if the specified trait has a value.
trait_metadataGet metadata values for trait by key.
trait_namesGet a list of all the names of this class' traits.
trait_valuesA
dictof trait names and their values.traitsGet a
dictof all the traits of this class.trig_patternReturns an array of trigger patterns for the specified trigger type.
trig_pattern_allReturns an array of trigger patterns for all events for the specified trigger type.
ucts_busy_counterReturns an array of UCTS busy counters for the specified trigger type.
ucts_event_counterReturns an array of UCTS event counters for the specified trigger type.
ucts_timestampReturns an array of UCTS timestamps for the specified trigger type.
unobserveRemove a trait change handler.
unobserve_allRemove trait change handlers of any type for the specified name.
update_configUpdate config and load the new values
Attributes
CAMERACAMERA_NAMEThe camera name
List of Component names that are used inside current component, this is used to resolve recursively the configurable traits defined in sub-components.
TEL_IDThe telescope ID
configA trait whose value must be an instance of a specified class.
cross_validation_lockA contextmanager for running a block with our cross validation lock set to True.
The kwargs to be pass to the charge extractor method
the charge extraction method
npixelsnsamplesReturns a deep copy of the nsamples attribute.
parentA trait whose value must be an instance of a specified class.
pixels_idrun_numbersubarray- 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:
- waveformContainerWaveformsContainer
The waveforms container object.
- channelint
The channel to compute charges for.
- methodstr, optional
The charge extraction method to use (default is
FullWaveformSum).- 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:
- 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.