GbmRsp2¶
- class gdt.missions.fermi.gbm.response.GbmRsp2[source]¶
Bases:
Rsp2Class for GBM multiple-DRM response files.
Attributes Summary
The name of the detector this response is associated with
The energy channel bounds
The filename
The list of Header Data Units
The headers
Number of energy channels
Number of DRMs in the file
Number of photon energy bins
The number of HDUs
The center times of the intervals over which the DRMs are valid
The trigger time, if applicable
The start times of the intervals over which the DRMs are valid
The end times of the intervals over which the DRMs are valid
Methods Summary
close()Close the file
column(hdu_num, col_name)Return a column from an HDU as an array.
columns_as_array(hdu_num, col_names[, dtype])Return a list of columns from an HDU as an array.
drm_index(time_range)Return the indices of the DRMs that cover the requested time range.
extract_drm([index, atime])Extract a single DRM from the Rsp2 object and return a single-DRM
Rspobject.from_rsps(rsp_list[, filename])Create a Rsp2 object from a list of Rsp objects.
get_column_names(hdu_num)Get the column names in a HDU.
interpolate(atime, **kwargs)Interpolate over a multi-DRM object for a given time and return a new single-DRM RSP object.
nearest_drm(atime)Return a single-DRM Rsp object containing the nearest DRM to the requested time.
open(file_path, **kwargs)Read a multiple-DRM response file from disk.
weighted(time_bins[, interpolate])Return a counts-weighted DRM.
write(directory[, filename])Writes a multiple-DRM Rsp2 object to a FITS file.
Attributes Documentation
- detector¶
The name of the detector this response is associated with
- Type:
(str)
- ebounds¶
The energy channel bounds
- Type:
(
Ebounds)
- filename¶
The filename
- Type:
(str)
- hdulist¶
The list of Header Data Units
- Type:
(astropy.io.fits.hdu.HDUList)
- headers¶
The headers
- Type:
- num_chans¶
Number of energy channels
- Type:
(int)
- num_drms¶
Number of DRMs in the file
- Type:
(int)
- num_ebins¶
Number of photon energy bins
- Type:
(int)
- num_hdus¶
The number of HDUs
- Type:
(int)
- tcent¶
The center times of the intervals over which the DRMs are valid
- Type:
(np.array)
- trigtime¶
The trigger time, if applicable
- Type:
(float)
- tstart¶
The start times of the intervals over which the DRMs are valid
- Type:
(np.array)
- tstop¶
The end times of the intervals over which the DRMs are valid
- Type:
(np.array)
Methods Documentation
- close()¶
Close the file
- column(hdu_num: int, col_name: str) array¶
Return a column from an HDU as an array.
- Parameters:
hdu_num (int) – The HDU number
col_name (str) – The name of the column
- Returns:
(np.array)
- columns_as_array(hdu_num: int, col_names: List[str], dtype: dtype = None) array¶
Return a list of columns from an HDU as an array.
- Parameters:
hdu_num (int) – The HDU number
col_names (list of str) – The names of the columns
dtype (np.dtype, optional) – The custom dtype of the output array
- Returns:
(np.array)
- drm_index(time_range)¶
Return the indices of the DRMs that cover the requested time range. If the time range is before (after) the times covered by the DRMs in the RSP2 object, then the first (last) index will be returned.
- Parameters:
time_range (float, float) – The time range
- Returns:
(np.array)
- extract_drm(index=None, atime=None)¶
Extract a single DRM from the Rsp2 object and return a single-DRM
Rspobject. Eitherindexoratimeshould be defined.- Parameters:
index (int, optional) – The DRM index to retrieve.
atime (float, optional) – The time corresponding to a DRM. The nearest DRM to the time will be chosen.
- Returns:
(
Rsp)
- classmethod from_rsps(rsp_list, filename=None)¶
Create a Rsp2 object from a list of Rsp objects.
- Parameters:
rsp_list (list of
Rsp) – The single-DRM responsesfilename (str, optional) – The filename of the object
- Returns:
(
Rsp2)
- get_column_names(hdu_num: int)¶
Get the column names in a HDU. Returns empty if there is no data extension in the HDU.
- Parameters:
hdu_num (int) – The HDU number
- Returns:
(tuple)
- interpolate(atime, **kwargs)¶
Interpolate over a multi-DRM object for a given time and return a new single-DRM RSP object. This function uses scipy.interpolate.interp1d.
If the given time is before (after) the times covered by the DRMs within the RSP object, then the first (last) DRM will be returned.
- Parameters:
atime (float) – The time corresponding to a DRM. The nearest DRM to the time will be chosen.
**kwargs – Keyword arguments to be passed to scipy.interpolate.interp1d
- Returns:
(
Rsp)
- nearest_drm(atime)¶
Return a single-DRM Rsp object containing the nearest DRM to the requested time.
- Parameters:
atime (float) – The requested time
- Returns:
(
Rsp)
- classmethod open(file_path, **kwargs)[source]¶
Read a multiple-DRM response file from disk.
- Parameters:
file_path (str) – The file path
- Returns:
(
GbmRsp2)
- weighted(time_bins, interpolate=False, **kwargs)¶
Return a counts-weighted DRM. For long spectral accumulations, it is often appropriate to weight the responses by the count history. This is done by either selecting the DRM nearest to each time bin or interpolating the DRMs at each time bin, weighting each DRM by the number of counts, summing the weighted DRMs, and normalizing by the total number of counts. A single-DRM Rsp object is returned.
- Parameters:
time_bins (
TimeBins) – Time history count rate (lightcurve) data.interpolate (bool, optional) – Set to True to interpolate at each time bin instead of selecting the nearest DRM to each time bin. Default is False.
**kwargs – Keyword arguments to be passed to scipy.interpolate.interp1d. These will be ignored if
interpolate=False.
- Returns:
(
Rsp)
- write(directory, filename=None, **kwargs)¶
Writes a multiple-DRM Rsp2 object to a FITS file.
This method will not work unless the Rsp class for the responses contained within the Rsp2 has been subclassed and the
Rsp._build_hdulist()defined.- Parameters:
directory (str) – The directory to write the file
filename (str, optional) – If set, will override the standardized name
**kwargs (optional) – keywords passed to
astropy.io.fits.HDUList.write_to()