elisa.data.ogip#
- class Data(erange: list | tuple, specfile: str, backfile: str | None = None, respfile: str | None = None, ancrfile: str | None = None, name: str | None = None, group: str | None = None, scale: float | None = None, preserve_data_group: bool = False, spec_poisson: bool | None = None, back_poisson: bool | None = None, ignore_bad: bool = True, keep_channel_info: bool = False, sparse_response: bool = False)[source]#
Bases:
ObservationDataHandle observation data in OGIP standards [1] [2].
Load the observation spectrum, the telescope response and the possible background, and handle the grouping of spectrum and response.
- Parameters:
erange (
list|tuple) – Energy range of interest in keV, e.g.,erange=[(0.5, 2), (5, 200)].specfile (
str) – Spectrum file path. For type II pha file, the row specifier must be given in the end of path, e.g.,specfile='spec.pha2{1}'.backfile (
str|None) – Background file path. Read from the specfile header if None. For type II pha file, the row specifier must be given in the end of path, e.g.,backfile='back.pha2{1}'.respfile (
str|None) – Response file path. Read from the specfile header if None. The path must be given ifRESPFILEis undefined in the header.ancrfile (
str|None) – Ancillary response path. Read from the specfile header if None.
Attributes
area_scaleArea scaling factor of grouped spectrum bins.
back_countsBackground counts of grouped measuring channels.
back_dataThe background data of the observation.
back_errorsUncertainty of background counts of grouped measuring channels.
back_exposureBackground exposure.
back_poissonWhether background data follows Poisson counting statistics.
back_ratioRatio of spectrum to background effective exposure.
ceGrouped net counts per second per keV.
ce_errorsUncertainty of grouped net counts per second per keV.
channelGrouped channel information.
channel_emaxRight edge of the grouped measurement channel energy grid.
channel_emeanGeometric mean of the grouped measurement channel energy grid.
channel_emidMidpoint of the grouped measurement channel energy grid.
channel_eminLeft edge of the grouped measurement channel energy grid.
channel_errorsWidth between left/right edge and geometric mean of channel grid.
channel_widthWidth of the grouped measurement channel energy grid.
erangeEnergy range of interest.
good_qualityFlags indicating which measurement channel to be used.
groupingCurrent grouping flags of the observation data.
has_backWhether the observation has background.
keep_channel_infoWhether to keep channel information when grouping the data.
nameName of the observation data.
net_countsNet counts of grouped measuring channels.
net_errorsUncertainty of net counts of grouped measuring channels.
resp_dataThe response matrix data of the observation.
response_matrixGrouped response matrix.
sparse_matrixGrouped response matrix in sparse representation.
spec_countsSpectrum counts of grouped measuring channels.
spec_dataThe spectrum data of the observation.
spec_errorsUncertainty of grouped spectrum counts.
spec_exposureSpectrum exposure.
spec_poissonWhether spectrum data follows Poisson counting statistics.
Methods
get_fixed_data()Return a fixed data object.
group(method[, scale, preserve_data_group])Group the spectrum.
plot_effective_area([hatch, ylog])Plot the effective area.
plot_matrix([hatch, norm])Plot the response matrix.
plot_spec([xlog, data_ylog, sig_ylog])Plot the spectrum.
set_erange(erange)Set energy range of interest.
set_grouping(grouping)Set grouping flags.
- Parameters:
Notes
Reading and applying correction to data is not yet supported.
References
- class Spectrum(specfile: str, poisson: bool | None = None)[source]#
Bases:
SpectrumDataLoad spectrum data in OGIP standards [1].
- Parameters:
specfile (
str) – Spectrum file path. For type II pha file, the row specifier must be given at the end of path, e.g.,specfile='spec.pha2{1}'.poisson (
bool|None) – Whether the spectrum data follows counting statistics, reading from the specfile header. This value must be set ifPOISSERRis undefined in the header.
Attributes
The ancillary response file path.
area_scalePer-channel area scaling factors.
back_scalePer-channel background scaling factors.
The background file path.
countsSpectrum counts in each measuring channel.
errorsUncertainty of spectrum counts.
exposureSpectrum exposure.
groupingGrouping flags of the spectrum.
The spectrum header.
The name of the observation instrument.
netWhether grouped source scales should follow NET averaging.
poissonWhether spectrum data follows counting statistics.
qualityData quality of each spectrum channel.
The response file path.
The spectrum file path.
Methods
group(grouping[, quality])Group the spectrum.
References
- property header: Header#
The spectrum header.
- class Response(respfile: str, ancrfile: str | None = None, sparse: bool = False)[source]#
Bases:
ResponseDataLoad telescope response data in OGIP standards [1].
- Parameters:
Attributes
The ancillary response file path.
channelMeasurement channel information.
channel_emaxRight edge of measurement energy grid.
channel_eminLeft edge of measurement energy grid.
channel_fwhmEstimated Full Width at Half Maximum (FWHM) in channel energy space.
channel_numberNumber of channels.
channel_typeMeasurement channel type.
fwhmEstimated Full Width at Half Maximum (FWHM) in photon energy space.
matrixResponse matrix.
photon_egridPhoton energy grid of response matrix.
The response file path.
sparseWhether the response matrix is sparse.
sparse_matrixSparse response matrix.
Methods
group(grouping[, quality, keep_channel_info])Group the response matrix.
group_energy(grouping[, quality, ...])Get grouped channels' energy grid information.
plot_effective_area([noticed_range, ...])Plot the response matrix.
plot_matrix([noticed_range, good_quality, norm])Plot the response matrix.
References
- exception PoissonFlagNotFoundError[source]#
Bases:
RuntimeErrorIssued by
POISSERRnot found in spectrum header.