Skip banner and navigation tools.

 |  site map

Swift-XRT GRB Spectrum Repository — Algorithm



The process of building spectra was discussed in detail in Evans et al. (2009). Since then, there have been many small modifications and many larger under-the-hood improvements in efficiency, which are detailed in the changelog. This page provides an up-to-date overview of the algorithm. This is deliberately written generically, to cover both automatically generated GRB spectra and those created on-demand: the only differences between these two cases are the absorption model used (see Spectral Fitting, below) and the time-intervals of the spectra created, which can be set by hand for the on-demand spectra.

Back to contents | Back to repository

Spectrum Creation

The spectrum creation begins with an attempt to detect and localise the source (unless centroiding has been disabled), initially using only the data from the first observation, but using later datasets if the source cannot be found in the first one. A deep image of all observations is also created, and source detection is used to identify all sources in this image, so that they can be excluded from the background extraction region. From this point onwards, the process is performed independently for PC and WT modes. If multiple spectra were requested (i.e. covering different time intervals) these are also created independently. The basic algorithm, described below, is thus followed for each mode and each spectrum. First, the software identifies which observations lie within the selected time interval, and then splits these into snapshots - periods of continuous observation - and the following steps are run for each snapshot:

  1. Check if the snapshot is within the requested time interval, and skip it if not.
  2. (WT mode only) Identify the roll angle of the spacecraft in this orbit, and update the keyword in the event list1.
  3. Attempt to centroid on the source. If this fails, for PC mode calculate a count-weighted mean of all centroids to date and use this.
  4. Check that the source is fully inside the field of view, and skip the snapshot if it is not.
  5. (PC mode only) Estimate the mean count-rate of the source in this snapshot, and adjust the source extraction radius accordingly.
  6. (PC mode only) Check if the background annulus falls outside the field of view, and if so, adjust it.
  7. Check for times of pile-up, and create annular source regions appropriate to eliminate pile up.
    If the source is piled up for some of the snapshot, but not for the entire time, the annular region will only be used during the times of pile-up: in this case the event list for the snapshot will be split up, with one event list for all the non-piled up times, and one event list per interval of pile up. Additionally, for GRB-like sources which decay over several orders of magnitude, a new pile-up interval is identified every time the source fades in WT mode by a factor of two: this allows us to reduce the inner radius of the annulus, so as to maximise the number of source counts included in the light curve.
  8. Create an event list for each of the times identified, using the appopriate source extraction region for each, call this a ‘Source event list’.
  9. For each event list just created, build an exposure map and an ARF file.
  10. Create an event list for the entire snapshot based on the background region (in PC mode), removing from this region any sources identified in the deep image at the start of the process.

1 An event list has a single roll angle keyword (PA_PNT), so if there are multiple spacecraft orbits in the list it will contain the mean value. The s.mkf file in the data auxil directory gives the roll angle as a function of time, and we use this to determine the per-snapshot roll angle.

Once all the snapshots in the observation have been processed in this way, the source event lists are merged into a single event list, as are the background event lists. The ARF files are also merged using the addarf tool. This produces a weighted average ARF, where the individual ARFs are weighted according to the number of counts in the source event list related to the ARF. Once all observations have been processed, these merged event lists and ARFs from each observation are merged to give a single source event list, background event list and ARF file. As before, the ARFs are weighted according the number of events in the per-observation source event lists. At this stage an RMF is also created, by identifying the RMF in the CALDB appropriate to each per-observation ARF, and then combining them using the addrmf tool, weighted according to the source counts.

The final step is to extract source and background spectra from the event lists, using the extractor tool. The source spectrum is grouped to have at least one count per bin, using the grppha tool, and the data are then fitted in xspec.

Back to contents | Back to repository

Spectral fitting

Models are fitted to the spectra using xspec. The automated fit uses an absorbed power-law model, where the tbabs model is used for the absorption along with the Verner et al. (1996) cross sections (xsect vern) and the Wilms et al. (2000) abundances (abund wilm). A cflux component is also used: this fits the flux rather than the model absorption, and allows the uncertainty in the flux to be calculated easily.

For GRBs, or on-demand objects with a supplied redshift, the absorption model comprises two components: a tbabs component with the absorption fixed at the Galactic value (determined from Willingale et al. 2013) and a second tbabs which is free to vary. If the redshift of the obect is known, this will be a ztbabs with the redshift frozen at the appropriate value. For on-demand spectra where the redshift is not supplied, only a single tbabs component is used, and it is free to vary.

The fit is performed using the W-statistic within xspec, this is selected via the statistic cstat command in xspec, but since Swift data have Poissonian backgrounds and we supply a background spectrum, xspec automatically selects the W-statistic: see the Xspec user manual, Appendix B for more details.

Once the fit is complete, the 90% confidence errors are calculated using the error command in xspec which steps each parameter in turn, to identify the range of values it can occupy without increasing the fit statistic by more than 2.706.

For GRBs, an absorbed power-law model is expected to be a good fit, but for other objects, or the spectrum is evolving2, it may not be. Therefore we provide a link allowing you to download a tar file containing all of the data files for the spectrum so that you can fit it yourself if you wish.

2 If the source evolves spectrally during the interval over which the spectrum is compiled, the non-evolving model may give a poor fit, with residuals that hint at, for example, a thermal component in the spectrum. However, this is simply an artefact of fitting an evolving spectrum with a non-evolving model. If spectral evolution is present, we strongly advise creating spectra over time intervals small enough that the evolution is not significant.

Back to contents | Back to repository