threeML.utils.spectrum.pha_spectrum module

class threeML.utils.spectrum.pha_spectrum.PHASpectrum(pha_file_or_instance: str | Path | PHAII | FITSFile, spectrum_number: int | None = None, file_type: str = 'observed', rsp_file: str | InstrumentResponse | None = None, arf_file: str | None = None)[source]

Bases: BinnedSpectrumWithDispersion

property ancillary_file: str | None

Returns the ancillary file definied in the header, or None if there is none defined

Returns:

a path to a file, or None

property background_file: None | str

Returns the background file definied in the header, or None if there is none defined p

return:

a path to a file, or None

clone(new_counts=None, new_count_errors=None, new_exposure=None, new_scale_factor=None) PHASpectrum[source]

make a new spectrum with new counts and errors and all other parameters the same

Parameters:
  • new_exposure – the new exposure for the clone

  • new_scale_factor – the new scale factor for the clone

  • new_counts – new counts for the spectrum

  • new_count_errors – new errors from the spectrum

Returns:

new pha spectrum

property filename: str
classmethod from_dispersion_spectrum()[source]
property grouping: ndarray
property response_file: str | None

Returns the response file definied in the header, or None if there is none defined

Returns:

a path to a file, or None

property scale_factor: float

This is a scale factor (in the BACKSCAL keyword) which must be used to rescale background and source regions

Returns:

set_ogip_grouping(grouping) None[source]

If the counts are rebinned, this updates the grouping :param grouping:

to_binned_spectrum() BinnedSpectrumWithDispersion[source]

Convert directly to as Binned Spectrum :returns:

class threeML.utils.spectrum.pha_spectrum.PHASpectrumSet(pha_file_or_instance: str | Path | PHAII, file_type: str = 'observed', rsp_file: str | None = None, arf_file: str | None = None)[source]

Bases: BinnedSpectrumSet

property ancillary_file

Returns the ancillary file definied in the header, or None if there is none defined

Returns:

a path to a file, or None

property background_file

Returns the background file definied in the header, or None if there is none defined p

return:

a path to a file, or None

clone(new_counts=None, new_count_errors=None)[source]

make a new spectrum with new counts and errors and all other parameters the same

Parameters:
  • new_counts – new counts for the spectrum

  • new_count_errors – new errors from the spectrum

Returns:

new pha spectrum

property filename
classmethod from_dispersion_spectrum(dispersion_spectrum: BinnedSpectrumWithDispersion, file_type: str = 'observed') PHASpectrum[source]
property grouping
property response_file

Returns the response file definied in the header, or None if there is none defined

Returns:

a path to a file, or None

property scale_factor

This is a scale factor (in the BACKSCAL keyword) which must be used to rescale background and source regions

Returns:

set_ogip_grouping(grouping)[source]

If the counts are rebinned, this updates the grouping :param grouping: