GBM Spectral Catalog Files¶
GBM provides standard spectral fits for each GRB triggered on-board. These spectral fits are hosted in FITS format at HEASARC as “SCat” (Spectral Catalog) files. The SCat files contain the spectral fit data, including fit parameters, uncertainties, fluxes/fluences, fit statistic, covariance. The files also contain metadata about the detectors and data that were used in the fit. All of this information can be easily accessed using the Scat
class.
We can read a SCat FITS file via the normal method in the Data Tools:
[1]:
from gbm import test_data_dir
# import the Scat class
from gbm.data import Scat
# read a SCat file
scat = Scat.open(test_data_dir+'/glg_scat_all_bn170817529_flnc_comp_v02.fit')
print(scat)
glg_scat_all_bn170817529_flnc_comp_v02.fit
You can quickly determine the number of detectors used in the spectral fit(s) and the number of spectral fits provided in the file:
[2]:
print('Number of detectors used: {}'.format(scat.num_detectors))
print('Number of spectral fits: {}'.format(scat.num_fits))
Number of detectors used: 4
Number of spectral fits: 1
You can acces the list of model fits by:
[3]:
scat.model_fits
[3]:
[<gbm.data.scat.GbmModelFit at 0x1270f0f90>]
The GbmModelFit
class contains the all of the relevant info for a fit. Let’s look at a few properties contained in this class:
[4]:
one_fit = scat.model_fits[0]
print('Fit time range: {0} - {1}'.format(*one_fit.time_range))
print('Fit Statistic: {}'.format(one_fit.stat_name))
print('Stat/DoF: {0:.2f}/{1}'.format(one_fit.stat_value, one_fit.dof))
print('Model name: {}'.format(one_fit.name))
print('Parameter names: {}'.format(one_fit.parameter_list()))
Fit time range: -0.192 - 0.064
Fit Statistic: Castor C-STAT
Stat/DoF: 479.62/479
Model name: Comptonized, Epeak
Parameter names: ['Amplitude', 'Epeak', 'Index', 'Pivot E =fix']
For the actual fit data, they are stored as Parameter
objects, which group together the fit value, uncertainty, and metadata such as the parameter name and units. If you want to quickly see the fit information, you can simply print the GbmModelFit
object:
[5]:
print(one_fit)
Comptonized, Epeak
Amplitude: 0.03 +/- 0.02
Epeak: 215.09 +/- 54.22
Index: 0.14 +/- 0.59
Pivot E =fix: 1.00e+02 +/- 0.00e+00
Otherwise, you can directly access the parameter fit info by attributes and methods of the Parameter
class:
[6]:
epeak = one_fit.parameters[1]
print('Name: {}'.format(epeak.name))
print('Value: {}'.format(epeak.value))
print('1-sigma uncert: {}'.format(epeak.uncertainty))
print('1-sigma range: {}'.format(epeak.one_sigma_range()))
Name: Epeak
Value: 215.09434509277344
1-sigma uncert: (54.219116, 54.219116)
1-sigma range: (160.87522888183594, 269.31346130371094)
For each fit, the photon and energy fluxes and fluences are also recorded, and those are stored as special Parameter
objects as well:
[7]:
print(one_fit.photon_flux)
print(one_fit.energy_fluence)
Photon Flux: 2.81 +/- 0.44 ph/cm^2/s
Energy Fluence: 1.40e-07 +/- 3.03e-08 erg/cm^2
As for the detector metadata used in the fits, they are stored in DetectorData
objects:
[8]:
print(scat.detectors)
[<gbm.data.scat.DetectorData object at 0x12709f950>, <gbm.data.scat.DetectorData object at 0x12709fd50>, <gbm.data.scat.DetectorData object at 0x1270e4890>, <gbm.data.scat.DetectorData object at 0x1270e4850>]
You can access various properties stored in these objects:
[9]:
for det in scat.detectors:
print('{0}: energy range: {1} keV, # channel range: {2}'.format(det.detector, det.energy_range, det.channel_range))
BGO_00: energy range: (284.65, 40108.0) keV, # channel range: (3, 124)
NAI_01: energy range: (8.501, 903.45) keV, # channel range: (5, 124)
NAI_02: energy range: (9.119, 902.57) keV, # channel range: (5, 124)
NAI_05: energy range: (8.698, 909.58) keV, # channel range: (5, 124)
For each detector, the deconvolved photon counts, errors, and detector-convolved photon model are stored as well. These can be used for making the model count rate plots. For example:
[10]:
# convolved photon model counts for detector n1
scat.detectors[1].photon_model
[10]:
array([1.96157284e-02, 1.99605655e-02, 2.02203058e-02, 2.04198491e-02,
2.05748081e-02, 2.06954200e-02, 2.07886994e-02, 2.08651833e-02,
2.09236853e-02, 2.09595580e-02, 2.09755581e-02, 2.09734701e-02,
2.09545959e-02, 2.09202804e-02, 2.08671484e-02, 2.07942519e-02,
2.07068976e-02, 2.06062403e-02, 2.04924233e-02, 2.03650203e-02,
2.02121083e-02, 2.00296603e-02, 1.98248476e-02, 1.96060352e-02,
1.94124747e-02, 1.92341618e-02, 1.90395378e-02, 1.88379139e-02,
1.86298881e-02, 1.84038971e-02, 1.81599278e-02, 1.79103129e-02,
1.76558699e-02, 1.73842870e-02, 1.70959160e-02, 1.68044139e-02,
1.65107511e-02, 1.62022281e-02, 1.58796720e-02, 1.55573804e-02,
1.52229378e-02, 1.48775103e-02, 1.45354364e-02, 1.41847273e-02,
1.38267530e-02, 1.34753715e-02, 1.31187867e-02, 1.27577381e-02,
1.24046309e-02, 1.20481234e-02, 1.16888676e-02, 1.13384118e-02,
1.09861176e-02, 1.06325680e-02, 1.02785071e-02, 9.92442667e-03,
9.57103912e-03, 9.21891443e-03, 8.86891689e-03, 8.52157827e-03,
8.18584766e-03, 7.85366166e-03, 7.52549898e-03, 7.20197801e-03,
6.87657017e-03, 6.55738916e-03, 6.24498492e-03, 5.93968714e-03,
5.64196613e-03, 5.35207335e-03, 5.07042184e-03, 4.79209516e-03,
4.52288752e-03, 4.26308904e-03, 4.00841329e-03, 3.76371294e-03,
3.52911279e-03, 3.30090406e-03, 3.07974149e-03, 2.86927028e-03,
2.66939658e-03, 2.47712969e-03, 2.29281047e-03, 2.11906387e-03,
1.95566076e-03, 1.80015434e-03, 1.65265775e-03, 1.51324435e-03,
1.38190738e-03, 1.25858490e-03, 1.14318531e-03, 1.03555166e-03,
9.35497112e-04, 8.42794776e-04, 7.57185626e-04, 6.78389741e-04,
6.06101414e-04, 5.39377157e-04, 4.78061469e-04, 4.22516343e-04,
3.72365321e-04, 3.27230984e-04, 2.86408875e-04, 2.49648612e-04,
2.16978922e-04, 1.87817757e-04, 1.61900462e-04, 1.38990174e-04,
1.18824362e-04, 1.01168524e-04, 8.57760242e-05, 7.24279816e-05,
6.08285809e-05, 5.08733683e-05, 4.23745478e-05, 3.51066883e-05,
2.89300351e-05, 2.37133027e-05, 1.93576161e-05, 1.57395298e-05,
1.27308667e-05, 1.02440299e-05, 8.20066271e-06, 6.52375820e-06,
5.15691772e-06, 3.84230407e-06, 2.66911161e-06, 3.89260578e-07],
dtype=float32)
This finishes the brief intro to the Scat
class. Onwards to simulations!