BatsePhaiiDiscla¶
- class gdt.missions.cgro.batse.phaii.BatsePhaiiDiscla[source]¶
Bases:
BatsePhaiiThe continuous LAD discriminator data.
Attributes Summary
The total charged particle detector lightcurve
The PHAII data
The BATSE detector(s)
The energy-channel mapping.
Energy calibration data
The energy range of the data.
The filename
The good time intervals
The list of Header Data Units
The headers
The total uncoincidenced lightcurve
The number of energy channels
The number of HDUs
The time range of the data
The trigger time of the data, if available.
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.
from_data(data[, gti, trigger_time, ...])Create a PHAII object from data.
get_column_names(hdu_num)Get the column names in a HDU.
get_exposure([time_ranges])Calculate the total exposure of a time range or time ranges of data.
merge(phaii_list)Merge a list of Phaii objects into a new Phaii object.
open(file_path, **kwargs)Open a BATSE PHAII FITS file and return either a
BatsePhaiiTriggerorBatsePhaiiMultiobject depending on the type of file.rebin_energy(method, *args[, energy_range])Rebin the DISCLA in energy given a rebinning method.
rebin_time(method, *args[, time_range])Rebin the DISCLA in time given a rebinning method.
set_ebounds(ebounds)Set the energy calibration (ebounds) of the data.
slice_energy(energy_ranges)Slice the DISCLA by one or more energy range.
slice_time(time_ranges)Slice the DISCLA by one or more time range.
to_lightcurve([time_range, energy_range, ...])Integrate the PHAII data over energy to produce a lightcurve.
to_pha([time_ranges, energy_range, ...])Integrate the PHAII data over time to produce a PHA object.
to_spectrum([time_range, energy_range, ...])Integrate the PHAII data over time to produce a count spectrum
write(directory[, filename])Write the file to disk.
Attributes Documentation
- cpd_lightcurve¶
The total charged particle detector lightcurve
- Type:
(
TimeBins)
- data¶
The PHAII data
- Type:
(
TimeEnergyBins)
- detector¶
The BATSE detector(s)
- Type:
(
BatseDetector) or list
- ebounds¶
The energy-channel mapping. If data does not have an ebounds, returns None.
- Type:
(
Ebounds)
- ecalib¶
Energy calibration data
- Type:
- energy_range¶
The energy range of the data. If data does not have an ebounds, returns None.
- Type:
(float, float)
- filename¶
The filename
- Type:
(str)
- gti¶
The good time intervals
- Type:
(
Gti)
- hdulist¶
The list of Header Data Units
- Type:
(astropy.io.fits.hdu.HDUList)
- headers¶
The headers
- Type:
- lad_lightcurve¶
The total uncoincidenced lightcurve
- Type:
(
TimeBins)
- num_chans¶
The number of energy channels
- Type:
(int)
- num_hdus¶
The number of HDUs
- Type:
(int)
- time_range¶
The time range of the data
- Type:
(float, float)
- trigtime¶
The trigger time of the data, if available.
- Type:
(float)
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)
- classmethod from_data(data, gti=None, trigger_time=None, filename=None, headers=None, ecalib=None, detector=None, data_lad_tot=None, data_cpd_tot=None)[source]¶
Create a PHAII object from data.
- Parameters:
data (
TimeEnergyBins) – The PHAII datagti (
Gti, optional) – The Good Time Intervals object. If omitted, the GTI spans (tstart, tstop)trigger_time (float, optional) – The trigger time, if applicable. If provided, the data times will be shifted relative to the trigger time.
filename (str, optional) – The name of the file
headers (
FileHeaders) – The file headersdetector (
BatseDetectorsor list) – The BATSE detector(s)ecalib (
BatseEnergyCalib) – The detector calibrationdata_lad_tot (
TimeBins) – The total uncoincidenced lightcurvedata_cpd_tot (
TimeBins) – The total charged particle detector lightcurve
- Returns:
- 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)
- get_exposure(time_ranges=None)¶
Calculate the total exposure of a time range or time ranges of data.
- Parameters:
time_ranges ([(float, float), ...], optional) – The time range or time ranges over which to calculate the exposure. If omitted, calculates the total exposure of the data.
- Returns:
(float)
- classmethod merge(phaii_list)¶
Merge a list of Phaii objects into a new Phaii object. The header from the first Phaii in the list is used in the new Phaii and appropriately updated.
- Parameters:
phaii_list (list) – The list of Phaii objects to merge
- Returns:
(
Phaii)
- classmethod open(file_path, **kwargs)¶
Open a BATSE PHAII FITS file and return either a
BatsePhaiiTriggerorBatsePhaiiMultiobject depending on the type of file.- Parameters:
file_path (str) – The file path of the FITS file
- Returns:
- rebin_energy(method, *args, energy_range=(None, None))[source]¶
Rebin the DISCLA in energy given a rebinning method. Produces a new DISCLA object.
- Parameters:
method (<function>) – The rebinning function
*args – Arguments to be passed to the rebinning function
energy_range ((float, float), optional) – The starting and ending energy to rebin. If omitted, uses the full range of data. Setting start or end to
Nonewill use the data from the beginning or end of the data, respectively.
- Returns
- rebin_time(method, *args, time_range=(None, None))[source]¶
Rebin the DISCLA in time given a rebinning method. Produces a new DISCLA object. This also rebins the associated LAD and CPD lightcurve objects.
- Parameters:
method (<function>) – The rebinning function
*args – Arguments to be passed to the rebinning function
time_range ((float, float), optional) – The starting and ending time to rebin. If omitted, uses the full range of data. Setting start or end to
Nonewill use the data from the beginning or end of the data, respectively.
- Returns
- set_ebounds(ebounds)¶
Set the energy calibration (ebounds) of the data. If the data are not yet energy calibrated, this will convert the data object from
TimeChannelBinstoTimeEnergyBins`. If the data already has an energy calibration, this method will update the calibration to with the new ebounds. The number of channels ineboundsmust equal the number of channels of the data.- Parameters:
ebounds (
Ebounds) – The ebounds
- slice_energy(energy_ranges)[source]¶
Slice the DISCLA by one or more energy range. Produces a new DISCLA object.
- Parameters:
energy_ranges ([(float, float), ...]) – The energy ranges to slice the data to.
- Returns:
- slice_time(time_ranges)[source]¶
Slice the DISCLA by one or more time range. Produces a new DISCLA object. The GTI will be automatically update to match the new time range(s). This also slices the associated LAD and CPD lightcurve objects.
- Parameters:
time_ranges ([(float, float), ...]) – The time ranges to slice the data to.
- Returns:
- to_lightcurve(time_range=None, energy_range=None, channel_range=None)¶
Integrate the PHAII data over energy to produce a lightcurve.
- Note::
If the data has not energy calibration, then
energy_rangeis ignored, and onlychannel_rangeis used.
- Parameters:
time_range ((float, float), optional) – The time range of the lightcurve. If omitted, uses the entire time range of the data.
energy_range ((float, float), optional) – The energy range of the lightcurve. If omitted, uses the entire energy range of the data.
channel_range ((int, int), optional) – The channel range of the lightcurve. If omitted, uses the entire energy range of the data.
- Returns:
(
TimeBins)
- to_pha(time_ranges=None, energy_range=None, channel_range=None, **kwargs)¶
Integrate the PHAII data over time to produce a PHA object.
- Note::
If the data does not have an energy calibration (ebounds), then a PHA object cannot be created and calling this method will raise an exception.
- Parameters:
time_ranges ([(float, float), ...], optional) – The time range of the spectrum. If omitted, uses the entire time range of the data.
energy_range ((float, float), optional) – The energy range of the spectrum. If omitted, uses the entire energy range of the data.
channel_range ((int, int), optional) – The channel range of the spectrum. If omitted, uses the entire energy range of the data.
**kwargs – Options passed to
pha.Pha.from_data()
- Returns:
(
Pha)
- to_spectrum(time_range=None, energy_range=None, channel_range=None)¶
Integrate the PHAII data over time to produce a count spectrum
- Note::
If the data has not energy calibration, then
energy_rangeis ignored, and onlychannel_rangeis used.
- Parameters:
time_range ((float, float), optional) – The time range of the spectrum. If omitted, uses the entire time range of the data.
energy_range ((float, float), optional) – The energy range of the spectrum. If omitted, uses the entire energy range of the data.
channel_range ((int, int), optional) – The channel range of the spectrum. If omitted, uses the entire energy range of the data.
- Returns:
(
EnergyBins)
- write(directory: Union[str, Path], filename: str = None, **kwargs)¶
Write the file to disk.
- Parameters:
directory (str) – The directory to write the file.
filename (str, optional) – The filename. If omitted, attempts to use the
filenameif set.