nectarchain.makers.component.photostatistic_algorithm.PhotoStatisticAlgorithm#

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

Bases: Component

Algorithm for photo-statistic gain estimation from flat-field and pedestal charges.

Parameters:
pixels_idnp.ndarray

Array of pixel IDs.

FFcharge_hgnp.ndarray

High-gain flat-field charges.

FFcharge_lgnp.ndarray

Low-gain flat-field charges.

Pedcharge_hgnp.ndarray

High-gain pedestal charges.

Pedcharge_lgnp.ndarray

Low-gain pedestal charges.

coefCharge_FF_Pedfloat

Coefficient relating flat-field and pedestal charges.

SPE_resolutionnp.ndarray

SPE resolution values.

SPE_high_gainnp.ndarray

SPE high-gain values.

configctapipe.core.Config or None, optional

Configuration instance.

parentComponent or None, optional

Parent component.

Initialise the photo-statistic algorithm with charge and SPE data.

Parameters:
pixels_idnp.ndarray

Array of pixel IDs.

FFcharge_hgnp.ndarray

High-gain flat-field charges.

FFcharge_lgnp.ndarray

Low-gain flat-field charges.

Pedcharge_hgnp.ndarray

High-gain pedestal charges.

Pedcharge_lgnp.ndarray

Low-gain pedestal charges.

coefCharge_FF_Pedfloat

Coefficient relating flat-field and pedestal charges.

SPE_resolutionnp.ndarray

SPE resolution values.

SPE_high_gainnp.ndarray

SPE high-gain values.

configctapipe.core.Config or None, optional

Configuration instance.

parentComponent or None, optional

Parent component.

Methods

add_traits

Dynamically add trait attributes to the HasTraits instance.

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.

create_from_chargesContainer

Create a PhotoStatisticAlgorithm instance from charge and SPE containers.

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.

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.

plot_correlation

Plot the correlation between the photo statistic gain and the single photoelectron (SPE) gain.

run

Run the photo-statistic algorithm for the specified pixels.

section_names

return section names as a list

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.

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

BHG

Calculates and returns the BHG value.

BLG

Calculates and returns the BLG value.

SPE_resolution

Returns a deep copy of the SPE resolution.

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.

gainHG

Calculates and returns the gain for high gain charge data.

gainHG_err

Calculates and returns the gain for high gain charge data.

gainLG

Calculates and returns the gain for low gain charge data.

gainLG_err

Calculates and returns the gain for high gain charge data.

meanChargeHG

Calculates and returns the mean of FFcharge_hg minus meanPedHG.

meanChargeLG

Calculates and returns the mean of FFcharge_lg minus meanPedLG.

meanPedHG

Calculates and returns the mean of Pedcharge_hg multiplied by coefCharge_FF_Ped.

meanPedLG

Calculates and returns the mean of Pedcharge_lg multiplied by coefCharge_FF_Ped.

npixels

The number of pixels.

parent

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

results

A deep copy of the photo-statistic results container.

sigmaChargeHG

Calculates and returns the standard deviation of FFcharge_hg minus meanPedHG.

sigmaChargeLG

Calculates and returns the standard deviation of FFcharge_lg minus meanPedLG.

sigmaPedHG

Calculates and returns the standard deviation of Pedcharge_hg multiplied by the square root of coefCharge_FF_Ped.

sigmaPedLG

Calculates and returns the standard deviation of Pedcharge_lg multiplied by the square root of coefCharge_FF_Ped.

property BHG: float#

Calculates and returns the BHG value.

Returns:

float: The BHG value.

property BLG: float#

Calculates and returns the BLG value.

Returns:

float: The BLG value.

property SPE_resolution: float#

Returns a deep copy of the SPE resolution.

Returns:

float: The SPE resolution.

classmethod create_from_chargesContainer(FFcharge: ChargesContainer, Pedcharge: ChargesContainer, SPE_result: SPEfitContainer, coefCharge_FF_Ped: float, **kwargs)[source]#

Create a PhotoStatisticAlgorithm instance from charge and SPE containers.

Parameters:
FFchargeChargesContainer

Flat-field charges container.

PedchargeChargesContainer

Pedestal charges container.

SPE_resultSPEfitContainer

SPE fit results container.

coefCharge_FF_Pedfloat

Coefficient relating flat-field and pedestal charges.

Returns:
PhotoStatisticAlgorithm

The initialised algorithm instance.

property gainHG: float#

Calculates and returns the gain for high gain charge data.

Returns:

float: The gain for high gain charge data.

property gainHG_err: float#

Calculates and returns the gain for high gain charge data.

Returns:

float: The gain for high gain charge data.

property gainLG: float#

Calculates and returns the gain for low gain charge data.

Returns:

float: The gain for low gain charge data.

property gainLG_err: float#

Calculates and returns the gain for high gain charge data.

Returns:

float: The gain for high gain charge data.

property meanChargeHG: float#

Calculates and returns the mean of FFcharge_hg minus meanPedHG.

Returns:

float: The mean of FFcharge_hg minus meanPedHG.

property meanChargeLG: float#

Calculates and returns the mean of FFcharge_lg minus meanPedLG.

Returns:

float: The mean of FFcharge_lg minus meanPedLG.

property meanPedHG: float#

Calculates and returns the mean of Pedcharge_hg multiplied by coefCharge_FF_Ped.

Returns:

float: The mean of Pedcharge_hg.

property meanPedLG: float#

Calculates and returns the mean of Pedcharge_lg multiplied by coefCharge_FF_Ped.

Returns:

float: The mean of Pedcharge_lg.

property npixels#

The number of pixels.

Returns:
int

Number of pixels.

static plot_correlation(photoStat_gain: ndarray, SPE_gain: ndarray) → matplotlib.pyplot.Figure[source]#

Plot the correlation between the photo statistic gain and the single photoelectron (SPE) gain.

Args:

photoStat_gain (np.ndarray): Array of photo statistic gain values. SPE_gain (np.ndarray): Array of SPE gain values.

Returns:

fig (plt.Figure): The figure object containing the scatter plot and the linear fit line.

property results#

A deep copy of the photo-statistic results container.

Returns:
PhotostatContainer

The results container.

run(pixels_id: ndarray = None, **kwargs) → None[source]#

Run the photo-statistic algorithm for the specified pixels.

Parameters:
pixels_idnp.ndarray or None, optional

Pixel IDs to process. If None, all pixels are used.

Returns:
int

0 on success.

Other Parameters:
figpathstr or False, optional

If provided, save a correlation plot to this directory.

property sigmaChargeHG: float#

Calculates and returns the standard deviation of FFcharge_hg minus meanPedHG.

Returns:

float: The standard deviation of FFcharge_hg minus meanPedHG.

property sigmaChargeLG: float#

Calculates and returns the standard deviation of FFcharge_lg minus meanPedLG.

Returns:

float: The standard deviation of FFcharge_lg minus meanPedLG.

property sigmaPedHG: float#

Calculates and returns the standard deviation of Pedcharge_hg multiplied by the square root of coefCharge_FF_Ped.

Returns:

float: The standard deviation of Pedcharge_hg.

property sigmaPedLG: float#

Calculates and returns the standard deviation of Pedcharge_lg multiplied by the square root of coefCharge_FF_Ped.

Returns:

float: The standard deviation of Pedcharge_lg.