Scat

class gdt.missions.fermi.gbm.scat.Scat[source]

Bases: FitsFileContextManager

A container class for the spectral fit data in an SCAT (Spectroscopy CATalog) file.

Attributes Summary

detectors

The GbmDetectorData objects used in the analysis

filename

The filename

hdulist

The list of Header Data Units

headers

The headers

model_fits

The GbmModelFit objects, one for each model fit

num_detectors

The number of detectors in the SCAT file

num_fits

The number of model fits

num_hdus

The number of HDUs

Methods Summary

add_detector_data(detector_data)

Add a new detector to the Scat

add_model_fit(model_fit)

Add a new model fit to the Scat

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(detector_list, model_fits[, ...])

Create a Scat object from data.

get_column_names(hdu_num)

Get the column names in a HDU.

open(file_path, **kwargs)

Open a SCAT FITS file and create a Scat object.

write(directory[, filename])

Write the file to disk.

Attributes Documentation

detectors

The GbmDetectorData objects used in the analysis

Type:

(list)

filename

The filename

Type:

(str)

hdulist

The list of Header Data Units

Type:

(astropy.io.fits.hdu.HDUList)

headers

The headers

Type:

(FileHeaders)

model_fits

The GbmModelFit objects, one for each model fit

Type:

(list)

num_detectors

The number of detectors in the SCAT file

Type:

(int)

num_fits

The number of model fits

Type:

(int)

num_hdus

The number of HDUs

Type:

(int)

Methods Documentation

add_detector_data(detector_data)[source]

Add a new detector to the Scat

Parameters:

detector_data (GbmDetectorData) – The detector data

add_model_fit(model_fit)[source]

Add a new model fit to the Scat

Parameters:

model_fit (GbmModelFit) – The model fit data

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(detector_list, model_fits, headers=None, filename=None)[source]

Create a Scat object from data.

Parameters:
  • detector_list (list of GbmDetectorData) – The detector info used in the fit

  • model_fits (list of GbmModelFit) – The model fits

  • headers (ScatHeaders, optional) – The file headers

  • filename (str, optional) – The filename

Returns:

(Scat)

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 a SCAT FITS file and create a Scat object.

Parameters:

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

Returns:

(Scat)

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.