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 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-Poissonian), 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.13.
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://heasarc.gsfc.nasa.gov/caldb/data/asca/gis/cpf/95mar06/gis2v4_0.rmf
ftp://heasarc.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.
ascaarf needs XRT response functions to calculate ARFs, as well as the source distribution. In the standard method, the precalculated XRT response files (effective area and point spread function) are used, and users should specify the type of source distribution. In the Ray-tracing method, which is a new feature since ascaarf v3.00, users should specify a set of ray-raced images for a particular source distribution.
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 XRT calibration files8.1 are usually specified as hidden parameters):
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 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. For extended sources, creating ARFs through ray-tracing will be more precise (see below; see also §10.6).
Two important hidden parameters for ascaarf, and their default values, are fudge = yes and arffil = yes. The fudge parameter applies 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.
In this method, first, you have to create a set of ray-traced images using the ascaray ftool. You should run ray-tracing for each of the energy bins which should cover the entire RMF energy range with minute enough resolution. The make_ascaray_images script will run ascaray sequentially to create a set of ray-traced images to be used with ascaarf.
For the usage of make_ascaray_images and
how to create ARFs for extended sources using ascaarf, please find
http://heasarc.gsfc.nasa.gov/docs/asca/make_ascaray_images/.
In principle, the ray-tracing method can be used for any types of source distribution (including point-sources), and create precise ARFs as long as there are no spectral variations within the distribution8.3. However, this method is most effective when the source distribution is known to be completely flat over the detector field of view, in which case we can create accurate ARFs and carry out precise spectral analysis. See the URL address above for an examples of the Cosmic X-ray Background analysis.
We have created sets of ray-traced images using make_ascaray_images for uniformly extended sources with the radius of 1 degree, 2 degrees, and 3 degrees. These images are found at
Users may use these ready-made ray-tracing results with ascaarf to create ARFs for uniformly extended sources with 1, 2 or 3 degree radius, or run make_ascaray_images by themselves for different source distributions.
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).
ftp://heasarc.gsfc.nasa.gov/caldb/data/asca/sis/bcf/bgd/94nov/
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. 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.3). Also, the SIS sensitivity is declining with time in a manner which depends on the clocking-mode (primarily due to RDD effects - see §4.8) so the blank-sky background may not work well for the more recent observations.
ftp://heasarc.gsfc.nasa.gov/caldb/data/asca/gis/bcf/bgd/no_sources.
Standard data screening including the RTI filtering (§5.3.2) is already carried out in these event files.Because of the masking of the point sources, you must compute the effective exposure time for each pixel using the mkgisbgd FTOOL, otherwise you will get wrong results. Please read
http://heasarc.gsfc.nasa.gov/docs/asca/docs/asca/mkgisbgd/mkgisbgd.html
for more information on how to use these files.
The previous version of GIS blank sky dataset, which is collected
during the PV phase and includes dim point sources,
is still available at
ftp://heasarc.gsfc.nasa.gov/caldb/data/asca/gis/bcf/bgd/94may/.
This old dataset may be still useful, since you can read them directly in XSELECT to extract spectra. Please note that the old dataset has not been subjected to RTI-based background rejection (see §5.3.2), 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.
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.
There is a new release of Night-Earth observations, covering the period from 1993 June to 1999 August (total 13 Msec exposure and 1.6 million events per sensor):
ftp://heasarc.gsfc.nasa.gov/caldb/data/asca/gis/bcf/bgd/night_earth_1999/.
The files have been processed using the identical screening that applied to the standard processed data. If needed, and depending on the analysis, it is possible to apply additional cuts on these files.
As FITS events files, they can be read into XSELECT with the read events command. Please access
http://heasarc.gsfc.nasa.gov/docs/asca/gis_night_earth/gis_night_earth.html
for more information on these Night Earth Observations. In particular, please note that there is a long term increase of the Night Earth event counting rates (= GIS intrinsic background), which you may have to take into account for background sensitive observations.
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.8) 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 blank sky background files all have high Galactic latitudes. For observations which are within 3 or 4 degrees of the Galactic plane, the Galactic X-ray background can become important. It may be necessary, in those cases to use a background spectrum extracted from a source-free region of the field of view and compare with the results obtained with the high-galactic background. Within 10 arcmin radius, the GIS background is relatively flat and its two main components (Cosmic X-ray background and Non-X-ray background) can be considered together.Beyond this limit, this assumption is no longer true (the CXB and NXB behave in fact very differently as a function of radius) and results are to be considered with extreme caution (see §10 and section on extended sources).
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 may not be 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.
If you want to follow the exact way by creating ARFs for each chip, you may use the addascaspec script to combine spectral files and responses for different chips (§8.10).
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. By the same reason, you may want to combine two or more spectral files taken with the same detector at different time periods. The addascaspec script may be used for this purpose. This script, written in Perl, runs several ftools such as mathpha, addarf, addrmf and marfrmf sequentially to perform the task.
gis2.spec gis3.spec gis2_bgd.spec gis3_bgd.spec gis2.arf gis3.arf
Note that 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.
addascaspec listfile gis23.spec gis23.arf gis23_bgd.spec
This command creates the GIS2 and 3 combined spectral file (gis23.spec), background file (gis23_bgd.spec), and ARF (gis23.arf).
Follow the same procedure to combine two or more GIS spectral files taken at different periods.
In the case of 1-CCD mode:
sis0.spec sis1.spec sis0_bgd.spec sis1_bgd.spec sis0.arf sis0.arf sis0.rmf sis0.rmf
addascaspec listfile sis01.spec sis01.rsp sis01_bgd.spec
This command creates the SIS0 and 1 combined spectral file (sis01.spec), background file (sis01_bgd.spec), and RSP (= RMF and ARF combined) (sis01.rsp).
In the case of 2-CCD or 4-CCD modes, first combine the chips by calculating the spectral files, ARFs and RMFs for SIS0 and SIS1 each (§8.9). Then follow the procedure above for 1-CCD mode to combine sensors.
Alternatively, you may create spectral files, RMFs and ARFs for individual chips, then combine them at once with addascaspec (§8.9).
If the background and the source spectra are made from different detector regions, the BACKSCAL keywords of the background spectra have to be calculated to specify the correct background normalization. Due account must be taken of the correct weights for the region sizes and exposure times, but this is automatically taken into account by addascaspec. If you are interested, full details of how to calculate the BACKSCAL value when combining two or more energy spectra are given in the document `Background Normalization' at
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 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).
corpileup reads a cleaned SIS event file, determines the point source center and the radius within which pile-up is too significant to be corrected, and creates a spectral file with the pile-up correction from the region outside.
The corpileup output spectral file is ready to be used in XSPEC, but responses have to be created independently. Therefore, the following procedure should be taken to carry out SIS spectral analysis with pile-up correction:
For more details, as well as the algorithm of pile-up correction, please refer to the corpileup help file.
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/manual/manual.html.
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.