Once the data have been screened and the desired filters set, to extract a spectrum simply type extract spectrum at the XSELECT prompt. This command initiates the extractor, an FTOOL run by XSELECT, which extracts from the events list photons satisfying the GTI and filter constraints and bins them up as a spectrum. The extractor places the spectrum in a temporary file which can be saved using save spectrum. Although this procedure is as straightforward as it sounds, please note the following.
For all except GIS background spectra, the answer in XSELECT to the binning/grouping question should usually be in the affirmative.
It is not necessary to know all about ASCA spectral files in order to use them. However, it is a good idea to be familiar with their basic structure and contents.
The general principles behind the design and structure of the FITS spectral files (also known as PHA or PI files) from ASCA are described in Arnaud et al. 1992, Legacy #2, 65 and
http://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/spectra/ogip_92_007/ogip_92_007.html.)
This article also lists all the keywords, extension names and column names. The key components of an ASCA spectral file are described below.
Below is a short list of some of the important keywords in the primary header.
EXPOSURE | Integration time (in secs) of PHA data. |
BACKSCAL | Scaling factor used in background subtraction. |
BACKFILE | Background file name (blank unless filled by user). |
RESPFILE | RMF file name (blank unless filled by user). |
ANCRFILE | ARF file name (blank unless filled by user). |
POISSERR | Whether Poisson errors should be applied. |
CHANTYPE | Whether channels are PHA or PI. |
TLMIN1 | Channel number of first channel. |
NCHAN | Number of detector channels in the data set. |
QUALITY | Whether quality flags are attached to the data. |
GROUPING | Whether data are grouped. |
Note that the background scaling factor, with keyword BACKSCAL, is defined as the ratio of the area of the region used to extract the spectrum to the total detector pixel area. Thus multiplying BACKSCAL by or gives the area of the spectral extraction region (in unbinned pixels) for the GIS or SIS respectively.
The weighted map, or WMAP, is an image of the count distribution in the region used to extract the spectrum. The WMAP is an image array which resides in the primary extension of the FITS spectral file. This information is used to generate the XRT ancillary response file (ARF; see §8.7) which requires the spatial information of the counts on the detector plane. Since it is a FITS image, the WMAP can actually be displayed using an image display package such as SAOimage (e.g., saoimage -fits burst_g2.pha). In XSELECT the default binning for WMAP is unity for the GIS and a factor 8 for the SIS.
The SPECTRUM extension contains columns corresponding to channel number and the counts in each channel. The SPECTRUM extension can also contain additional columns for errors (if non-Possionian), as well as quality and grouping flags.
The quality flag, following the OGIP standard, can have the following values.
0 | good |
1 | defined bad by software |
2 | defined dubious by software |
5 | defined bad by user |
-1 | reason for bad flag unknown |
XSPEC will automatically ignore channels with a quality flag of 1, and on the command ignore bad will ignore channels with a quality flag of 5. Quality flags can be set or reset with the FTOOL grppha.
The grouping flag works as follows. XSPEC combines the counts in a channel with a grouping flag of 1 with all successive channels with grouping flags of -1. Grouping flags can be set or reset with the FTOOL grppha.
The GTI extension contains the individual time intervals (start and stop times) used to make the spectral file.
A key concept when dealing with spectral files is the difference between binning and grouping, both of which relate to the combining of spectral channels. An important difference, for our purposes, is that grouping is reversible but binning is not. Otherwise, the two processes are equivalent.
Binning refers to the recasting of counts from the original set of channels into a new, smaller set of binned channels. In general, a spectrum must be used with a background file and response file with matching channel arrays, i.e., all three files must share the same number of channels and channel boundaries. This means that when a spectrum is binned in a certain way, so must the background and response. To rebin spectral files, you can use the FTOOL rbnpha, and to rebin a response matrix, rbnrmf.
In the course of normal ASCA data reduction and analysis, the binning of the spectral files matches that of the response by default. However, there are three cases when changing the binning is an issue:
Grouping is performed by the FTOOL grppha. For more details about this program refer to fhelp grppha and §8.11.
Grouping refers to the setting of flags for combining spectral channels. The flags are used internally by XSPEC. Neither XSPEC nor the grouping program (grppha) physically alters the channels or their contents in the spectral file - unlike binning. When a spectral file is read into XSPEC, the program consults the grouping column in the file and applies the grouping information it contains to the spectral file, its associated background file and to its response. The effect of grouping the spectral file, therefore, is the same as binning the spectral file, background file and response. However, since it requires only one step and is reversible, changing the grouping is often more convenient than changing the binning. Note that background files should not be grouped since XSPEC will automatically group the background to match the source data. By default, GIS PH mode spectral files are regrouped by a factor of four when saved in XSELECT.
An instance where one must use binning and not grouping is if a response matrix and spectrum have a different number of intrinsic channels. In this case, grouping will not work. Either the spectrum or response matrix must be rebinned.
The instrument response can be split up into two parts. A `redistribution' matrix, which specifies the channel probability distribution for a photon of given energy, and an effective area curve, which specifies the telescope area and window absorption. We refer to the redistribution matrix as the RMF (Redistribution Matrix File) and the effective area curve as the ARF (Ancillary Response File). The combined response is the product of the ARF and RMF and is conventionally termed the RSP (response) file.
Users obtain GIS RMFs from the HEASARC calibration database and generate SIS RMFs using the FTOOL sisrmg. Users generate ARFs appropriate to their spectra using the FTOOL ascaarf.
In XSPEC, RMFs are entered using the response command, while ARFs are entered using the arf command. Alternatively, the RMF and ARF file names can be written into the header of the spectral file using grppha.
GIS RMFs are straightforward. Only one kind, for PH mode, is available. The latest matrices can be found at
ftp://legacy.gsfc.nasa.gov/caldb/data/asca/gis/cpf/95mar06/gis2v4_0.rmf ftp://legacy.gsfc.nasa.gov/caldb/data/asca/gis/cpf/95mar06/gis3v4_0.rmf
The above directory (and the ASCA GOF Web page, should be checked regularly for any later releases.
SIS RMFs are more complicated. Each SIS camera comprises four CCD chips, each of which requires its own RMF. A different RMF is also required for different event grades, split event thresholds, echo and CTI corrections. Moreover, the SIS resolution is degrading with time due to the cumulative effect of radiation damage. Therefore it is now recommended to generate the RMF file for each observation, in PI channels.
The FTOOL sisrmg (v1.0 or later, included in FTOOLS v3.5 or later) should be used to generate the RMF file, appropriate for your data. sisrmg will read the necessary information from the spectral file. Currently, the spectral files do not contain the grade selection information in a easily machine-readable way, therefore that information needs to be supplied on the command line.
tarquin> sisrmg grades=0234 Name of PHA input file [NONE] s0b.pha Name of ARF input file [NONE] Name of RM output file [NONE] s0b.rmf
Note that sisrmg requires the PHA to PI conversion calibration file. You must check that you are accessing the latest file as a new file is often released to keep up with the changing CTI (see §4.5.2). You must force sisrmg to use the latest file either by changing the parameter file or specifying the parameter calfile on the command line.
The ARF input file can be ignored in most cases, unless an RMF file that exactly matches an existing ARF file in terms of the energy grid is required.
The Ancillary Response File (or ARF) contains all the information about
All these effects have been built into a convenient FTOOL called ascaarf which will generate the appropriate ARF for a given spectral file by using information in the spectral file itself - specifically, the WMAP which contains a map of where in the extraction region the counts in the spectrum came from. The energies at which the ARF is calculated are obtained from the corresponding RMF file, hence the arguments of the program are as follows.
The user also needs to tell the program whether the source is point-like, and, if so, whether it is in the center of the WMAP. If the source is point-like and is not centered in the WMAP, then the user is prompted for the unbinned DETX and DETY coordinates of the source. For the case of a point source, ascaarf calculates the effective area at the source position and multiplies this by the (energy-dependent) fraction of events expected to fall within the selected region. For an extended source, ascaarf calculates a weighted-average effective area with the weighting factor being the number of events at each pixel position. In this case no attempt is made to correct for the spatial response and in particular no correction is made for events being scattered out of the selected region (see also §10.6).
Two important hidden parameters for ascaarf, and their default values, are fudge = yes and arffil = yes. The fudge parameter applies adds a Gaussian at 2.2 keV for the SIS and 1.9 keV for the GIS in order to account empirically for sharp residual features in the XRT response. The arffil parameter applies corrections (of order less than 5%) based on the fitting residuals to Crab GIS data. The average for GIS2 and GIS3 are used in the case of the SIS. At the time of going to press (March 1997), a calibration effort is underway to understand the physical origin of both these features and it is expected that ascaarf and the SIS and GIS response matrices will be modified and updated. Therefore the user should regularly check the `Calibration Uncertainties' Web page (§1.7) for recent developments.
Below are listed some more general points about ascaarf.
At present, for spectra, there are two background subtraction techniques. These are (1) subtract suitable portions of the blank-sky observations that the GOF has made available, or (2) subtract a source-free part of the same observation. As the mission matures, it is likely that other, perhaps better, techniques will emerge, possibly involving fully prescriptive background models.
For more information about the GIS background and how to subtract it, please consult the articles by Kubo et al (ASCANews #2, 14) and Ikebe et al. (ASCANews #3, 13). The internal background of the SIS is described by Keith Gendreau in ASCANews #2, 5.
Whatever method is used, the relative normalization between the on-source and background spectra is taken care of by the EXPOSURE and BACKSCAL keywords. The value of the latter keyword is set in every spectral file when it is created (whether from a source or background region) to be proportional to the geometrical detector area of the extraction region (see §8.2.1 for precise definition).
The blank-sky events lists for background subtraction are available at
ftp://legacy.gsfc.nasa.gov/caldb/data/asca/sis/bcf/bgd/94nov/
for the SIS, and at
ftp://legacy.gsfc.nasa.gov/caldb/data/asca/gis/bcf/bgd/94may/
for the GIS. These background files have been created from several superposed PV phase observations and are sorted by cut-off rigidity. They should only be used to create products in detector coordinates. Please note that these files have not been subjected to RTI-based background rejection (see §\ refrtiscrn). This means that, if your source spectrum has RTI-based background rejection, then you should use the XSELECT command gisclean on the file before extracting a background spectrum.
The files themselves are described in detail in the README files that accompany them. As FITS events files, they can be read into XSELECT with the read events command.
An important point to remember for the SIS is that these early blank-sky observations were made with the SIS in 4-CCD mode but the vast majority of point-source Guest Observer observations are made in 1- or 2-CCD mode. Since the SIS internal background depends on clocking-mode, this could lead to problems, especially at high energies (see §8.8.6). Also, the SIS sensitivity is declining with time in a manner which depends on the clocking-mode (primarily due to RDD effects - see §4.6.3) so the blank-sky background may not work well for the more recent observations.
In addition to the blank-sky observations, the ASCA GOF has also made available GIS events files corresponding to observations of the night Earth. Since the night Earth is X-ray dark, the files represent, to a good approximation, the purely instrumental background of the GIS. The files are available at
ftp://legacy.gsfc.nasa.gov/caldb/data/asca/gis/bcf/bgd/night_earth/
Each file contains night Earth events accumulated between 1993 May 28, (after the GIS Spread Discriminator was turned on) and 1994 Feb 8 (just before the temporary GIS3 CPU trouble). As FITS events files, they can be read into XSELECT with the read events command.
The best background subtraction depends on matching as closely as possible the background in your source region. There are four main aspects to this which, to some extent, vary in relative importance depending on the nature of your observation.
Note that the first two are actually mutually exclusive: you can only extract background from the same region as the source by using a different, blank-sky observation; and you can only use an identical set of screening criteria by using the same observation for background and source.
Largely because of the vignetting of the XRT, the responses of the GIS and SIS depend on position in the field of view. For this reason, background events should technically be extracted from the same part of the field of view as the source events. In XSELECT this is easy:
WARNING! If you background region goes outside the chips of the SIS, or outside the GIS detector area, your spectral files will contain the wrong values of BACKSCAL, the background scaling factor, and therefore your background subtraction will be wrong. You must explicitly exclude the off-detector regions.
It is very important that the screening criteria used for the source and the background should be as similar as possible. The first release of background files is not accompanied by the mkf files, so the full range of selection criteria cannot be applied. Since the background files have been screened in a standard way and are sorted by cut-off rigidity, they should be acceptable for most cases. However, if you have a point source, we recommend that, as well as using the background files, you also extract background events from a source-free part of your source field. In the case of the SIS, this should be from the same chip; for the GIS, from a region at the same distance from the optical axis (within 14 arcmin from the optical axis, the GIS background does not vary much).
To find a source-free region, it is a good idea to make soft and hard images in case a contaminating source is not obvious in the image extracted from the full pass band. Of course, this background subtraction method contravenes the previous recommendation, but usually closely matching screening criteria are much more important for good background subtraction. Please use both methods and compare the results.
As mentioned in chapter 4 and §8.8.1, the internal background of the SIS depends on clocking mode, i.e., whether 1-CCD, 2-CCD 4-CCD or parallel sum (FAST) mode was used. Since the total background is dominated by the cosmic background, this effect is small - except at energies above 7 keV. The rate of hot and flickering pixels also depends on mode, and it is possible that if, for example, the 4-CCD background files are used with a 1-CCD mode source file, then spurious, effects could appear. Also, as already mentioned, the effect of RDD (§4.6.3) is reducing the SIS sensitivity with time in a manner which depends on clocking mode so the blank-sky background may not work so well for more recent observations. Better results will often come from using background from a source-free region of the same chip from the current or even from a different observation.
The fields used to make the background files all come from high Galactic latitudes. At low Galactic latitudes, the Galactic X-ray background becomes important so local backgrounds must be used.
The blank-sky data for the SIS are in BRIGHT mode. They may also be used for BRIGHT2 mode source spectra. In this case, do not group or rebin when saving the spectra in XSELECT. Instead, run rbnpha on the saved spectra, using the BRIGHT2LINEAR option.
When analyzing SIS spectra, if the photons from the source are spread over two or more chips and if you chose an extraction region over these chips, you have to consider that the chips have different responses (RMFs).
Note that this method is not mathematically exact, but considered a fairly good approximation. The exact way is to make an ARF for each chip (though this is not so simple), multiply the ARF and RMF for each chip, and average RSPs of different chips with equal weights. Since ARF for each chip can be approximated with the total ARF times (number of counts on that chip)/(total number of counts), the above method should work for most cases.
It may be helpful to add together spectral files from the two GIS or from the two SIS, rather than fit the spectral files with the same model simultaneously. The advantage is that, with the better signal-to-noise, it is easier to see spectral features in the combined spectrum than in the individual spectra.
GIS2 and GIS3 RMFs, though having different names, are identical. Hence, the same RMF can be used for the GIS2 and GIS3 combined spectra, and only the ARFs have to be averaged. So...
tarquin> mathpha Expression to be evaluated[] g2_all.spec+g3_all.spec Units algebraic expression to be performed in (C,R,F or Help)[C] O/p PHA filename[] g23.spec Exposure time flag/value ({value},{file},CALC,NULL or Help)[] CALC Areascal flag/value ({value},{file},NULL or Help)[%] NULL Number of comment strings to be added (up to 4)[1] 0 ......... processing file: g2_all.spec ......... processing file: g3_all.spec ... ... performing algebra in units of COUNTS WARNING - filop 2.1.0: ... Poissonian errors with N<20 assumed for: ...... channels 1.- 7. ...... channels 21.- 49. ...... channels 71.- 128. ... written the PHA data Extension ** mathpha 4.1.2 completed successfully
In the case of 1-CCD mode
In the case of 2-CCD or 4-CCD modes first calculate RSPs for SIS0 and SIS1, combining the RSPs for two or more chips as explained in §8.9. Then follow the procedure for 1-CCD mode.
If the background and the source spectra are made from different detector regions, the BACKSCAL keywords of the background spectra have to be re-written to ensure the correct background normalization. Due account must be taken of the correct weights for the region sizes and exposure times. Full details are given the document `Background Normalization' at the URL
http://heasarc.gsfc.nasa.gov/docs/asca/abc_backscal.html
GIS PH mode has a typical deadtime of about 8 msec per event. For bright sources, GIS deadtime will be significant and deadtime correction is necessary to obtain the correct incident flux through spectral analysis.
GIS deadtime can be calculated using the GIS monitor count rates. The mkf files created in the standard processing have two columns, G2_DEADT and G3_DEADT, in which the deadtime fraction values thus calculated are stored.
Using these deadtime fraction values, with the FTOOL deadtime, the deadtime correction can be done as follows. In this example the GIS spectrum is called g2.spec. As is usual for an ASCA spectral file, the first extension contains the energy spectrum and the second extension contains the GTIs. At the system prompt type
deadtime g2.spec+1 g2.spec+2 ft941222_1327_0210.mkf exposure=EXPOSURE deadcol=G2_DEADT
The EXPOSURE keyword in the spectral extension is overwritten with the correct exposure time taking deadtime into account. It is a good idea, when using deadtime, to verify that the value of EXPOSURE decreases due to the deadtime correction. (The FTOOLS grppha or fkeyprint can conveniently display the value of the EXPOSURE keyword).
XSPEC is a powerful and versatile spectral-fitting program. It is fully documented, with an extensive manual and on-line help which can be obtained at the URL
http://heasarc.gsfc.nasa.gov/docs/xanadu/xspec/u_manual.html.
(local copy on this CD)
The following, which covers XSPEC basics, is a very brief guide to get you started.
Having typed XSPEC to start the program, there are two ways of entering data: with XSPEC commands, or with the header keywords in the spectral file. A third method, using a command file, is really a more convenient version of the first.
To illustrate these methods, we assume we have produced and obtained the following files for our SIS0-chip1 data:
mkn841_s0c1.pi | source spectral file |
back_s0c1.pi | background file |
mkn841_s0c1.arf | ARF |
s0c1g0234p40e1_512v0_8i.rmf | RMF |
Each of these files has a different XSPEC command which enters it into the program. These are:
XSPEC>data mkn841_s0c1.pi XSPEC>backgrnd back_s0c1.pi XSPEC>arf mkn841_s0c1.arf XSPEC>response s0c1g0234p40e1_512v0_8i.rmf
These lines can be copied with a text editor into an ASCII command file data_s0c1.xcm, say, and run with the XSPEC command @data_s0c1.
Alternatively, you can write the names of the background file, ARF and RMF into the header of the spectral file with the FTOOL grppha. Keyword values are changed with the grppha command chkey. In our example, the following grppha commands would be used:
chkey BACKFILE back_s0c1.pi chkey ANCRFILE mkn841_s0c1.arf chkey RESPFILE s0c1g0234p40e1_512v0_8i.rmf
Note that grppha will overwrite an existing file (rather than create a new one) only if an exclamation mark is put before the input file name, as in:
tarquin> grppha mkn841_s0c1.pi Please enter output filename[]!mkn841_s0c1.pi
More than one data file can be entered into XSPEC. For more information about the data command, consult the XSPEC manual or type help commands data at the XSPEC> prompt.
It is nearly always good policy to exclude from a fit channels at the lower and upper ends of the pass band, where the instrument efficiency is low, the background predominant and the calibration less certain. The XSPEC command ignore causes channels to be excluded: ignore 1-40, for example, excludes channels 1-40, while ignore bad will exclude channels with a quality flag of 5. Note that the ignore command operates on regrouped channels, not on the original channels. Its inverse is the notice command.
Users can set quality flags themselves with grppha. Typing help quality at the GRPPHA> prompt explains how to do so.
Versions of XSPEC later than 9.0 allow the user to ignore or notice channels by specifying energy ranges directly. Thus
ignore 1-4:0.0-0.7
will ignore all channels in files 1-4 between 0.0 and 0.7 keV.
In XSPEC, models are built up from a suite of model components which are either `additive' (supplying model photons) or `multiplicative' (modifying the flux of model photons). To see a list of the models available in XSPEC, type model ?.
Models are defined with the model command. For example, the spectrum of a high-redshift quasar with both Galactic and intrinsic absorption might be defined by the command model wabs * zwabs (zpowerl). For help on the model command, type help commands model and for an explanation of an individual component, type, e.g., help model zwabs. Once the model command is entered, the user is prompted for the initial values of the corresponding parameters (a carriage return enters the default).
Parameters are fixed with the freeze command and unfixed with the thaw command. To change a parameter value, use the newpar command.
For more information about XSPEC models, please consult the XSPEC manual and on-line help. In particular note that major changes to model syntax were introduced in XSPEC v10.0.
After defining a model and assigning initial parameter values, fitting is initiated by typing the command fit. If a minimum is not found after 10 iterations, the user is given the option of continuing or stopping - perhaps to reset parameters or to try a different model. When the fit converges, a summary is displayed on the screen giving the best-fitting parameter values and chi-squared.
The fit command has several options which you learn about by typing help commands fit at the XSPEC> prompt.
Although some errors are displayed at the culmination of a successful fit, these errors are approximate and should not be quoted in scientific papers. Instead, you should use the error command which initiates a further search of chi-squared space to find the width of the minimum in terms of parameter confidence ranges. For example, error 3 will find the 90 per cent confidence range for the third parameter, i.e., the values which cause chi-squared to depart from its minimum by an increment of 2.7. For more options, type help commands error.
Plotting the results of a fit in XSPEC is a three-stage process:
To make a PostScript file of your plot, use iplot rather than plot and type, for example, hard two_temp_fit.ps/ps at the PLT> prompt to create the PostScript file two_temp_fit.ps.