GbmPosHist

class gdt.missions.fermi.gbm.poshist.GbmPosHist[source]

Bases: SpacecraftFrameModelMixin, SpacecraftStatesModelMixin, FitsFileContextManager

Class for reading a GBM Position history file, which contains the spacecraft position, attitude (orientation), velocity, and various state information.

Attributes Summary

filename

The filename

hdulist

The list of Header Data Units

headers

The headers

num_hdus

The number of HDUs

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.

get_column_names(hdu_num)

Get the column names in a HDU.

get_spacecraft_frame()

Retrieve the spacecraft frame information (position, attitude, and

get_spacecraft_states()

Retrieve the spacecraft state information:

merge(poshist1, poshist2)

Merge two GbmPosHist objects into a single object.

open(file_path, **kwargs)

Open a GBM POSHIST FITS file.

set_spacecraft_frame(frame)

Saves the spacecraft frame to the model.

set_spacecraft_states(series)

Saves the spacecraft state to the model.

write(directory[, filename])

Write the file to disk.

Attributes Documentation

filename

The filename

Type:

(str)

hdulist

The list of Header Data Units

Type:

(astropy.io.fits.hdu.HDUList)

headers

The headers

Type:

(FileHeaders)

num_hdus

The number of HDUs

Type:

(int)

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)

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_spacecraft_frame() FermiFrame[source]
Retrieve the spacecraft frame information (position, attitude, and

velocity).

Returns:

(FermiFrame)

get_spacecraft_states() TimeSeries[source]
Retrieve the spacecraft state information:
  • sun: True if the sun is visible (not behind Earth)

  • saa: True if Fermi is inside the GBM definition of the SAA

  • good: True if spacecraft is in a good time interval. For GBM, this

    is essentially the opposite of the saa flag.

Returns:

(astropy.timeseries.TimeSeries)

classmethod merge(poshist1, poshist2)[source]

Merge two GbmPosHist objects into a single object. The typical use case is to merge two consecutive objects into one. The order of input for the files does not matter, and any duplicate time entries will be removed.

Parameters:
  • poshist1 (GbmPosHist) – The first position history object

  • poshist2 (GbmPosHist) – The second position history object

Returns:

(GbmPosHist)

classmethod open(file_path, **kwargs)[source]

Open a GBM POSHIST FITS file.

Parameters:

file_path (str) – The file path of the FITS file

Returns:

(GbmPosHist)

set_spacecraft_frame(frame: SpacecraftFrame)

Saves the spacecraft frame to the model.

Parameters:

frame (SpacecraftFrame) – The object to be saved to the model.

set_spacecraft_states(series: TimeSeries)

Saves the spacecraft state to the model.

Parameters:

series (astropy.timeseries.TimeSeries) – Object containing spacecraft states to be saved to model.

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