Detector response
Different matrices that charaterize the response of the instrument. These encode the effective area and the various detector effects seens in the data, and allow to compute the expected counts given a source hypothesis.
- class cosipy.response.PointSourceResponse(*args: Any, **kwargs: Any)[source]
Handles the multi-dimensional matrix that describes the expected response of the instrument for a particular point in the sky.
- Parameters:
axes (
histpy.Axes
) –Binning information for each variable. The following labels are expected:
Ei
: Real energyEm
: Measured energy. OptionalPhi
: Compton angle. Optional.PsiChi
: Location in the Compton Data Space (HEALPix pixel). Optional.SigmaTau
: Electron recoil angle (HEALPix pixel). Optional.Dist
: Distance from first interaction. Optional.
contents (array,
astropy.units.Quantity
orsparse.SparseArray
) – Array containing the differential effective area convolved with wht source exposure.unit (
astropy.units.Unit
, optional) – Physical units, if not specified as part ofcontents
. Units ofarea*time
are expected.
- property photon_energy_axis
Real energy bins (
Ei
).- Return type:
- class cosipy.response.DetectorResponse(*args: Any, **kwargs: Any)[source]
Handles the multi-dimensional matrix that describes the response of the instrument for a particular
SpacecraftFrame
coordinate location.- Parameters:
axes (
histpy.Axes
) –Binning information for each variable. The following labels are expected:
Ei
: Real energyEm
: Measured energyPhi
: Compton angle. Optional.PsiChi
: Location in the Compton Data Space (HEALPix pixel). Optional.SigmaTau
: Electron recoil angle (HEALPix pixel). Optional.Dist
: Distance from first interaction. Optional.
contents (array,
astropy.units.Quantity
orsparse.SparseArray
) – Array containing the differential effective area.unit (
astropy.units.Unit
, optional) – Physical area units, if not specified as part ofcontents
- get_spectral_response(copy=True)[source]
Reduced detector response, projected along the real and measured energy axes only. The Compton Data Space axes are not included.
- Parameters:
copy (bool) – If true, a copy of the cached spectral response will be returned.
- Return type:
- get_effective_area(energy=None, copy=True)[source]
Compute the effective area at a given energy. If no energy is specified, the output is a histogram for the effective area at each energy bin.
- Parameters:
energy (optional,
astropy.units.Quantity
) – Energy/energies at which to interpolate the linearly effective areacopy (bool) – If true, a copy of the cached effective will be returned.
- Return type:
- get_dispersion_matrix()[source]
Compute the energy dispersion matrix, also known as migration matrix. This holds the probability of an event with real energy
Ei
to be reconstructed with an measured energyEm
.- Return type:
- property photon_energy_axis
Real energy bins (
Ei
).- Return type:
- property measured_energy_axis
Measured energy bins (
Em
).- Return type:
- class cosipy.response.FullDetectorResponse(*args: Any, **kwargs: Any)[source]
Handles the multi-dimensional matrix that describes the full all-sky response of the instrument.
You can access the
DetectorResponse
at a given pixel using the[]
operator. Alternatively you can obtain the interpolated reponse usingget_interp_response()
.- classmethod open(filename, Spectrumfile=None, norm='Linear', single_pixel=False, alpha=0, emin=90, emax=10000)[source]
Open a detector response file.
- Parameters:
filename (str,
Path
).rsp) (Path to the response file (.h5 or)
Spectrumfile (str,) –
- path to the input spectrum file used
for the simulation (optional).
- normstr,
type of normalisation : file (then specify also SpectrumFile) ,powerlaw, Mono or Linear
- alphaint,
if the normalisation is “powerlaw”, value of the spectral index.
- single_pixelbool,
True if there is only one pixel and not full-sky.
- emin,emaxfloat
emin/emax used in the simulation source file.
- property is_sparse
- property axes
List of axes.
- Return type:
- property unit
Physical unit of the contents of the detector reponse.
- Return type:
- get_interp_response(coord)[source]
Get the bilinearly interpolated response at a given coordinate location.
- Parameters:
coord (
astropy.coordinates.SkyCoord
) – Coordinate in theSpacecraftFrame
- Return type:
- get_point_source_response(exposure_map=None, coord=None, scatt_map=None)[source]
Convolve the all-sky detector response with exposure for a source at a given sky location.
Provide either a exposure map (aka dweel time map) or a combination of a sky coordinate and a spacecraft attitude map.
- Parameters:
exposure_map (
mhealpy.HealpixMap
) – Effective time spent by the source at each pixel location in spacecraft coordinatescoord (
astropy.coordinates.SkyCoord
) – Source coordinatescatt_map (
SpacecraftAttitudeMap
) – Spacecraft attitude map
- Return type: