Last modified: 05 December 2022

URL: https://cxc.cfa.harvard.edu/ciao/threads/ssospec/

Extracting a Spectrum of a Solar System Object

CIAO 4.15 Science Threads


Overview

Synopsis:

The sso_freeze tool can reproject the event data to the reference frame of the solar system object, as well as creating an object-centered aspect solution file. Together these files can be used to extract an object-centered spectrum and create the corresponding Response Matrix Files (RMFs) and Ancillary Response Files (ARFs).

This procedure is similar to the basic spectral extraction explained in the Extract Spectrum and Response Files for an Extended Source except that an object-centered coordinate system (ocx,ocy) is used in place of the sky (x,y) coordinates.

[IMPORTANT]
chandra_repro now runs sso_freeze

[New] chandra_repro will now automatically run sso_freeze if it locates a solar-system ephemeris file in the primary directory. To check if sso_freeze has been run, look for the Object Centered coordinate columns, ocx,ocy, in the output file

unix% dmlist 1463/repro/acisf01463_repro_evt2.fits cols | grep ocx,ocy
  17   oc(ocx,ocy)          pixel        Real8          0.50:     8192.50    -          Object centered coordinates

Users must not (re-)run sso_freeze on an event file with existing Object Centered coordinate columns. This triggers a bug in sso_freeze which will create new columns with the same name; this causes problems with other tools.

Purpose:

To generate source and background PI (PHA) spectra of a solar system object and build the proper RMFs and ARFs.

Related Links:

Last Update: 05 Dec 2022 - Updated for CIAO 4.15. chandra_repro will now automatically run sso_freeze for solar system objects. Users must not re-run it again to avoid a bug that creates duplicate columns in the output.


Contents


Get Started

Download the sample data: 1463 (ACIS-S, Jupiter)

[NOTE]
Early dataset

The data used in this thread was taken very early in the Chandra mission. It was not included in the bulk reprocessing metioned in the Watchout page. The keywords required for analysis with CIAO need to be added by running chandra_repro or r4_header_update.

In this thread, we assume that all relevant files are in the same working directory.


Creating Object-centered Event and Aspect Solution Files

There are separate threads which describe the sso_freeze tool and its uses in detail:

The following command was used to create the event and aspect solution files for this thread:

unix% punlearn sso_freeze
unix% sso_freeze infile=acisf01463_repro_evt2.fits asolfile=pcadf01463_repro_asol1.fits \
      scephemfile=orbitf059443264N002_eph1.fits ssoephemfile=jupiterf059875200N002_eph1.fits \
      ocsolfile=1463_oc_asol1.fits outfile=1463_oc_evt2.fits

Define the Source and Background Regions

The first step is to create source and background regions. To do this, display the data in the object-centered coordinates (ocx,ocy):

unix% ds9 "1463_oc_evt2.fits[bin=ocx,ocy]" &

In this example, the source (Jupiter) is defined by an annulus with a radii of ~34 and 53 pixels and the background is defined by large offset circle with radius = 76 pixels. Both regions are shown in Figure 1.

The regions should be saved in CIAO format in Physical pixels.

Figure 1: Extraction regions on the event file

[Thumbnail image: The source region is shown as a white circle; the background region is comprised of the three green, dashed circles.]

[Version: full-size]

[Print media version: The source region is shown as a white circle; the background region is comprised of the three green, dashed circles.]

Figure 1: Extraction regions on the event file

The background was chosen from a from source-free area of the same chip.

The resulting region files look like:

unix% cat oc_src.reg
# Region file format: CIAO version 1.0
annulus(4115.9776,4086.9531,33.494449,52.829184)

unix% cat oc_bg.reg
# Region file format: CIAO version 1.0
circle(3915,4124,75.945914)

It is a good idea to check the image in sky(x,y) coordinates as well to be sure that there are not any point sources which might contaminate the background region. These point sources show up as streaks in the object-centered image and may be difficult to see. A few sources to avoid are marked with white circles in Figure 2.

Figure 2: Event file displayed in sky (x,y) coordinates

[Thumbnail image: The x-ray point sources are circled in white.]

[Version: full-size]

