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:
- n
int Number of channels.
- c
int Number of channels in each group.
- Returns:
- flag
ndarray 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:
- flag
ndarray 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:
- fwhm
ndarray FWHM of the channel.
- net_counts
ndarray Net counts of the channel.
- bin_counts
ndarray, optional Additional counts to be grouped.
- n
int, optional Grouping scale of the bin_counts.
- Returns:
- flag
ndarray 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:
- fwhm
ndarray FWHM of the channel.
- net_counts
ndarray Net counts of the channel.
- counts
ndarray Counts of the channel.
- errors
ndarray Uncertainty of the counts.
- sig
float Significance threshold.
- Returns:
- flag
ndarray 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:
- fwhm
ndarray FWHM of the channel.
- net_counts
ndarray Net counts of the channel.
- n_on
ndarray Counts array of on measurement.
- n_off
ndarray Counts array of off measurement.
- a
float Ratio of the on and off exposure.
- sig
int or float Significance threshold.
- Returns:
- flag
ndarray 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:
- fwhm
ndarray FWHM of the channel.
- net_counts
ndarray Net counts of the channel.
- n
ndarray Counts array of on measurement.
- b
ndarray Estimate of background counts.
- s
ndarray Uncertainty of the background estimate.
- a
float Ratio of the on and off exposure.
- sig
float Significance threshold.
- Returns:
- flag
ndarray 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:
- count
ndarray Counts array.
- error
ndarray Uncertainty of counts.
- sig
int or float Significance threshold.
- Returns:
- flag
ndarray 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_on
ndarray Counts array of on measurement.
- n_off
ndarray Counts array of off measurement.
- a
float Ratio of the on and off exposure.
- sig
int or float Significance threshold.
- Returns:
- flag
ndarray 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:
- n
ndarray Counts array of on measurement.
- b
ndarray Estimate of background counts.
- s
ndarray Uncertainty of the background estimate.
- a
float Ratio of the on and off exposure.
- sig
float Significance threshold.
- Returns:
- flag
ndarray Grouping flag.
- success: bool
Whether the scale is met for all grouped channels.