Trigdat¶
- class gdt.missions.gifts.trigdat.Trigdat[source]¶
Bases:
TrigdatClass for the GIFTS Trigger Data
Attributes Summary
A BackRates object containing the info from the on-board background estimate
The filename
A list of flight-software-determined locations for the trigger
The Good Time Intervals
The list of Header Data Units
The headers
A list of MaxRates objects, each containing maxrates info
The number of HDUs
The number of MaxRates issued by the flight software
The position/attitude history
The time range of the data
The detectors that were triggered
The trigger information and rates
The trigger time
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(phaii_list, poshist, trigtime, ...)Create a Trigdat object from a list of GiftsPhaii objects and a SpacecraftFrame object.
get_column_names(hdu_num)Get the column names in a HDU.
open(file_path, **kwargs)Open and read a Trigdat file
sum_detectors(detectors[, timescale])Sum the data from a list of detectors and convert to a GiftsPhaii object.
to_phaii(detector[, timescale])Convert the data for a detector to a
GiftsPhaiiobject.write(directory[, filename])Write the file to disk.
Attributes Documentation
- backrates¶
A BackRates object containing the info from the on-board background estimate
- Type:
- filename¶
The filename
- Type:
(str)
- fsw_locations¶
A list of flight-software-determined locations for the trigger
- Type:
(list of
FswLocation)
- hdulist¶
The list of Header Data Units
- Type:
(astropy.io.fits.hdu.HDUList)
- headers¶
The headers
- Type:
- num_hdus¶
The number of HDUs
- Type:
(int)
- num_maxrates¶
The number of MaxRates issued by the flight software
- Type:
(int)
- poshist¶
The position/attitude history
- Type:
(
GbmPosHist)
- triggered_detectors¶
The detectors that were triggered
- Type:
(list of str)
- trigtime¶
The trigger time
- 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(phaii_list, poshist, trigtime, det_mask, time_range=None, trigrate=None, maxrates=None, backrates=None, fswlocations=None, filename=None, headers=None)[source]¶
Create a Trigdat object from a list of GiftsPhaii objects and a SpacecraftFrame object.
Note
The list of PHAIIs does not need to include every detector, as missing detectors will be assumed to have zero rates. However, do not include more than one file from the same detector in the list. The PHAII list can be in any order.
- Parameters:
phaii_list (list of
GiftsPhaii) – A list of GiftsPhaii objectsposhist (
SpacecraftFrame) – The spacecraft frametrigtime (float) – The trigger time
det_mask (np.ndarray) – Triggered detector mask
time_range (tuple, optional) – The time range of the Trigdat. If not specified, uses the time range of the GiftsPhaiis
trigrate (
MaxRates, optional) – The trigger rates objectmaxrates (list of
MaxRates, optional) – The maxrates objectsbackrates (
BackRates, optional) – The background rates objectfswlocations (list of
FswLocation, optional) – The flight software location objects
- Returns:
(
Trigdat)
- 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)
- classmethod open(file_path, **kwargs)[source]¶
Open and read a Trigdat file
- Parameters:
file_path (str) – The file path of the trigdat file
- Returns:
(
Trigdat)
- sum_detectors(detectors, timescale=1024)[source]¶
Sum the data from a list of detectors and convert to a GiftsPhaii object. The exposures from different detectors are averaged.
- Parameters:
detectors (list of str) – The detectors to sum
timescale (int, optional) – The minimum timescale in ms of the data to return. Available options are 1024, 256, and 64.
- Returns:
- to_phaii(detector, timescale=1024)[source]¶
Convert the data for a detector to a
GiftsPhaiiobject.Note
A standard Trigdat will contain data on 8192, 1024, 256, and 62 ms timescales. A non-standard Trigdat can be created from other data types (see
Trigdat.from_data()) and therefore the timescales will likely be different and arbitrary. For that reason, thetimescalekeyword will be ignored for non-standard Trigdat.- Parameters:
detector (str) – The detector to convert
timescale (int, optional) – The minimum timescale in ms of the data to return. Available options are 1024, 256, and 64. This is ignored if the trigdat has non-standard timescales.
- Returns:
- write(directory: 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.