Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spectral analysis of the LAT and GBM data

Similar presentations


Presentation on theme: "Spectral analysis of the LAT and GBM data"— Presentation transcript:

1 Spectral analysis of the LAT and GBM data
GRB tutorial Spectral analysis of the LAT and GBM data

2 All the software you need

3 The tools I used gtselect gtbin gtrspgen gtlikelihood DataServer
Select the ROI containing the bursts, in time, ra and dec gtbin Bin the LAT data in time -> obtain the light curve Bin the LAT data in RA,DEC ->Obtaining a count map Bin the GBM and LAT data in energy -> obtaining a spectrum PHA1 files Bin the GBM and LAT data in time and energy->PHA2 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

4 Getting the data at http://glast.gsfc.nasa.gov/ssc/dev/databases/DC2/

5 The files you need: LAT livetime history (DC2_FT2.fits)
ftp://heasarc.gsfc.nasa.gov/FTP/glast/DC2/misc_data/DC2_FT2.fits LAT photon data (all sky, first week): (LAT_allsky_ _V01.fits) ftp://heasarc.gsfc.nasa.gov/FTP/glast/DC2/allsky/LAT_allsky_ _V01.fits GRB GBM files: ftp://heasarc.gsfc.nasa.gov/FTP/glast/DC2/burst/GRB tar.gz

6 Un-packaging the GBM files
dhcpvisitor216193:~/GLAST/GRB omodei$ l -rw-r--r omodei omodei Feb 23 08:55 GLG_BCK_B0_BN _V01.BAK -rw-r--r omodei omodei Feb 23 08:55 GLG_CSPEC_B0_BN _V01.RSP -rw-r--r omodei omodei Feb 23 08:55 GLG_CTIME_B0_BN _V01.FIT -rw-r--r omodei omodei Feb 23 08:42 GLG_CTIME_N0_ _V01.FIT -rw-r--r omodei omodei Feb 23 08:52 GLG_NOTICE_ TXT -rw-r--r omodei omodei Feb 23 08:55 GLG_TTE_B0_BN _V01.FIT -rw-r--r omodei omodei Feb 23 08:55 GLG_TTE_B1_BN _V01.FIT -rw-r--r omodei omodei Feb 23 08:52 GLG_TTE_N0_BN _V01.FIT -rw-r--r omodei omodei Feb 23 08:52 GLG_TTE_N1_BN _V01.FIT -rw-r--r omodei omodei Feb 23 08:52 GLG_TTE_N2_BN _V01.FIT -rw-r--r omodei omodei Feb 23 08:52 GLG_TTE_N3_BN _V01.FIT -rw-r--r omodei omodei Feb 23 08:52 GLG_TTE_N6_BN _V01.FIT -rw-r--r omodei omodei Feb 23 08:52 GLG_TTE_N7_BN _V01.FIT -rw-r--r omodei omodei Feb 23 08:52 GLG_TTE_N9_BN _V01.FIT -rw-r--r omodei omodei Feb 23 08:52 GLG_TTE_NB_BN _V01.FIT

7 GCN-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 = GRB BURST Date = BURST Time (Sec of Day) = BURST RA (Deg) = BURST DEC (Deg) = BURST LOC ERR (Deg 1 sigma) = Standard Intensity (cts/sec) = (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

8 Quick look at the data: hippodraw
Open the LAT_allsky_ _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.)

9 Add a cut on TIME, reset the bin width (axis)…

10 Ra ~57 Dec ~14 Tmin : Tmax:

11 GBM and LAT light curve Lightcurves curves at LAT energy and GBM energy are different, as predicted from the model This imply a spectral evolution!

12 Trick 2: open the header file of the TTE data!

