Title: GRB tutorial
1GRB tutorial
- Spectral analysis of the
- LAT and GBM data
2All the software you need
- https//confluence.slac.stanford.edu/display/DC2/D
C2codereleases
3The tools I used
- gtselect
- Select the ROI containing the bursts, in time, ra
and dec - gtbin
- Bin the LAT data in time -gt obtain the light
curve - Bin the LAT data in RA,DEC -gtObtaining a count
map - Bin the GBM and LAT data in energy -gt obtaining a
spectrum PHA1 files - Bin the GBM and LAT data in time and energy-gtPHA2
files - gtrspgen
- Compute the response for the LAT
- gtlikelihood
- Unbinned spectral analysis
- DataServer
- Hyppodraw, fv, ds9
- visualization of LC and CMAP
- Python as scripting tool
- Xspec for performing the spectral analysis
4Getting the data at http//glast.gsfc.nasa.gov/ssc
/dev/databases/DC2/
5The files you need
- LAT livetime history (DC2_FT2.fits)
- ftp//heasarc.gsfc.nasa.gov/FTP/glast/DC2/misc_dat
a/DC2_FT2.fits - LAT photon data (all sky, first week)
(LAT_allsky_220838401.126_V01.fits) - ftp//heasarc.gsfc.nasa.gov/FTP/glast/DC2/allsky/L
AT_allsky_220838401.126_V01.fits - GRB080104514 GBM files
- ftp//heasarc.gsfc.nasa.gov/FTP/glast/DC2/burst/GR
B080104514.tar.gz
6Un-packaging the GBM files
dhcpvisitor216193/GLAST/GRB080104514 omodei
l -rw-r--r-- 1 omodei omodei 23040 Feb 23
0855 GLG_BCK_B0_BN080104514_V01.BAK -rw-r--r--
1 omodei omodei 106560 Feb 23 0855
GLG_CSPEC_B0_BN080104514_V01.RSP -rw-r--r-- 1
omodei omodei 1900800 Feb 23 0855
GLG_CTIME_B0_BN080104514_V01.FIT -rw-r--r-- 1
omodei omodei 20275200 Feb 23 0842
GLG_CTIME_N0_080104514_V01.FIT -rw-r--r-- 1
omodei omodei 591 Feb 23 0852
GLG_NOTICE_080104514.TXT -rw-r--r-- 1 omodei
omodei 380160 Feb 23 0855 GLG_TTE_B0_BN0801045
14_V01.FIT -rw-r--r-- 1 omodei omodei
377280 Feb 23 0855 GLG_TTE_B1_BN080104514_V01.FIT
-rw-r--r-- 1 omodei omodei 164160 Feb 23
0852 GLG_TTE_N0_BN080104514_V01.FIT -rw-r--r--
1 omodei omodei 161280 Feb 23 0852
GLG_TTE_N1_BN080104514_V01.FIT -rw-r--r-- 1
omodei omodei 141120 Feb 23 0852
GLG_TTE_N2_BN080104514_V01.FIT -rw-r--r-- 1
omodei omodei 146880 Feb 23 0852
GLG_TTE_N3_BN080104514_V01.FIT -rw-r--r-- 1
omodei omodei 161280 Feb 23 0852
GLG_TTE_N6_BN080104514_V01.FIT -rw-r--r-- 1
omodei omodei 129600 Feb 23 0852
GLG_TTE_N7_BN080104514_V01.FIT -rw-r--r-- 1
omodei omodei 158400 Feb 23 0852
GLG_TTE_N9_BN080104514_V01.FIT -rw-r--r-- 1
omodei omodei 135360 Feb 23 0852
GLG_TTE_NB_BN080104514_V01.FIT
7GCN-like notices GLG_NOTICE_080104514.TXT
- In DC2 we know (approximately) the position of
the burst (GLG_NOTICE) - GRB can be displaced statistically and
systematically
- GLAST BURST MONITOR BURST NOTIFICATION
-
- BURST Name
GRB080104514 - BURST Date 080104
- BURST Time (Sec of Day) 44414.0
- BURST RA (Deg) 59.3413
- BURST DEC (Deg) 14.3453
- BURST LOC ERR (Deg 1 sigma) 2.29264
- Standard Intensity (cts/sec) 697.885
- (Standard Intensity is an angle-adjusted measure
of the peak count rates in 2 NaI detectors
closest t - o the source)
- Closest detectors N0 N6 B0
8Quick look at the data hippodraw
Open the LAT_allsky_220838401.126_V01.fits Select
EVENT extension Do a color plot RA vs DEC Set the
axis bin width as you prefer (1 deg in the fig.)
9Add a cut on TIME, reset the bin width (axis)
10Ra 57 Dec 14
Tmin 221142007 Tmax 221142060
11GBM and LAT light curve
- Lightcurves curves at LAT energy and GBM energy
are different, as predicted from the model - This imply a spectral evolution!
12Trick 2 open the header file of the TTE data!
131. Selecting the data
- dhcpvisitor216193/GLAST/GRB080104514 omodei
gtselect - Input FT1 file ../DC2/LAT_allsky_220838401.12
6_V01.fits - Output FT1 file GRB080104514_select.fits
- RA for new search center (degrees) lt0 - 360gt
59.34 - Dec for new search center (degrees) lt-90 - 90gt
14.35 - radius of new search region (degrees) lt0 - 180gt
20 - start time (MET in s) 221142007
- end time (MET in s) 221142060
- lower energy limit (MeV) 30
- upper energy limit (MeV) 300000
- Event classes (-1all, 0FrontA, 1BackA,
2FrontB, 3BackB, 4class A) lt-1 - 4gt -1
There was a bug (in ST v6r4p1) related to
insufficient precision of MET. (Resulting in
empty files) Resolved in dataSubselector version
v4r1p5 Alternatively
14(No Transcript)
15(No Transcript)
16It is useful to rename the file!
(GRB080104514_select.fits)
172. Binning the LAT data in spatial coordinates
CMAP
dhcpvisitor216193/GLAST/GRB080104514 omodei
gtbin This is gtbin version v0r16p3 Type of
output file ltCMAPLCPHA1PHA2gt CMAP Event
data file name GRB080104514_select.fits Outpu
t file name GRB080104514_lat.cmap Spacecraft
data file name ../DC2/DC2_FT2.fits Size of
the X axis in pixels 360 Size of the Y axis
in pixels 180 Image scale (in
degrees/pixel) 1 Coordinate system (CEL -
celestial, GAL -galactic) ltCELGALgt GAL
First coordinate of image center in degrees (RA
or galactic l) 0 Second coordinate of image
center in degrees (DEC or galactic b) 0
Rotation angle of image axis, in degrees 0
ds9 -bin factor 0.5 0.5 -cmap b -scale sqrt
"GRB080104514_select.fitsbinRA,DEC"
183. Binning the LAT data in time
- Obtaining the LAT light curve
- dhcpvisitor216193/GLAST/GRB080104514 omodei
gtbin - This is gtbin version v0r16p3
- Type of output file ltCMAPLCPHA1PHA2gt PHA1
LC - Event data file name GRB080104514_select.fits
- Output file name GRB080104514_lat.lc
- Spacecraft data file name ../DC2/DC2_FT2.fits
- Algorithm for defining time bins ltFILELINSNRgt
LIN - Start value for first time bin 221142007
- Stop value for last time bin 221142060
- Width of linearly uniform time bins 0.1
193. Binning the LAT data in energy
Obtaining a spectrum (PHA1) file
- dhcpvisitor216193/GLAST/GRB080104514 omodei
gtbin - This is gtbin version v0r16p3
- Type of output file ltCMAPLCPHA1PHA2gt PHA1
- Event data file name GRB080104514_select.fits
- Output file name GRB080104514_lat.pha
- Spacecraft data file name ../DC2/DC2_FT2.fits
- Algorithm for defining energy bins ltFILELINLOGgt
LIN LOG - Start value for first energy bin 30
- Stop value for last energy bin 300000
- Number of logarithmically uniform energy bins
15
gtbin evfileGRB080104514_select.fits
scfile../DC2/DC2_FT2.fits outfileGRB080104514_la
t.pha algorithmPHA1 energybinalgLOG emin30
emax300000 enumbins15 This is gtbin version
v0r16p3 Done!
204. Binning the GBM data in energy
- dhcpvisitor216193/GLAST/GRB080104514 omodei
gtbin - This is gtbin version v0r16p3
- Type of output file ltCMAPLCPHA1PHA2gt PHA1
- Event data file name GLG_TTE_N0_BN080104514_V
01.FIT - Output file name GRB080104514_N0.pha
- Spacecraft data file name NONE
This has to be done for each bright detectors in
the GBM lt12 NaI, lt2 BGO. Notice in DC2 one can
use all the GBM detectors due to the fact that
the background used to build the data is the same
of the .bak files. In reality things are
different!
21Compute the response function for the LAT
- dhcpvisitor216193/GLAST/GRB080104514 omodei
gtrspgen - This is gtrspgen version v1r2
- Response calculation method (GRB, PS) ltGRBPSgt
GRB - Spectrum file name GRB080104514_lat.pha
- Spacecraft data file name ../DC2/DC2_FT2.fits
- Output file name GRB080104514_lat.rsp
- Time of GRB (s) 221142007
- Response function to use, e.g. DC1F/DC1B,
G25F/G25B, TestF/TestB DC2 - Algorithm for defining true energy bins
ltFILELINLOGgt LOG - Start value for first energy bin 30
- Stop value for last energy bin 300000
- Number of logarithmically uniform energy bins
100
!
I renamed GBM files to match my convention
GRBYYMMDDFFF_det. GLG_CSPEC_B0_BN080104514_V01.RS
P gtGRB080104514_B0.rsp GLG_CSPEC_B1_BN080104514_V
01.RSP gt GRB080104514_B1.rsp GLG_CSPEC_N0_BN08010
4514_V01.RSP gt GRB080104514_N0.rsp GLG_CSPEC_N1_B
N080104514_V01.RSP gt GRB080104514_N1.rsp GLG_CSPE
C_N2_BN080104514_V01.RSP gt GRB080104514_N2.rsp GL
G_CSPEC_N3_BN080104514_V01.RSP gt
GRB080104514_N3.rsp GLG_CSPEC_N6_BN080104514_V01.R
SP gt GRB080104514_N6.rsp GLG_CSPEC_N7_BN080104514
_V01.RSP gt GRB080104514_N7.rsp GLG_CSPEC_N9_BN080
104514_V01.RSP gt GRB080104514_N9.rsp GLG_CSPEC_NB
_BN080104514_V01.RSP gt GRB080104514_NB.rsp
22Everything is here
- /GLAST/GRB080104514 omodei l pha
- GRB080104514_B0.pha
- GRB080104514_B1.pha
- GRB080104514_N0.pha
- GRB080104514_N1.pha
- GRB080104514_N2.pha
- GRB080104514_N3.pha
- GRB080104514_N6.pha
- GRB080104514_N7.pha
- GRB080104514_N9.pha
- GRB080104514_NB.pha
- GRB080104514_lat.pha
- /GLAST/GRB080104514 omodei l rsp
- GRB080104514_B0.rsp
- GRB080104514_B1.rsp
- GRB080104514_N0.rsp
- GRB080104514_N1.rsp
- GRB080104514_N2.rsp
- GRB080104514_N3.rsp
/GLAST/GRB080104514 omodei l bak GRB080104514_B
0.bak GRB080104514_B1.bak GRB080104514_N0.bak GRB0
80104514_N1.bak GRB080104514_N2.bak GRB080104514_N
3.bak GRB080104514_N6.bak GRB080104514_N7.bak GRB0
80104514_N9.bak GRB080104514_NB.bak
Notice no background for the LAT
23Running XSPEC
- dhcpvisitor216193/GLAST/GRB080104514 omodei
xspec - XSPEC version 12.2.1
- Build Date/Time Tue Nov 22 201351 2005
- !XSPEC12gtcpd /xw
- !XSPEC12gtdata GRB080104514_N0.pha,
GRB080104514_N6.pha, GRB080104514_B0.pha,
GRB080104514_LAT.pha - !XSPEC12gtresponse GRB080104514_N0.rsp,
GRB080104514_N6.rsp, GRB080104514_B0.rsp,
GRB080104514_LAT.rsp - !XSPEC12gtbackgrnd GRB080104514_N0.bak,
GRB080104514_N6.bak ,GRB080104514_B0.bak - Net count rate (cts/s) for Spectrum1
9.929e01 /- 4.590e00 (30.7 total ) - Net count rate (cts/s) for Spectrum2
9.090e01 /- 4.570e00 (28.8 total ) - Net count rate (cts/s) for Spectrum3
7.422e01 /- 7.881e00 (9.4 total ) - !XSPEC12gtsetplot energy
- !XSPEC12gtignore 11000.0-
- !XSPEC12gtignore 21000.0-
- !XSPEC12gtignore 3-150.0
- !XSPEC12gtignore 33e4-
- !XSPEC12gtsetplot rebin 5 5 1
- !XSPEC12gtsetplot rebin 5 5 2
- !XSPEC12gtsetplot rebin 3 10 3
- !XSPEC12gtsetplot rebin 1 1 4
NaI lt 1 MeV 150 keV lt BGOlt 30MeV
24The result (2NaI, 1BGO LAT)
- Model grbmlt1gt Source No. 1 Active/On
- Model Model Component Parameter Unit Value
- par comp
- 1 1 grbm alpha
-1.15569 /- 9.78069E-02 - 2 1 grbm beta
-1.94431 /- 1.81158E-02 - 3 1 grbm tem keV
278.690 /- 102.841 - 4 1 grbm norm
2.82605E-03 /- 7.12606E-04 - __________________________________________________
______________________ - Chi-Squared 118.35 using 344 PHA bins.
- Reduced chi-squared 0.34808 for 340
degrees of freedom - Null hypothesis probability 1.000000e00
25With all the detectors (8NaI, 1BGO LAT)
Model grbmlt1gt Source No.
1 Active/On Model Model Component Parameter
Unit Value par comp 1 1 grbm
alpha -1.18380 /- 5.99816E-02
2 1 grbm beta
-1.95094 /- 1.71234E-02 3 1 grbm
tem keV 336.394 /-
85.1461 4 1 grbm norm
2.64184E-03 /- 3.97155E-04
_________________________________________________
_______________________ Chi-Squared
327.69 using 980 PHA bins. Reduced chi-squared
0.33575 for 976 degrees of freedom
Null hypothesis probability 1.000000e00
26Scripting xspec
- set PREFIX GRB
- set GRBNAME 080104514
- set GRBNAME PREFIXGRBNAME
- echo GRBNAME
- cpd /xw
- dat GRBNAME_N0.pha, GRBNAME_N6.pha,
GRBNAME_B0.pha, GRBNAME_LAT.pha - respon GRBNAME_N0.rsp, GRBNAME_N6.rsp,
GRBNAME_B0.rsp, GRBNAME_LAT.rsp - back GRBNAME_N0.bak, GRBNAME_N6.bak
,GRBNAME_B0.bak - setplot energy
- ignore 11000.0-
- ignore 21000.0-
- ignore 3-150.0
- ignore 33e4-
- ignore 8-3e4
- setplot rebin 5 5 1
- setplot rebin 5 5 2
- setplot rebin 3 10 3
- setplot rebin 1 1 4
- mod grbm
27Time resolved temporal analysis
1
2
3
4
28Creating Pha2 files
- dhcpvisitor216193/GLAST/GRB080104514 omodei
gtbin - This is gtbin version v0r16p3
- Type of output file ltCMAPLCPHA1PHA2gt PHA2
- Event data file name GRB080104514_select.fits
- Output file name GRB080104514_lat.pha2
- Spacecraft data file name NONE
- Algorithm for defining energy bins ltFILELINLOGgt
LOG - Start value for first energy bin 30
- Stop value for last energy bin 300000
- Number of logarithmically uniform energy bins
15 - Algorithm for defining time bins ltFILELINSNRgt
FILE - Name of the file containing the time bin
definition timebins.fits - dhcpvisitor216193/GLAST/GRB080104514 omodei
gtbin - This is gtbin version v0r16p3
- Type of output file ltCMAPLCPHA1PHA2gt PHA2
- Event data file name GLG_TTE_B1_BN080104514_V
01.FIT - Output file name GRB080104514_B1.pha2
- Spacecraft data file name NONE
LAT
All the GBM detectors I want to analyze
29 1 1 grbm alpha
-0.310013 /- 3.05915 2 1 grbm
beta -1.78821 /-
0.199308 3 1 grbm tem
keV 401.832 /- 1855.11 4
1 grbm norm 9.98445E-05
/- 3.09719E-04
30- 1 1 grbm alpha
-1.18084 /- 8.50302E-02 - 2 1 grbm beta
-2.04713 /- 5.02809E-02 - 3 1 grbm tem keV
267.715 /- 84.8468 - 4 1 grbm norm
6.20244E-03 /- 1.11782E-03
31- 1 1 grbm alpha
-1.19528 /- 0.118542 - 2 1 grbm beta
-1.84633 /- 3.91127E-02 - 3 1 grbm tem keV
719.387 /- 516.844 - 4 1 grbm norm
2.63532E-03 /- 6.82597E-04
32- 1 1 grbm alpha
-1.49635 /- 1.08452 - 2 1 grbm beta
-1.88247 /- 6.95778E-02 - 3 1 grbm tem keV
115.413 /- 579.045 - 4 1 grbm norm
1.77894E-03 /- 8.21310E-03
33Conclusions
Have fun !!
34(No Transcript)
35hcpvisitor216193/GLAST/GRB080104514 omodei
gtlikelihood Statistic to use ltBINNEDUNBINNEDgt
UNBINNED Spacecraft file ../DC2/DC2_FT2.fits
Event file GRB080104514_select.fits
Unbinned exposure map none Exposure
hypercube file none Source model file
myGRBmod.xml Response functions to use DC2
Optimizer ltLBFGSMINUITDRMNGBgt DRMNGB
Computing exposure at (57, 14)...................
..! myGRB Prefactor 4910.05 /-
575.129 Index -2.06767 /- 0.0766657 Scale
100 Npred 107.941 ROI distance 0 TS value
-1243.53 Total number of observed counts
108 Total number of model events
107.941 -log(Likelihood) 621.763403 Elapsed CPU
time 0.001338
36Scripts
37Trick 1 How to get MET out of a GLG_NOOTICE
import time import datetime refdatedatetime.date(
2001, 1, 1) grbdatedatetime.date(2008, 1,
4) tstart(grbdate - refdate).days8640044414.0 p
rint Burst Time in MET is,tstart
Burst Time in MET is 221142014.0
Many other tools can do this, even excel
But, the triggertime in the notice is not the
Montecarlo starting time of the burst
38Python running the ScienceTools
- import os
- import time
- import datetime
- refdatedatetime.date(2001, 1, 1)
- grbnumber"080104514"
- grbprefix"GRB"
- infile"../DC2/LAT_allsky_220838401.126_V01.fits"
- scfile"../DC2/DC2_FT2.fits"
- grbdatedatetime.date(2008, 1, 4)
- tstart(grbdate - refdate).days8640044414.0
- tminstr(tstart-5)
- tmaxstr(tstar60)
- deltatime".1"
- ra"57"
39again python
- select0
- lc1
- cmap1
- pha1
- pha21
- rsp1
- gbm1
- gbm21
- grbnamegrbprefixgrbnumber
- grbfilegrbname"_select.fits"
- lat_lcgrbname"_lat.lc"
- lat_cmapgrbname"_lat.cmap"
- lat_phagrbname"_lat.pha"
- lat_pha2grbname"_lat.pha2"
- lat_rspgrbname"_lat.rsp"
- timebinfile"timebins.fits"
- numxpix"360"
- numypix"180"
- pixscale"1"
Flags to decide the steps to do
my naming convention
40be patient
- if select
- cmd"gtselect infile"infile"
outfile"grbfile" ra"ra" dec"dec"
rad"rad" tmin"tmin" tmax"tmax"
emin"emin" emax"emax" eventClass"eventClas
s - print cmd
- os.system(cmd)
- if lc
- cmd"gtbin evfile"grbfile"
scfile"scfile" outfile"lat_lc" algorithmLC
timebinalgLIN"" tstart"tmin" tstop"tmax"
deltatime"deltatime" energybinalgLOG" - print cmd
- os.system(cmd)
- if cmap
- cmd"gtbin evfile"grbfile"
scfile"scfile" outfile"lat_cmap"
algorithmCMAP numxpix360 numypix180 pixscale1
coordsys"coordsys" xref0 yref0 axisrot0" - print cmd
- os.system(cmd)
- if pha
- cmd"gtbin evfile"grbfile"
scfile"scfile" outfile"lat_pha"
algorithmPHA1 energybinalgLOG"" emin"emin"
emax"emax" enumbins"enumbins - print cmd
- os.system(cmd)
41done!
- if gbm
- detectorList"N0","N1","N2","N3","N4","N5","N
6","N7","N8","N9","NA","NB","B0","B1" - for det in detectorList
- gbm_file_in"GLG_TTE_"det"_BN"grbnumber"_V01.
FIT" - gbm_file_outgrbname"_"det".pha"
- cmd"gtbin evfile"gbm_file_in" scfileNONE
outfile"gbm_file_out" PHA1" - os.system(cmd)
- cmd"cp GLG_CSPEC_"det"_BN"grbnumber"_V01.RSP
"grbname"_"det".rsp" - os.system(cmd)
- cmd"cp GLG_BCK_"det"_BN"grbnumber"_V01.BAK
"grbname"_"det".bak" - os.system(cmd)
- if gbm2
- for det in detectorList
- gbm_file_in"GLG_TTE_"det"_BN"grbnumber"_V01.
FIT" - gbm_file_outgrbname"_"det".pha2"
- cmd"gtbin evfile"gbm_file_in" scfileNONE
outfile"gbm_file_out" PHA2 timebinalgFILE
timebinfile"timebinfile - os.system(cmd)
- print "Done!"
42PlotWithHippo
- import sys
- import os
- import hippo
- import hippoplotter as plot
- from hippo import FitsController
- from hippo import Display
- def CM(grbnumber)
- my_file'GRB'grbnumber'_lat.cmap'
- import hippoplotter as plot
- plot.fitsImage(my_file, zlog1, aspect2)
- def LAT_SELECTION(grbnumber)
- my_file'GRB'grbnumber'_select.fits'
- ntc FitsController.instance()
- hdus ntc.getNTupleNames(my_file)
- events ntc.createNTuple ( my_file, hdus1
) - lcplot.Histogram(events,'TIME')
- lc.setBinWidth('x',.1)
43PlotWithHippo
- def LAT_GBM_LC(grbnumber)
- lcrange(15)
- eventsrange(15)
- ntc FitsController.instance()
- lat_file'GRB'grbnumber'_select.fits'
- hdus ntc.getNTupleNames(lat_file)
- events0 ntc.createNTuple ( lat_file,
hdus1 ) - lc0plot.Histogram(events0,'TIME')
- lc0.setBinWidth('x',.1)
- detectorList"N0","N1","N2","N3","N4","N5","N
6","N7","N8","N9","NA","NB","B0","B1" - i0
- for det in detectorList
- ii1
- gbm_file "GLG_TTE_"det"_BN"grbnumber"_V01.F
IT" - if os.path.exists(gbm_file)
- print "file "gbm_file" exists"
- hdus ntc.getNTupleNames(gbm_file)
- eventsi ntc.createNTuple ( gbm_file,
hdus2 ) - lci plot.Histogram(eventsi,'TIME')