[Print media version: The x-ray point sources are circled in white.]

Figure 2: Event file displayed in sky (x,y) coordinates

When choosing the background regions, be sure to avoid areas where the x-ray point sources - circled in white - might contribute to the counts.

The dmimghull tool can used to further visualize the extraction region. The key is to filter the event file in object centered coordinate but bin on the sky coordinates. The output from dmimghull is a polygon that encloses all non-zero pixels in the input image. This provides a way to visualize what part of the sky is included in the object-centered regions.

unix% dmimghull "1463_oc_evt2.fits[oc=region(oc_src.reg)][bin sky]" src.hull clob+
unix% dmimghull "1463_oc_evt2.fits[oc=region(oc_bg.reg)][bin sky]" bg.hull clob+

The result, shown in Figure 3 shows which part of the sky is included in the source and background regions. Even though the source and background regions overlap on the sky, they do not overlap in time. Events in the object-centered background region that are located in the source sky region are only included after the solar system object has moved across the detector.

Figure 3: Approximate source and background regions on the sky

[Thumbnail image: Approximate source and background regions on the sky]

[Version: full-size]

[Print media version: Approximate source and background regions on the sky]

Figure 3: Approximate source and background regions on the sky

A polygon is drawn around sky pixels included in the Source region (white) and background region (green).

While the regions overlap on the sky, they do not overlap in the Object Centered coordinate system, or another way to say it is that the regions do not overlap in Time.

These regions should not be used for spectral extraction; they are purely for visualization. The spectrum will be extracted using the object centered regions.


Extract Source and Background Spectra

The source and background can be extracted using the specextract script. The BACKSCAL keyword will need to be manually updated as is shown below. For solar system objects users need to be careful to

  1. Create weighted responses. Since the solar system objects move across the detector they require response file that were generated from the area of the detector that was exposed.
  2. Filter the input event file on both object centered and sky coordinates. specextract requires the infile name contain a sky= filter. Using the all inclusive field() shape can be used to meet this requirement.

The following parameters example shows how the object centered region files are used together with the sky=field() filter. Since the background is going to be in this example subtracted (see below) there is no need to create background response files.

unix% pset specextract infile="1463_oc_evt2.fits[oc=region(oc_src.reg)][sky=field()]"
unix% pset specextract bkgfile="1463_oc_evt2.fits[oc=region(oc_bg.reg)][sky=field()]"
unix% pset specextract weight=yes
unix% pset specextract weight_rmf=yes
unix% pset specextract bkgresp=no
unix% pset specextract outroot=jupiter 

and then run the script

unix% specextract
Source event file(s) (1463_oc_evt2.fits[oc=region(oc_src.reg)][sky=field()]): 
Output directory path + root name for output files (jupiter): 
  
Running specextract
Version: 11 January 2022

Aspect solution file pcadf01463_repro_asol1.fits found.

Bad pixel file acisf01463_repro_bpix1.fits found.

Mask file acisf01463_000N004_msk1.fits found.

Setting bad pixel file 

Setting bad pixel file 

Extracting src spectra 

Extracting bkg spectra 

Using mkacisrmf...

Using mkacisrmf...

Using mkacisrmf...

Creating src ARF 

Using mkacisrmf...

Creating src RMF 

Grouping src spectrum 

Updating header of jupiter.pi with RESPFILE and ANCRFILE keywords.

Updating header of jupiter_grp.pi with RESPFILE and ANCRFILE keywords.

Updating header of jupiter.pi with BACKFILE keyword.

Updating header of jupiter_grp.pi with BACKFILE keyword.

Users may also follow the step-by-step instructions for extracting a spectrum and creating response files for extended thread.


Update the BACKSCAL keywords

The only difference between extracting a spectrum in object-centered coordinates is that the area of the regions must be computed manually and added to the spectrum header files. The area is stored in the BACKSCAL keyword and is equal to the geometric area divided by the total field area -- for ACIS this is =81922.

If the regions are simple, then the geometric area may be computed directly from the shape parameters (eg πr2). An easy way to automatically compute the area for any region is shown below. It uses the regArea and regParse routines in the Python region module.