13 Resolved in dataSubselector version v4r1p5 Alternatively…
1. Selecting the data dhcpvisitor216193:~/GLAST/GRB omodei$ gtselect Input FT1 file [] : ../DC2/LAT_allsky_ _V01.fits Output FT1 file [] : GRB _select.fits RA for new search center (degrees) < > [] : 59.34 Dec for new search center (degrees) < > [] : 14.35 radius of new search region (degrees) < > [] : 20 start time (MET in s) [] : end time (MET in s) [] : lower energy limit (MeV) [30] : upper energy limit (MeV) [300000] : Event classes (-1=all, 0=FrontA, 1=BackA, 2=FrontB, 3=BackB, 4=class A) <-1 - 4> [-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

15

16 It is useful to rename the file! (GRB080104514_select.fits)

17 2. Binning the LAT data in spatial coordinates CMAP
dhcpvisitor216193:~/GLAST/GRB omodei$ gtbin This is gtbin version v0r16p3 Type of output file <CMAP|LC|PHA1|PHA2> [] : CMAP Event data file name [] : GRB _select.fits Output file name [] : GRB _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) <CEL|GAL> [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 cmap b -scale sqrt "GRB _select.fits[bin=RA,DEC]"

18 3. Binning the LAT data in time
Obtaining the LAT light curve dhcpvisitor216193:~/GLAST/GRB omodei$ gtbin This is gtbin version v0r16p3 Type of output file <CMAP|LC|PHA1|PHA2> [PHA1] : LC Event data file name [] : GRB _select.fits Output file name [] : GRB _lat.lc Spacecraft data file name[] : ../DC2/DC2_FT2.fits Algorithm for defining time bins <FILE|LIN|SNR> [LIN] : Start value for first time bin [] : Stop value for last time bin [] : Width of linearly uniform time bins [] : 0.1

19 3. Binning the LAT data in energy
Obtaining a spectrum (PHA1) file dhcpvisitor216193:~/GLAST/GRB omodei$ gtbin This is gtbin version v0r16p3 Type of output file <CMAP|LC|PHA1|PHA2> [PHA1] : Event data file name [GRB _select.fits] : Output file name [] : GRB _lat.pha Spacecraft data file name [../DC2/DC2_FT2.fits] : Algorithm for defining energy bins <FILE|LIN|LOG> [LIN] : LOG Start value for first energy bin [30] : Stop value for last energy bin [300000] : Number of logarithmically uniform energy bins [15] : gtbin evfile=GRB _select.fits scfile=../DC2/DC2_FT2.fits outfile=GRB _lat.pha algorithm=PHA1 energybinalg=LOG emin=30 emax= enumbins=15 This is gtbin version v0r16p3 Done!

20 4. Binning the GBM data in energy
dhcpvisitor216193:~/GLAST/GRB omodei$ gtbin This is gtbin version v0r16p3 Type of output file <CMAP|LC|PHA1|PHA2> [PHA1] : Event data file name [] : GLG_TTE_N0_BN _V01.FIT Output file name [] : GRB _N0.pha Spacecraft data file name [NONE] : This has to be done for each bright detectors in the GBM: <12 NaI, <2 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!

21 Compute the response function for the LAT
dhcpvisitor216193:~/GLAST/GRB omodei$ gtrspgen This is gtrspgen version v1r2 Response calculation method (GRB, PS) <GRB|PS> [GRB] : Spectrum file name [] : GRB _lat.pha Spacecraft data file name [] : ../DC2/DC2_FT2.fits Output file name [] : GRB _lat.rsp Time of GRB (s) [] : Response function to use, e.g. DC1F/DC1B, G25F/G25B, TestF/TestB [DC2] : Algorithm for defining true energy bins <FILE|LIN|LOG> [] : 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_BN _V01.RSP =>GRB _B0.rsp GLG_CSPEC_B1_BN _V01.RSP => GRB _B1.rsp GLG_CSPEC_N0_BN _V01.RSP => GRB _N0.rsp GLG_CSPEC_N1_BN _V01.RSP => GRB _N1.rsp GLG_CSPEC_N2_BN _V01.RSP => GRB _N2.rsp GLG_CSPEC_N3_BN _V01.RSP => GRB _N3.rsp GLG_CSPEC_N6_BN _V01.RSP => GRB _N6.rsp GLG_CSPEC_N7_BN _V01.RSP => GRB _N7.rsp GLG_CSPEC_N9_BN _V01.RSP => GRB _N9.rsp GLG_CSPEC_NB_BN _V01.RSP => GRB _NB.rsp

22 Everything is here: Notice: no background for the LAT
~/GLAST/GRB omodei$ l *pha GRB _B0.pha GRB _B1.pha GRB _N0.pha GRB _N1.pha GRB _N2.pha GRB _N3.pha GRB _N6.pha GRB _N7.pha GRB _N9.pha GRB _NB.pha GRB _lat.pha ~/GLAST/GRB omodei$ l *rsp GRB _B0.rsp GRB _B1.rsp GRB _N0.rsp GRB _N1.rsp GRB _N2.rsp GRB _N3.rsp GRB _N6.rsp GRB _N7.rsp GRB _N9.rsp GRB _NB.rsp GRB _lat.rsp ~/GLAST/GRB omodei$ l *bak GRB _B0.bak GRB _B1.bak GRB _N0.bak GRB _N1.bak GRB _N2.bak GRB _N3.bak GRB _N6.bak GRB _N7.bak GRB _N9.bak GRB _NB.bak Notice: no background for the LAT

23 Running XSPEC NaI < 1 MeV 150 keV < BGO< 30MeV
dhcpvisitor216193:~/GLAST/GRB omodei$ xspec XSPEC version: Build Date/Time: Tue Nov 22 20:13: !XSPEC12>cpd /xw; !XSPEC12>data GRB _N0.pha, GRB _N6.pha, GRB _B0.pha, GRB _LAT.pha !XSPEC12>response GRB _N0.rsp, GRB _N6.rsp, GRB _B0.rsp, GRB _LAT.rsp !XSPEC12>backgrnd GRB _N0.bak, GRB _N6.bak ,GRB _B0.bak Net count rate (cts/s) for Spectrum: e+01 +/ e+00 (30.7 % total ) Net count rate (cts/s) for Spectrum: e+01 +/ e+00 (28.8 % total ) Net count rate (cts/s) for Spectrum: e+01 +/ e+00 (9.4 % total ) !XSPEC12>setplot energy; !XSPEC12>ignore 1: **; !XSPEC12>ignore 2: **; !XSPEC12>ignore 3:**-150.0; !XSPEC12>ignore 3:3e4-**; !XSPEC12>setplot rebin ; !XSPEC12>setplot rebin ; !XSPEC12>setplot rebin ; !XSPEC12>setplot rebin 1 1 4; !XSPEC12>model grbm Input parameter value, delta, min, bot, top, and max values for ... grbm:alpha> grbm:beta> grbm:tem> e e+24 grbm:norm> !XSPEC12> renorm !XSPEC12>fit !XSPEC12>plot ldata NaI < 1 MeV 150 keV < BGO< 30MeV

24 The result (2NaI, 1BGO + LAT)
======================================================================== Model grbm<1> Source No.: 1 Active/On Model Model Component Parameter Unit Value par comp grbm alpha / E-02 grbm beta / E-02 grbm tem keV / grbm norm E-03 +/ E-04 ________________________________________________________________________ Chi-Squared = using 344 PHA bins. Reduced chi-squared = for degrees of freedom Null hypothesis probability = e+00

25 With all the detectors (8NaI, 1BGO + LAT)
======================================================================== Model grbm<1> Source No.: 1 Active/On Model Model Component Parameter Unit Value par comp grbm alpha / E-02 grbm beta / E-02 grbm tem keV / grbm norm E-03 +/ E-04 ________________________________________________________________________ Chi-Squared = using 980 PHA bins. Reduced chi-squared = for degrees of freedom Null hypothesis probability = e+00

26 Scripting xspec set PREFIX GRB set GRBNAME 080104514
set GRBNAME $PREFIX$GRBNAME 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 1: ** ignore 2: ** ignore 3:**-150.0 ignore 3:3e4-** #ignore 8:**-3e4 setplot rebin 5 5 1 setplot rebin 5 5 2 setplot rebin setplot rebin 1 1 4 mod grbm; renorm fit plot ldata;

27 Time resolved temporal analysis
1 2 3 4

28 Creating Pha2 files… LAT All the GBM detectors I want to analyze …
dhcpvisitor216193:~/GLAST/GRB omodei$ gtbin This is gtbin version v0r16p3 Type of output file <CMAP|LC|PHA1|PHA2> [] : PHA2 Event data file name [GRB _select.fits] : Output file name [] : GRB _lat.pha2 Spacecraft data file name [NONE] : Algorithm for defining energy bins <FILE|LIN|LOG> [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 <FILE|LIN|SNR> [] : FILE Name of the file containing the time bin definition [] : timebins.fits Type of output file <CMAP|LC|PHA1|PHA2> [PHA2] : Event data file name [] : GLG_TTE_B1_BN _V01.FIT Output file name [] : GRB _B1.pha2 Algorithm for defining time bins <FILE|LIN|SNR> [FILE] : Name of the file containing the time bin definition [timebins.fits] : LAT All the GBM detectors I want to analyze

29 grbm alpha / grbm beta / grbm tem keV / grbm norm E-05 +/ E-04

30 grbm alpha / E-02 grbm beta / E-02 grbm tem keV / grbm norm E-03 +/ E-03

31 grbm alpha / grbm beta / E-02 grbm tem keV / grbm norm E-03 +/ E-04

32 grbm alpha / grbm beta / E-02 grbm tem keV / grbm norm E-03 +/ E-03

33 Conclusions Have fun !!

34

35 hcpvisitor216193:~/GLAST/GRB080104514 omodei$ gtlikelihood
Statistic to use <BINNED|UNBINNED> [UNBINNED] : Spacecraft file [../DC2/DC2_FT2.fits] : Event file [GRB _select.fits] : Unbinned exposure map [none] : Exposure hypercube file [none] : Source model file [myGRBmod.xml] : Response functions to use [DC2] : Optimizer <LBFGS|MINUIT|DRMNGB> [DRMNGB] : Computing exposure at (57, 14) ! myGRB: Prefactor: / Index: / Scale: 100 Npred: ROI distance: 0 TS value: Total number of observed counts: 108 Total number of model events: -log(Likelihood): Elapsed CPU time:

36 Scripts: Python tcl

37 Trick 1: How to get MET out of a GLG_NOOTICE
import time import datetime refdate=datetime.date(2001, 1, 1) grbdate=datetime.date(2008, 1, 4) tstart=(grbdate - refdate).days* print ‘Burst Time in MET is:’,tstart Burst Time in MET is: Many other tools can do this, even excel… But, the triggertime in the notice is not the Montecarlo starting time of the burst…

38 Python… running the ScienceTools
import os import time import datetime refdate=datetime.date(2001, 1, 1) grbnumber=" " grbprefix="GRB" infile="../DC2/LAT_allsky_ _V01.fits" scfile="../DC2/DC2_FT2.fits" grbdate=datetime.date(2008, 1, 4) tstart=(grbdate - refdate).days* tmin=str(tstart-5) tmax=str(tstar+60) deltatime=".1" ra="57" dec="14" rad="15" emin="30" emax="300000" enumbins="15" eventClass="-1"

39 Flags to decide the steps to do…
…again python… select=0 lc=1 cmap=1 pha=1 pha2=1 rsp=1 gbm=1 gbm2=1 grbname=grbprefix+grbnumber; grbfile=grbname+"_select.fits" lat_lc=grbname+"_lat.lc" lat_cmap=grbname+"_lat.cmap" lat_pha=grbname+"_lat.pha" lat_pha2=grbname+"_lat.pha2" lat_rsp=grbname+"_lat.rsp" timebinfile="timebins.fits" numxpix="360" numypix="180" pixscale="1" coordsys="GAL" Flags to decide the steps to do… …my naming convention…

40 …be patient… if select:
cmd="gtselect infile="+infile+" outfile="+grbfile+" ra="+ra+" dec="+dec+" rad="+rad+" tmin="+tmin+" tmax="+tmax+" emin="+emin+" emax="+emax+" eventClass="+eventClass print cmd os.system(cmd) if lc: cmd="gtbin evfile="+grbfile+" scfile="+scfile+" outfile="+lat_lc+" algorithm=LC timebinalg=LIN"+" tstart="+tmin+" tstop="+tmax+" deltatime="+deltatime+" energybinalg=LOG" if cmap: cmd="gtbin evfile="+grbfile+" scfile="+scfile+" outfile="+lat_cmap+" algorithm=CMAP numxpix=360 numypix=180 pixscale=1 coordsys="+coordsys+" xref=0 yref=0 axisrot=0" if pha: cmd="gtbin evfile="+grbfile+" scfile="+scfile+" outfile="+lat_pha+" algorithm=PHA1 energybinalg=LOG"+" emin="+emin+" emax="+emax+" enumbins="+enumbins if pha2: cmd="gtbin evfile="+grbfile+" scfile="+scfile+" outfile="+lat_pha2+" algorithm=PHA2 energybinalg=LOG"+" emin="+emin+" emax="+emax+" enumbins="+enumbins+" timebinalg=FILE timebinfile="+timebinfile if rsp: cmd="gtrspgen respalg=GRB specfile="+lat_pha+" scfile="+scfile+" outfile="+lat_rsp+" time="+tmin+" resptype=DC2"+" energybinalg=LOG"+" emin="+emin+" emax="+emax+" enumbins=100"

41 …done! if gbm: detectorList=["N0","N1","N2","N3","N4","N5","N6","N7","N8","N9","NA","NB","B0","B1"] for det in detectorList: gbm_file_in="GLG_TTE_"+det+"_BN"+grbnumber+"_V01.FIT" gbm_file_out=grbname+"_"+det+".pha" cmd="gtbin evfile="+gbm_file_in+" scfile=NONE outfile="+gbm_file_out+" PHA1" os.system(cmd) cmd="cp GLG_CSPEC_"+det+"_BN"+grbnumber+"_V01.RSP "+grbname+"_"+det+".rsp" cmd="cp GLG_BCK_"+det+"_BN"+grbnumber+"_V01.BAK "+grbname+"_"+det+".bak" if gbm2: gbm_file_out=grbname+"_"+det+".pha2" cmd="gtbin evfile="+gbm_file_in+" scfile=NONE outfile="+gbm_file_out+" PHA2 timebinalg=FILE timebinfile="+timebinfile print "Done!"

42 PlotWithHippo 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' plot.fitsImage(my_file, zlog=1, aspect=2) def LAT_SELECTION(grbnumber): my_file='GRB'+grbnumber+'_select.fits' ntc = FitsController.instance() hdus = ntc.getNTupleNames(my_file) events = ntc.createNTuple ( my_file, hdus[1] ) lc=plot.Histogram(events,'TIME') lc.setBinWidth('x',.1) sm = plot.XYHist(events,'RA','DEC') sm.setBinWidth ( 'x', .5 ) sm.setBinWidth ( 'y', .5 ) str = raw_input("Type return to quit. ") def LAT_LC(grbnumber): my_file='GRB'+grbnumber+'_lat.lc' plot.Scatter(events,'TIME','COUNTS',pointRep='Line')

43 PlotWithHippo def LAT_GBM_LC(grbnumber): lc=range(15) events=range(15)
ntc = FitsController.instance() lat_file='GRB'+grbnumber+'_select.fits' hdus = ntc.getNTupleNames(lat_file) events[0]= ntc.createNTuple ( lat_file, hdus[1] ) lc[0]=plot.Histogram(events[0],'TIME') lc[0].setBinWidth('x',.1) detectorList=["N0","N1","N2","N3","N4","N5","N6","N7","N8","N9","NA","NB","B0","B1"] i=0 for det in detectorList: i=i+1 gbm_file = "GLG_TTE_"+det+"_BN"+grbnumber+"_V01.FIT" if os.path.exists(gbm_file): print "file "+gbm_file+" exists:" hdus = ntc.getNTupleNames(gbm_file) events[i] = ntc.createNTuple ( gbm_file, hdus[2] ) lc[i] = plot.Histogram(events[i],'TIME') lc[i].setBinWidth ( 'x', .1 ) lc[i].setTitle(det) tstart=lc[1].getRange('x')[0]+5 tend=lc[1].getRange('x')[1]-5 print 'Tstart=',tstart,', Tend=',tend lc[i].setRange('x',tstart,tend) str = raw_input("Type return to quit/continue. ")


Download ppt "Spectral analysis of the LAT and GBM data"

Similar presentations


Ads by Google