GRB tutorial

Post on 27-Jan-2016

442 views 0 download

description

GRB tutorial. Spectral analysis of the LAT and GBM data. All the software you need. https://confluence.slac.stanford.edu/display/DC2/DC2+code+releases. The tools I used. gtselect Select the ROI containing the bursts, in time, ra and dec gtbin - PowerPoint PPT Presentation

Transcript of GRB tutorial

Data Challenge 2 Kickoff meetingSLAC 1-3 March

Gamma-ray Large Area Gamma-ray Large Area Space TelescopeSpace Telescope GRB tutorial

Spectral analysis of the

LAT and GBM data

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

All the software you need

https://confluence.slac.stanford.edu/display/DC2/DC2+code+releases

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

The tools I used

• gtselect– 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

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

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

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

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_220838401.126_V01.fits)– ftp://heasarc.gsfc.nasa.gov/FTP/glast/DC2/allsky/LAT_allsky_220838401.126_V01.fits

• GRB080104514 GBM files:– ftp://heasarc.gsfc.nasa.gov/FTP/glast/DC2/burst/GRB080104514.tar.gz

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

dhcpvisitor216193:~/GLAST/GRB080104514 omodei$ l-rw-r--r-- 1 omodei omodei 23040 Feb 23 08:55 GLG_BCK_B0_BN080104514_V01.BAK…-rw-r--r-- 1 omodei omodei 106560 Feb 23 08:55 GLG_CSPEC_B0_BN080104514_V01.RSP…-rw-r--r-- 1 omodei omodei 1900800 Feb 23 08:55 GLG_CTIME_B0_BN080104514_V01.FIT…-rw-r--r-- 1 omodei omodei 20275200 Feb 23 08:42 GLG_CTIME_N0_080104514_V01.FIT…-rw-r--r-- 1 omodei omodei 591 Feb 23 08:52 GLG_NOTICE_080104514.TXT-rw-r--r-- 1 omodei omodei 380160 Feb 23 08:55 GLG_TTE_B0_BN080104514_V01.FIT-rw-r--r-- 1 omodei omodei 377280 Feb 23 08:55 GLG_TTE_B1_BN080104514_V01.FIT-rw-r--r-- 1 omodei omodei 164160 Feb 23 08:52 GLG_TTE_N0_BN080104514_V01.FIT-rw-r--r-- 1 omodei omodei 161280 Feb 23 08:52 GLG_TTE_N1_BN080104514_V01.FIT-rw-r--r-- 1 omodei omodei 141120 Feb 23 08:52 GLG_TTE_N2_BN080104514_V01.FIT-rw-r--r-- 1 omodei omodei 146880 Feb 23 08:52 GLG_TTE_N3_BN080104514_V01.FIT-rw-r--r-- 1 omodei omodei 161280 Feb 23 08:52 GLG_TTE_N6_BN080104514_V01.FIT-rw-r--r-- 1 omodei omodei 129600 Feb 23 08:52 GLG_TTE_N7_BN080104514_V01.FIT-rw-r--r-- 1 omodei omodei 158400 Feb 23 08:52 GLG_TTE_N9_BN080104514_V01.FIT-rw-r--r-- 1 omodei omodei 135360 Feb 23 08:52 GLG_TTE_NB_BN080104514_V01.FIT

Un-packaging the GBM files

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

GCN-like notices: GLG_NOTICE_080104514.TXT

GLAST BURST MONITOR BURST NOTIFICATION**************************************

BURST Name = GRB080104514BURST Date = 080104BURST Time (Sec of Day) = 44414.0BURST RA (Deg) = 59.3413BURST DEC (Deg) = 14.3453BURST LOC ERR (Deg 1 sigma) = 2.29264Standard Intensity (cts/sec) = 697.885(Standard Intensity is an angle-adjusted measure of the peak count rates in 2 NaI detectors

closest to the source)Closest detectors = N0 N6 B0

In DC2 we know (approximately) the position of the burst (GLG_NOTICE) GRB can be displaced statistically and systematically…

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Quick look at the data: hippodraw

Open the LAT_allsky_220838401.126_V01.fitsSelect EVENT extensionDo a color plot RA vs DECSet the axis bin width as you prefer (1 deg in the fig.)

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

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

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Tmin : 221142007Tmax: 221142060

