threeML.utils.OGIP package¶
Submodules¶
threeML.utils.OGIP.pha module¶
-
class
threeML.utils.OGIP.pha.
PHAII
(instrument_name, telescope_name, tstart, telapse, channel, rate, quality, grouping, exposure, backscale, respfile, ancrfile, back_file=None, sys_err=None, stat_err=None, is_poisson=False)[source]¶ Bases:
threeML.io.fits_file.FITSFile
-
property
instrument
¶
-
property
-
class
threeML.utils.OGIP.pha.
PHAWrite
(*ogiplike)[source]¶ Bases:
object
-
write
(outfile_name, overwrite=True, force_rsp_write=False)[source]¶ Write a PHA Type II and BAK file for the given OGIP plugin. Automatically determines if BAK files should be generated.
- Parameters
outfile_name – string (excluding .pha) of the PHA to write
overwrite – (optional) bool to overwrite existing file
force_rsp_write – force the writing of an RSP
- Returns
-
threeML.utils.OGIP.response module¶
-
class
threeML.utils.OGIP.response.
InstrumentResponse
(matrix, ebounds, monte_carlo_energies, coverage_interval=None)[source]¶ Bases:
object
-
property
arf_filename
¶ Returns the name of the ARF file (or None if there is none)
-
property
coverage_interval
¶ Returns the time interval that this matrix is applicable to. None if it wasn’t defined and the matrix is applicable everywhere
- Return time_interval
the time interval
:type time_interval : TimeInterval
-
classmethod
create_dummy_response
(ebounds, monte_carlo_energies)[source]¶ Creates a dummy identity response of the shape of the ebounds and mc energies
- Parameters
ebounds – the energy boundaries of the detector channels (size n_channels + 1)
monte_carlo_energies – the energy boundaries of the monte carlo channels (size n_mc_energies + 1)
- Returns
InstrumentResponse
-
property
ebounds
¶ Returns the ebounds of the RSP.
- Returns
-
energy_to_channel
(energy)[source]¶ Finds the channel containing the provided energy. NOTE: returns the channel index (starting at zero), not the channel number (likely starting from 1).
If you ask for a energy lower than the minimum ebounds, 0 will be returned If you ask for a energy higher than the maximum ebounds, the last channel index will be returned
-
property
first_channel
¶
-
property
matrix
¶ Return the matrix representing the response
- Return matrix
response matrix
-
property
monte_carlo_energies
¶ Returns the boundaries of the Monte Carlo bins (true energy bins)
- Returns
array
-
replace_matrix
(new_matrix)[source]¶ Replace the read matrix with a new one of the same shape
- Returns
none
-
property
rsp_filename
¶ Returns the name of the RSP/RMF file from which the response has been loaded
-
set_function
(integral_function=None)[source]¶ Set the function to be used for the convolution
- Parameters
integral_function (callable) – a function f = f(e1,e2) which returns the integral of the model between e1 and e2
-
to_fits
(filename, telescope_name, instrument_name, overwrite=False)[source]¶ Write the current matrix into a OGIP FITS file
:param filename : the name of the FITS file to be created :type filename : str :param telescope_name : a name for the telescope/experiment which this matrix applies to :param instrument_name : a name for the instrument which this matrix applies to :param overwrite: True or False, whether to overwrite or not the output file :return: None
-
property
-
class
threeML.utils.OGIP.response.
InstrumentResponseSet
(matrix_list, exposure_getter, counts_getter, reference_time=0.0)[source]¶ Bases:
object
A set of responses
-
property
ebounds
¶
-
classmethod
from_rsp2_file
(rsp2_file, exposure_getter, counts_getter, reference_time=0.0, half_shifted=True)[source]¶
-
property
monte_carlo_energies
¶
-
property
reference_time
¶
-
property
-
class
threeML.utils.OGIP.response.
MATRIX
(mc_energies, channel_energies, matrix)[source]¶ Bases:
threeML.io.fits_file.FITSExtension
Represents the MATRIX extension of a response FITS file following the OGIP format
- Parameters
mc_energies_lo – lower bound of MC energies (in keV)
mc_energies_hi – hi bound of MC energies (in keV)
channel_energies_lo – lower bound of channel energies (in keV)
channel_energies_hi – hi bound of channel energies (in keV
matrix – the redistribution matrix, representing energy dispersion effects
-
class
threeML.utils.OGIP.response.
OGIPResponse
(rsp_file, arf_file=None)[source]¶ Bases:
threeML.utils.OGIP.response.InstrumentResponse
-
property
arf_filename
¶ Returns the name of the ARF file (or None if there is none)
-
property
first_channel
¶ The first channel of the channel array. Corresponds to TLMIN keyword in FITS files
- Returns
first channel
-
property
rsp_filename
¶ Returns the name of the RSP/RMF file from which the response has been loaded
-
property
-
class
threeML.utils.OGIP.response.
RMF
(mc_energies, ebounds, matrix, telescope_name, instrument_name)[source]¶ Bases:
threeML.io.fits_file.FITSFile
A RMF file, the OGIP format for a matrix representing energy dispersion effects.
-
class
threeML.utils.OGIP.response.
RSP
(mc_energies, ebounds, matrix, telescope_name, instrument_name)[source]¶ Bases:
threeML.io.fits_file.FITSFile
A response file, the OGIP format for a matrix representing both energy dispersion effects and effective area, in the same matrix.
-
class
threeML.utils.OGIP.response.
SPECRESP_MATRIX
(mc_energies, channel_energies, matrix)[source]¶ Bases:
threeML.utils.OGIP.response.MATRIX
Represents the SPECRESP_MATRIX extension of a response FITS file following the OGIP format
- Parameters
mc_energies_lo – lower bound of MC energies (in keV)
mc_energies_hi – hi bound of MC energies (in keV)
channel_energies_lo – lower bound of channel energies (in keV)
channel_energies_hi – hi bound of channel energies (in keV
matrix – the redistribution matrix, representing energy dispersion effects and effective area information