Trigdat

class gdt.missions.gifts.trigdat.Trigdat[source]

Bases: Trigdat

Class for the GIFTS Trigger Data

Attributes Summary

backrates

A BackRates object containing the info from the on-board background estimate

filename

The filename

fsw_locations

A list of flight-software-determined locations for the trigger

gti

The Good Time Intervals

hdulist

The list of Header Data Units

headers

The headers

maxrates

A list of MaxRates objects, each containing maxrates info

num_hdus

The number of HDUs

num_maxrates

The number of MaxRates issued by the flight software

poshist

The position/attitude history

time_range

The time range of the data

triggered_detectors

The detectors that were triggered

trigrates

The trigger information and rates

trigtime

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 GiftsPhaii object.

write(directory[, filename])

Write the file to disk.

Attributes Documentation

backrates

A BackRates object containing the info from the on-board background estimate

Type:

(BackRates)

filename

The filename

Type:

(str)

fsw_locations

A list of flight-software-determined locations for the trigger

Type:

(list of FswLocation)

gti

The Good Time Intervals

Type:

(Gti)

hdulist

The list of Header Data Units

Type:

(astropy.io.fits.hdu.HDUList)

headers

The headers

Type:

(FileHeaders)

maxrates

A list of MaxRates objects, each containing maxrates info

Type:

(list of MaxRates)

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)

time_range

The time range of the data

Type:

(TimeRange)

triggered_detectors

The detectors that were triggered

Type:

(list of str)

trigrates

The trigger information and rates

Type:

(MaxRates)

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 objects

  • poshist (SpacecraftFrame) – The spacecraft frame

  • trigtime (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 object

  • maxrates (list of MaxRates, optional) – The maxrates objects

  • backrates (BackRates, optional) – The background rates object

  • fswlocations (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:

(GiftsPhaii)

to_phaii(detector, timescale=1024)[source]

Convert the data for a detector to a GiftsPhaii object.

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, the timescale keyword 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:

(GiftsPhaii)

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 filename if set.