Ra ~57Dec ~14

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

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!

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

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

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

1. Selecting the data

dhcpvisitor216193:~/GLAST/GRB080104514 omodei$ gtselect Input FT1 file [] : ../DC2/LAT_allsky_220838401.126_V01.fitsOutput FT1 file [] : GRB080104514_select.fitsRA for new search center (degrees) <0 - 360> [] : 59.34Dec for new search center (degrees) <-90 - 90> [] : 14.35radius of new search region (degrees) <0 - 180> [] : 20start time (MET in s) [] : 221142007end time (MET in s) [] : 221142060lower 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…

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

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

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

2. Binning the LAT data in spatial coordinates CMAP

dhcpvisitor216193:~/GLAST/GRB080104514 omodei$ gtbinThis is gtbin version v0r16p3Type of output file <CMAP|LC|PHA1|PHA2> [] : CMAPEvent data file name [] : GRB080104514_select.fitsOutput file name [] : GRB080104514_lat.cmapSpacecraft data file name[] : ../DC2/DC2_FT2.fitsSize 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 0.5 0.5 -cmap b -scale sqrt "GRB080104514_select.fits[bin=RA,DEC]"

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

3. Binning the LAT data in time

Obtaining the LAT light curve

dhcpvisitor216193:~/GLAST/GRB080104514 omodei$ gtbinThis is gtbin version v0r16p3Type of output file <CMAP|LC|PHA1|PHA2> [PHA1] : LC Event data file name [] : GRB080104514_select.fitsOutput file name [] : GRB080104514_lat.lcSpacecraft data file name[] : ../DC2/DC2_FT2.fits Algorithm for defining time bins <FILE|LIN|SNR>

[LIN] : Start value for first time bin [] : 221142007Stop value for last time bin [] : 221142060Width of linearly uniform time bins [] : 0.1

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

3. Binning the LAT data in energy

dhcpvisitor216193:~/GLAST/GRB080104514 omodei$ gtbinThis is gtbin version v0r16p3Type of output file <CMAP|LC|PHA1|PHA2> [PHA1] : Event data file name [GRB080104514_select.fits] : Output file name [] : GRB080104514_lat.phaSpacecraft data file name [../DC2/DC2_FT2.fits] : Algorithm for defining energy bins <FILE|LIN|LOG>

[LIN] : LOGStart value for first energy bin [30] : Stop value for last energy bin [300000] : Number of logarithmically uniform energy bins [15] :

gtbin evfile=GRB080104514_select.fits scfile=../DC2/DC2_FT2.fits outfile=GRB080104514_lat.pha algorithm=PHA1 energybinalg=LOG emin=30 emax=300000 enumbins=15This is gtbin version v0r16p3Done!

Obtaining a spectrum (PHA1) file

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

4. Binning the GBM data in energy

dhcpvisitor216193:~/GLAST/GRB080104514 omodei$ gtbinThis is gtbin version v0r16p3Type of output file <CMAP|LC|PHA1|PHA2> [PHA1] : Event data file name [] : GLG_TTE_N0_BN080104514_V01.FITOutput file name [] : GRB080104514_N0.phaSpacecraft 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!

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Compute the response function for the LAT

dhcpvisitor216193:~/GLAST/GRB080104514 omodei$ gtrspgen This is gtrspgen version v1r2Response calculation method (GRB, PS) <GRB|PS> [GRB] : Spectrum file name [] : GRB080104514_lat.pha Spacecraft data file name [] : ../DC2/DC2_FT2.fits Output file name [] : GRB080104514_lat.rspTime of GRB (s) [] : 221142007 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_BN080104514_V01.RSP =>GRB080104514_B0.rspGLG_CSPEC_B1_BN080104514_V01.RSP => GRB080104514_B1.rspGLG_CSPEC_N0_BN080104514_V01.RSP => GRB080104514_N0.rspGLG_CSPEC_N1_BN080104514_V01.RSP => GRB080104514_N1.rspGLG_CSPEC_N2_BN080104514_V01.RSP => GRB080104514_N2.rspGLG_CSPEC_N3_BN080104514_V01.RSP => GRB080104514_N3.rspGLG_CSPEC_N6_BN080104514_V01.RSP => GRB080104514_N6.rspGLG_CSPEC_N7_BN080104514_V01.RSP => GRB080104514_N7.rspGLG_CSPEC_N9_BN080104514_V01.RSP => GRB080104514_N9.rspGLG_CSPEC_NB_BN080104514_V01.RSP => GRB080104514_NB.rsp