unix% python -c 'from region import *;print(CXCRegion("oc_src.reg").area()/(8192*8192))'
7.81336151698e-05
unix% dmhedit jupiter.pi file= op=add key=BACKSCAL value=7.81336151698e-05
unix% dmhedit jupiter_grp.pi file= op=add key=BACKSCAL value=7.81336151698e-05

and then repeated for the background region and spectrum

unix% python -c 'from region import *;print(CXCRegion("oc_bg.reg").area()/(8192*8192))'
0.000270009355215
unix% dmhedit jupiter_bkg.pi file= op=add key=BACKSCAL value=0.000270009355215

The spectrum and response files are now ready for fitting.


Fitting

To fit the spectrum using the RMF and ARF, simply read the source spectrum FITS file into Sherpa, subtract the background, and fit it. See the Introduction to Fitting PHA Spectra thread for details.


Analysis Caveats

Users should be cautious about analyzing the data for sources near the edges of the ACIS CCDs.

  1. For X-rays passing through the mirrors, the very bottom of each CCD is obscured by the frame store. As a result, some of the events in rows with CHIPY <= 8 are not detected. (The set of rows affected varies from CCD to CCD.) Since the CIAO tools do not compensate for this effect, the ARFs and exposure maps for sources in these regions may be inaccurate.

  2. For sources within about thirty-two pixels of any edge of a CCD, the source may be dithered off the CCD during part of an observation. The aspect histogram, which is used to create ARFs and exposure maps, is designed to compensate for this effect.

  3. An ARF calculated at the edge of a chip will not be accurate since the response tools for spectral extraction (specifically the ARF) assume that 100% of the PSF is enclosed - i.e. on the chip - all the time, which may not be the case. The amount of error introduced depends on how close the source is to the edge, the morphology of the source, and the characteristics of the PSF, which depends on the source spectrum.

  4. A contaminant has accumulated on the optical-blocking filters of the ACIS detectors, as described in the ACIS QE Contamination why topic. Since there is a gradient in the temperature across the filters (the edges are colder), there is a gradient in the amount of material on the filters. (The contaminant is thicker at the edges.) Within about 100 pixels of the outer edges of the ACIS-I and ACIS-S arrays, the gradient is relatively steep. Therefore, the effective low-energy (' 1 keV) detection efficiency may vary within the dither pattern in this region. The ARF and instrument map tools are designed to read a calibration file which describes this spatial dependence.


History

24 Jul 2009 new for CIAO 4.1
15 Jan 2010 updated for CIAO4.2: changes to the ds9 region menu
13 Jan 2011 reviewed for CIAO 4.3: no changes
01 Mar 2011 CALDB 4.4.2 release: fix to the header of the ACIS QE contamination file. Prior to this release, CIAO would fail when trying to look up the contamination model correction for chips ACIS-8 (S4) and ACIS-9 (S5); added missing information on CALDB 4.4.1 release (15 Dec 2010)
04 Apr 2011 updated for 04 Apr scripts package release: acis_fef_lookup script prints the version at verbose > 0.
26 Apr 2011 install version 2 of the tools package for CIAO 4.3 to fix the mkrmf bug.
20 Jul 2011 required software updates are listed in Synopsis
10 Jan 2012 reviewed for CIAO 4.4: no changes
03 Dec 2012 Review for CIAO 4.5; minor edits
11 Dec 2013 Review for CIAO 4.6; updated for pbkfile deprecation. Added note about very early dataset.
24 Jul 2014 Large parts of the thread have been re-written. Due to the data being taken across a large part of the detector, users should be creating weighted responses. Specextract can be used to extract the spectrum and response files as long as the BACKSCAL keyword is updated. Added an example showing how to use dmimghull to help visualize the object-centered region in sky coordinates.
23 Dec 2014 Reviewed for CIAO 4.7; no changes.
09 Apr 2018 Reviewed for CIAO 4.10; only minor edits for python3 compatibility.
14 Feb 2022 Review for CIAO 4.14.
05 Dec 2022 Updated for CIAO 4.15. chandra_repro will now automatically run sso_freeze for solar system objects. Users must not re-run it again to avoid a bug that creates duplicate columns in the output.