elisa.data.grouping#

Methods for grouping spectrum.

group_const(n: int, c: int) tuple[ndarray, bool][source]#

Group data by containing c channels in each group.

Parameters:
nint

Number of channels.

cint

Number of channels in each group.

Returns:
flagndarray

Grouping flag.

success: bool

Whether the scale is met for all grouped channels.

group_min(data: ndarray, n: int) tuple[ndarray, bool][source]#

Group data by containing at least n counts in each channel.

Parameters:
data: array_like

Counts array.

n: int

Minimum number of counts in each channel after grouping.

Returns:
flagndarray

Grouping flag.

success: bool

Whether the scale is met for all grouped channels.

group_opt(fwhm: ndarray, net_counts: ndarray, bin_counts: ndarray | None = None, n: int | None = None) tuple[ndarray, bool][source]#

Optimal binning of the spectrum data [1].

Parameters:
fwhmndarray

FWHM of the channel.

net_countsndarray

Net counts of the channel.

bin_countsndarray, optional

Additional counts to be grouped.

nint, optional

Grouping scale of the bin_counts.

Returns:
flagndarray

Grouping flag.

success: bool

Whether the scale is met for all grouped channels.

References

[1]

Kaastra & Bleeker 2016, A&A 587, A151

significance_lima(n_on: float | ndarray, n_off: float | ndarray, a: float | ndarray) ndarray[source]#

Significance using the formula of Li & Ma 1983.

significance_gv(n: float | ndarray, b: float | ndarray, s: float | ndarray, a: float | ndarray) ndarray[source]#

Significance using the formula of Vianello 2018.

group_optsig_normal(fwhm: ndarray, net_counts: ndarray, counts: ndarray, errors: ndarray, sig: int | float) tuple[ndarray, bool][source]#

Optimal binning with an extra requirement of a minimum significance.

Parameters:
fwhmndarray

FWHM of the channel.

net_countsndarray

Net counts of the channel.

countsndarray

Counts of the channel.

errorsndarray

Uncertainty of the counts.

sigfloat

Significance threshold.

Returns:
flagndarray

Grouping flag.

success: bool

Whether the scale is met for all grouped channels.

group_optsig_lima(fwhm: ndarray, net_counts: ndarray, n_on: ndarray, n_off: ndarray, a: float, sig: int | float) tuple[ndarray, bool][source]#

Optimal binning with an extra requirement of a minimum significance.

Note

The formula of Li & Ma 1983 is used to calculate the significance.

Parameters:
fwhmndarray

FWHM of the channel.

net_countsndarray

Net counts of the channel.

n_onndarray

Counts array of on measurement.

n_offndarray

Counts array of off measurement.

afloat

Ratio of the on and off exposure.

sigint or float

Significance threshold.

Returns:
flagndarray

Grouping flag.

success: bool

Whether the scale is met for all grouped channels.

group_optsig_gv(fwhm: ndarray, net_counts: ndarray, n: ndarray, b: ndarray, s: ndarray, a: float, sig: int | float) tuple[ndarray, bool][source]#

Optimal binning with an extra requirement of a minimum significance.

Note

The formula of Vianello 2018 is used to calculate the significance.

Parameters:
fwhmndarray

FWHM of the channel.

net_countsndarray

Net counts of the channel.

nndarray

Counts array of on measurement.

bndarray

Estimate of background counts.

sndarray

Uncertainty of the background estimate.

afloat

Ratio of the on and off exposure.

sigfloat

Significance threshold.

Returns:
flagndarray

Grouping flag.

success: bool

Whether the scale is met for all grouped channels.

group_sig_normal(count: ndarray, error: ndarray, sig: int | float) tuple[ndarray, bool][source]#

Group data by limiting the significance is greater than sig.

Parameters:
countndarray

Counts array.

errorndarray

Uncertainty of counts.

sigint or float

Significance threshold.

Returns:
flagndarray

Grouping flag.

success: bool

Whether the scale is met for all grouped channels.

group_sig_lima(n_on: ndarray, n_off: ndarray, a: float, sig: float) tuple[ndarray, bool][source]#

Group data by limiting the significance is greater than sig.

Note

The formula of Li & Ma 1983 is used to calculate the significance.

Parameters:
n_onndarray

Counts array of on measurement.

n_offndarray

Counts array of off measurement.

afloat

Ratio of the on and off exposure.

sigint or float

Significance threshold.

Returns:
flagndarray

Grouping flag.

success: bool

Whether the scale is met for all grouped channels.

group_sig_gv(n: ndarray, b: ndarray, s: ndarray, a: float, sig: float) tuple[ndarray, bool][source]#

Group data by limiting the significance is greater than sig.

Note

The formula of Vianello 2018 is used to calculate the significance.

Parameters:
nndarray

Counts array of on measurement.

bndarray

Estimate of background counts.

sndarray

Uncertainty of the background estimate.

afloat

Ratio of the on and off exposure.

sigfloat

Significance threshold.

Returns:
flagndarray

Grouping flag.

success: bool

Whether the scale is met for all grouped channels.