!

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Everything is here:

~/GLAST/GRB080104514 omodei$ l *phaGRB080104514_B0.phaGRB080104514_B1.phaGRB080104514_N0.phaGRB080104514_N1.phaGRB080104514_N2.phaGRB080104514_N3.phaGRB080104514_N6.phaGRB080104514_N7.phaGRB080104514_N9.phaGRB080104514_NB.phaGRB080104514_lat.pha~/GLAST/GRB080104514 omodei$ l *rspGRB080104514_B0.rspGRB080104514_B1.rspGRB080104514_N0.rspGRB080104514_N1.rspGRB080104514_N2.rspGRB080104514_N3.rspGRB080104514_N6.rspGRB080104514_N7.rspGRB080104514_N9.rspGRB080104514_NB.rspGRB080104514_lat.rsp

~/GLAST/GRB080104514 omodei$ l *bakGRB080104514_B0.bakGRB080104514_B1.bakGRB080104514_N0.bakGRB080104514_N1.bakGRB080104514_N2.bakGRB080104514_N3.bakGRB080104514_N6.bakGRB080104514_N7.bakGRB080104514_N9.bakGRB080104514_NB.bak

Notice: no background for the LAT

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Running XSPEC

dhcpvisitor216193:~/GLAST/GRB080104514 omodei$ xspec XSPEC version: 12.2.1 Build Date/Time: Tue Nov 22 20:13:51 2005!XSPEC12>cpd /xw;!XSPEC12>data GRB080104514_N0.pha, GRB080104514_N6.pha, GRB080104514_B0.pha, GRB080104514_LAT.pha!XSPEC12>response GRB080104514_N0.rsp, GRB080104514_N6.rsp, GRB080104514_B0.rsp, GRB080104514_LAT.rsp!XSPEC12>backgrnd GRB080104514_N0.bak, GRB080104514_N6.bak ,GRB080104514_B0.bakNet count rate (cts/s) for Spectrum:1 9.929e+01 +/- 4.590e+00 (30.7 % total )Net count rate (cts/s) for Spectrum:2 9.090e+01 +/- 4.570e+00 (28.8 % total )Net count rate (cts/s) for Spectrum:3 7.422e+01 +/- 7.881e+00 (9.4 % total )!XSPEC12>setplot energy;!XSPEC12>ignore 1:1000.0-**;!XSPEC12>ignore 2:1000.0-**; !XSPEC12>ignore 3:**-150.0;!XSPEC12>ignore 3:3e4-**;!XSPEC12>setplot rebin 5 5 1 ;!XSPEC12>setplot rebin 5 5 2 ;!XSPEC12>setplot rebin 3 10 3;!XSPEC12>setplot rebin 1 1 4;!XSPEC12>model grbmInput parameter value, delta, min, bot, top, and max values for ... -1 0.01 -10 -3 2 5grbm:alpha> -2 0.01 -10 -5 2 10grbm:beta> 300 10 10 50 1000 10000grbm:tem> 1 0.01 0 0 1e+24 1e+24grbm:norm>

!XSPEC12> renorm!XSPEC12>fit!XSPEC12>plot ldata

NaI < 1 MeV150 keV < BGO< 30MeV

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

The result (2NaI, 1BGO + LAT)

========================================================================Model grbm<1> Source No.: 1 Active/OnModel 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.000000e+00

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

========================================================================Model grbm<1> Source No.: 1 Active/OnModel 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.000000e+00

With all the detectors

(8NaI, 1BGO + LAT)

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Scripting xspec

set PREFIX GRBset GRBNAME 080104514set GRBNAME $PREFIX$GRBNAMEecho $GRBNAMEcpd /xwdat ${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:1000.0-**ignore 2:1000.0-**ignore 3:**-150.0ignore 3:3e4-**#ignore 8:**-3e4setplot rebin 5 5 1 setplot rebin 5 5 2 setplot rebin 3 10 3setplot rebin 1 1 4mod grbm;renormfitplot ldata;

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Time resolved temporal analysis

1 2 3 4

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Creating Pha2 files…

dhcpvisitor216193:~/GLAST/GRB080104514 omodei$ gtbinThis is gtbin version v0r16p3Type of output file <CMAP|LC|PHA1|PHA2> [] : PHA2Event data file name [GRB080104514_select.fits] : Output file name [] : GRB080104514_lat.pha2Spacecraft 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> [] : FILEName of the file containing the time bin definition [] :

timebins.fits

dhcpvisitor216193:~/GLAST/GRB080104514 omodei$ gtbinThis is gtbin version v0r16p3Type of output file <CMAP|LC|PHA1|PHA2> [PHA2] : Event data file name [] : GLG_TTE_B1_BN080104514_V01.FITOutput file name [] : GRB080104514_B1.pha2Spacecraft data file name [NONE] : Algorithm for defining time bins <FILE|LIN|SNR> [FILE] : Name of the file containing the time bin definition

[timebins.fits] :

LAT

All the GBM detectorsI want to analyze………

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

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

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

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

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

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

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

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

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Conclusions

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

hcpvisitor216193:~/GLAST/GRB080104514 omodei$ gtlikelihood Statistic to use <BINNED|UNBINNED> [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 <LBFGS|MINUIT|DRMNGB> [DRMNGB] : Computing exposure at (57, 14).....................!

myGRB:Prefactor: 4910.05 +/- 575.129Index: -2.06767 +/- 0.0766657Scale: 100Npred: 107.941ROI distance: 0TS value: -1243.53

Total number of observed counts: 108Total number of model events: 107.941-log(Likelihood): 621.763403Elapsed CPU time: 0.001338

Data Challenge 2 Kickoff meetingSLAC 1-3 March

Gamma-ray Large Area Gamma-ray Large Area Space TelescopeSpace Telescope

Scripts:

Python

tcl

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Trick 1: How to get MET out of a GLG_NOOTICE

import timeimport datetimerefdate=datetime.date(2001, 1, 1)grbdate=datetime.date(2008, 1, 4)tstart=(grbdate - refdate).days*86400+44414.0print ‘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…

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

Python… running the ScienceTools

import osimport timeimport datetime

refdate=datetime.date(2001, 1, 1)

grbnumber="080104514"grbprefix="GRB"infile="../DC2/

LAT_allsky_220838401.126_V01.fits"scfile="../DC2/DC2_FT2.fits"

grbdate=datetime.date(2008, 1, 4)tstart=(grbdate - refdate).days*86400+44414.0

tmin=str(tstart-5)tmax=str(tstar+60)

deltatime=".1"ra="57"dec="14"rad="15"emin="30"emax="300000"enumbins="15"eventClass="-1"

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

…again python…

select=0lc=1cmap=1pha=1pha2=1rsp=1gbm=1gbm2=1grbname=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…

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

…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" print cmd os.system(cmd)

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" print cmd os.system(cmd)

if pha: cmd="gtbin evfile="+grbfile+" scfile="+scfile+" outfile="+lat_pha+" algorithm=PHA1 energybinalg=LOG"+" emin="+emin+"

emax="+emax+" enumbins="+enumbins print cmd os.system(cmd)

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 print cmd os.system(cmd) 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" os.system(cmd)

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

…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"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_out=grbname+"_"+det+".pha2"cmd="gtbin evfile="+gbm_file_in+" scfile=NONE outfile="+gbm_file_out+" PHA2 timebinalg=FILE timebinfile="+timebinfileos.system(cmd)

print "Done!"

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

PlotWithHippo

import sysimport osimport hippoimport hippoplotter as plotfrom hippo import FitsControllerfrom hippo import Display

def CM(grbnumber): my_file='GRB'+grbnumber+'_lat.cmap' import hippoplotter as plot 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' ntc = FitsController.instance() hdus = ntc.getNTupleNames(my_file) events = ntc.createNTuple ( my_file, hdus[1] ) plot.Scatter(events,'TIME','COUNTS',pointRep='Line') str = raw_input("Type return to quit. ")

Nicola Omodei @ INFN PisaSLAC-March 3, 2006

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+1gbm_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 i=0 lc[i].setRange('x',tstart,tend) for det in detectorList:

i=i+1gbm_file = "GLG_TTE_"+det+"_BN"+grbnumber+"_V01.FIT"if os.path.exists(gbm_file): lc[i].setRange('x',tstart,tend)

str = raw_input("Type return to quit/continue. ")