Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: 4 December 2014

URL: http://cxc.harvard.edu/ciao/threads/fluxes/

Calculate source count rates and fluxes

CIAO 4.9 Science Threads


Overview

Synopsis:

CIAO provides a number of tools for calculating count rates and source fluxes - e.g. aprates, modelflux, eff2evt - as described in the Compute Net Counts, Rate, or Flux for Point Sources thread. The srcflux script simplifies the running of these tools.

Please note that srcflux can only be used with Chandra imaging mode data.

Run this thread if:

you want to calculate net counts, source rate, photon flux, and/or energy flux for ACIS or HRC data, and do not need to follow the manual steps described in Compute Net Counts, Rate, or Flux for Point Sources.

Related Links:

Last Update: 4 Dec 2014 - Review for CIAO 4.7. Updated dmcoords call as the aspect solution file is no longer required; the information needed to account for the SIM drift is now included in the headers.


Contents


Get Started

Download the sample data: 6436 (ACIS-I/NGC 1333)

For this thread we are going to reprocess the data and use fluximage to create an image of the ACIS-I array. This is shown in case you wish to follow along, but are not required steps for using srcflux!

Reprocessing the data

Here we reprocess the data, using chandra_repro, to make sure we are using the latest calibration products. This step may not need to be taken for your dataset.

unix% cd 6436
unix% punlearn chandra_repro
unix% chandra_repro mode=h

A quick look at the data

The fluximage script is used to create a fluxed image of the ACIS-I array, as shown in Figure 1. For this example we use a bin size of 4, so each pixel in the output image is 1.968 arcsecond on a side, which is significantly larger than the on-axis PSF. For your own analysis you may wish to use a smaller binsize value.

unix% punlearn fluximage
unix% fluximage "repro/acisf06436_repro_evt2.fits[ccd_id=0:3]" fimg/ bands=broad,csc bin=4
Running fluximage
Version: 13 December 2013

Using CSC ACIS broad science energy band.
Using CSC ACIS soft science energy band.
Using CSC ACIS medium science energy band.
Using CSC ACIS hard science energy band.
Aspect solution repro/pcadf268499655N002_asol1.fits found.
Bad-pixel file repro/acisf06436_repro_bpix1.fits found.
Mask file repro/acisf06436_000N002_msk1.fits found.

The output images will have 567 by 565 pixels, pixel size of 1.968 arcsec,
    and cover x=2884.5:5152.5:4,y=2996.5:5256.5:4.

Running tasks in parallel with 4 processors.
Creating aspect histograms for obsid 6436
Creating 16 instrument maps for obsid 6436
Creating 16 exposure maps for obsid 6436
Combining 4 exposure maps for 4 bands (obsid 6436)
Thresholding data for obsid 6436
Exposure-correcting 4 images for obsid

The following files were created:

 The clipped counts images are:
     fimg/broad_thresh.img
     fimg/soft_thresh.img
     fimg/medium_thresh.img
     fimg/hard_thresh.img

 The clipped exposure maps are:
     fimg/broad_thresh.expmap
     fimg/soft_thresh.expmap
     fimg/medium_thresh.expmap
     fimg/hard_thresh.expmap

 The exposure-corrected images are:
     fimg/broad_flux.img
     fimg/soft_flux.img
     fimg/medium_flux.img
     fimg/hard_flux.img

[Thumbnail image: The ACIS-I field has sources covering it.]

[Version: full-size]

[Print media version: The ACIS-I field has sources covering it.]

Figure 1: Three-color view of the field

unix% cd fimg
unix% ds9 -rgb -red soft_flux.img -green medium_flux.img -blue hard_flux.img \
         -rgb lock scale yes -rgb lock smooth yes -log -smooth

The field contains a number of sources, with varying brightness and X-ray spectra, since there are a range of colors in this image. The background appears relatively flat, and the source density is not really high, which simplifies the calculation of source and background apertures later in the thread.

The arrow indicates the source used in the A single source section.


A single source

We shall start by finding the flux of one source; later sections will show how to run with multiple sources.

For this run we shall use the source close to 3400,3800 (Figure 1). As srcflux needs the celestial location, we use dmstat to get a more accurate location and then feed it through dmcoords to do the conversion (you can read the value dircetly from ds9 or use any other technique to get the location).

unix% dmstat "fimg/broad_flux.img[sky=circle(3397,3781,20)]" cen+
PFLUX_IMAGE(x, y)[/cm**2 /s]
    min:	0 	      @:	( 3390.5 3762.5 )
    max:	4.1726059862e-05 	      @:	( 3398.5 3782.5 )
cntrd[log] :	( 5.7077142973 5.7673818641 )
cntrd[phys]:	( 3397.3308572 3781.5695275 )
sigma_cntrd:	( 0.0086358657222 0.0086427118037 )
   good:	81
   null:	40
unix% dmcoords fimg/broad_flux.img opt=sky x=3397.33 y=3781.57
unix% set ra = `pget dmcoords ra`
unix% set dec = `pget dmcoords dec`
unix% echo "$ra $dec"
03:29:29.250 +31:18:34.73

We are now ready to run srcflux (the unimaginative output name is to make it easier to compare with later runs of srcflux):

unix% punlearn srcflux
unix% srcflux repro/acisf06436_repro_evt2.fits "$ra $dec" single/run1
srcflux
          infile = repro/acisf06436_repro_evt2.fits
             pos = 03:29:29.250 +31:18:34.73
         outroot = single/run1
           bands = broad
          srcreg =
          bkgreg =
         bkgresp = yes
       psfmethod = ideal
         psffile =
            conf = 0.9
         rmffile =
         arffile =
           model = xsphabs.abs1*xspowerlaw.pow1
       paramvals = abs1.nH=0.0;pow1.PhoIndex=2.0
        absmodel =
       absparams =
           abund = angr
         fovfile =
        asolfile =
         mskfile =
        bpixfile =
         dtffile =
         ecffile = CALDB
        parallel = yes
           nproc = INDEF
          tmpdir = /tmp
         clobber = no
         verbose = 1
            mode = ql

Extracting counts
Setting Ideal PSF : alpha=1 , beta=0
Getting net rate and confidence limits
Getting model independent fluxes
Getting model fluxes
Getting photon fluxes
Running tasks in parallel with 4 processors.
Running eff2evt for single/run1_broad_0001_src.dat
Running aprates for single/run1_broad0001_rates.par
Running eff2evt for single/run1_broad_0001_bkg.dat
Making response files for single/run1_0001
Running modeflux for region 1
Adding net rates to output
Appending flux results onto output
Appending photflux results onto output
Computing Net fluxes
Adding model fluxes to output
Scaling model flux confidence limits


Summary of source fluxes

Position                               0.5 - 7.0 keV
                                       Value        90% Conf Interval
3 29 29.25 +31 18 34.7  Rate           0.0398 c/s (0.0381,0.0415)
                        Flux           5.17E-13 erg/cm2/s (4.94E-13,5.39E-13)
                        Mod.Flux       4.38E-13 erg/cm2/s (4.2E-13,4.57E-13)

The count rate and flux estimates are displayed on the screen and written to the output file, which here is single/run1_broad.flux.

unix% dmlist single/run1_broad.flux"[cols net_rate_aper,net_flux_aper,net_mflux_aper,net_umflux_aper]" data,clean
#  NET_RATE_APER        NET_FLUX_APER        NET_MFLUX_APER       NET_UMFLUX_APER
           0.03979810      5.167279112E-13      4.384556677E-13                  NaN

The errors are also included; for instance the model-independent flux estimate:

unix% dmlist single/run1_broad.flux"[cols net_flux_aper,net_flux_aper_lo,net_flux_aper_hi]" data,clean
#  NET_FLUX_APER        NET_FLUX_APER_LO     NET_FLUX_APER_HI
      5.167279112E-13      4.944322446E-13      5.391586087E-13

Since we did not supply any region information (the srcreg and bkgresp parameters were left empty), the script calculated a source aperture radius based on the 90% enclosed-count fraction of the PSF at 1 keV for the source location, and the background is an annulus around this. The output file contains information on the source and aperture regions (there are also ROTANG and COMPONENT columns), as shown below.

unix% dmlist single/run1_broad.flux"[cols shape,r,area,bg_area]" data,clean
#  SHAPE              R[2]                                     AREA                 BG_AREA
 Circle                        10.28780                    0               332.50           7979.43750

For this particular source, which is not on-axis (it is 6 arc minutes off axis), the size of the point source is significantly larger than the on-axis performance, which is why the radius used is 5 arcseconds.

unix% dmlist single/run1_broad.flux"[cols theta,phi]" data,clean
#  THETA                PHI
         6.2879507976       298.9574365002
unix% dmlist single/run1_broad.flux"[cols theta,phi]" cols

--------------------------------------------------------------------------------
Columns for Table Block HISTOGRAM
--------------------------------------------------------------------------------

ColNo  Name                 Unit        Type             Range
   1   THETA                arcmin       Real8          -Inf:+Inf            Off axis angle
   2   PHI                  deg          Real8          -Inf:+Inf            Azimuth angle

Since psfmethod=ideal, the count rate and fluxes are not corrected to account for the finite PSF size. This can be seen by looking at the PSFFRAC and BG_PSFFRAC columns, which give the enclosed-count fraction (ECF) of the PSF for the source and background aperture repectively:

unix% dmlist single/run1_broad.flux"[cols psffrac,bg_psffrac]" data,clean
#  PSFFRAC              BG_PSFFRAC
                  1.0                    0

The output-file section describes the columns in the output file.

In this example we left the various *file parameters of srcflux empty, which means that it used the header keywords in the event file to find them: if this does not work, or you want to use your own versions of these files, then set the appropriate parameter - aspect solution, mask, bad pixel, and the FOV file - before running the script. If these files cannot be located some of the flux values cannot be computed and will be returned as NAN.

The script also creates spectra and responses, so that you can analyze them yourself, if they have enough counts.

unix% ls -1 single/run1_*
single/run1_0001.arf
single/run1_0001.pi
single/run1_0001.rmf
single/run1_0001_bkg.pi
single/run1_0001_bkgreg.fits
single/run1_0001_grp.pi
single/run1_0001_nopsf.arf
single/run1_0001_srcreg.fits
single/run1_broad.flux
unix% sherpa
-----------------------------------------------------
Welcome to Sherpa: CXC's Modeling and Fitting Package
-----------------------------------------------------
CIAO 4.8 Sherpa version 1 Thursday, December 3, 2015

sherpa-1> load_data("single/run1_0001.pi")
read ARF file single/run1_0001.arf
read RMF file single/run1_0001.rmf
read ARF (background) file single/run1_0001.arf
read RMF (background) file single/run1_0001.rmf
read background file single/run1_0001_bkg.pi
sherpa-2> subtract()
sherpa-3> group_counts(20)
sherpa-4> ignore(None, 0.6)
sherpa-5> ignore(7,None)
sherpa-6> set_source(xsphabs.abs1 * xspowerlaw.pow1)
sherpa-7> abs1.nh = 0
sherpa-8> pow1.phoindex = 2
sherpa-9> calc_energy_flux(0.5, 7)
          4.2305760894875184e-09
sherpa-10> f0 = calc_energy_flux(0.5, 7)
sherpa-11> pow1.norm.val *= 4.384556677E-13 / f0
sherpa-12> calc_energy_flux(0.5, 7)
           4.3845566770000115e-13
sherpa-13> plot_fit()
sherpa-14> log_scale()

which creates Figure 2.

[Thumbnail image: The source has enough counts to fit a spectrum.]

[Version: full-size]

[Print media version: The source has enough counts to fit a spectrum.]

Figure 2: Spectrum of the source

Since the analysis was performed on a bright source there are enough counts to fit a model and calculate the flux from that, for this source. Here we include, as a red line, the model that srcfluc used to calculate the NET_MFLUX_APER value; line 11 adjusts the normalization of the model so that the flux is the same as calculated by the script. As can be seen, for this source the model is not a good fit, so the parameter values need adjusting or a more appropriate model expression should be used.

Please the Sherpa threads, in particular the Calculating Model Flux and Flux Uncertainty and Calculating Uncertainties by Simulating Flux Distributions threads for more information.

[WARNING]
PSF correction and the ARF created by srcflux

The ARFs saved by srcflux for each source - such as single/run1_0001.arf in the example above - have been corrected for aperture size (i.e. by running arfcorr on them) - whatever the psfmethod parameter setting is.

Correcting for Galactic absorption

We are going to change the absorbing column value using prop_colden, as shown below:

unix% prop_colden d nrao eval 3 29 29.25 31 18 34.73
Looking for /soft/ciao/config/jcm_data/nrao.fits
------------------------------------------------------------------------------------------
Input coords:  03 29 29.25 +31 18 34.73
Target RA,Dec (B1950): 03 26 23.595 +31 08 17.581   (l,b):158.397653   -20.466863
Density integrated from   -550.000 to    550.000 km/s
Hydrogen density (10^20 cm**(-2)):  14.64
------------------------------------------------------------------------------------------

With this value we change the model used so that the absorbing component is moved to the absmodel parameter, remembering to convert from the units of 1020 cm-2 provided by prop_colden to 1022 cm-2 required by the xsphabs model:

unix% pset srcflux model=xspowerlaw.pow1 paramvals="pow1.phoindex=2"
unix% pset srcflux absmodel=xsphabs.abs1 absparams="abs1.nh=0.1464"
unix% srcflux repro/acisf06436_repro_evt2.fits "$ra $dec" single/run2
srcflux
          infile = repro/acisf06436_repro_evt2.fits
             pos = 03:29:29.250 +31:18:34.73
         outroot = single/run2
           bands = broad
          srcreg =
          bkgreg =
         bkgresp = yes
       psfmethod = ideal
         psffile =
            conf = 0.9
         rmffile =
         arffile =
           model = xspowerlaw.pow1
       paramvals = pow1.phoindex=2
        absmodel = xsphabs.abs1
       absparams = abs1.nh=0.1464
           abund = angr
         fovfile =
        asolfile =
         mskfile =
        bpixfile =
         dtffile =
         ecffile = CALDB
        parallel = yes
           nproc = INDEF
          tmpdir = /tmp
         clobber = no
         verbose = 1
            mode = ql

Extracting counts
Setting Ideal PSF : alpha=1 , beta=0
Getting net rate and confidence limits
Getting model independent fluxes
Getting model fluxes
Getting photon fluxes
Running tasks in parallel with 4 processors.
Running eff2evt for single/run2_broad_0001_src.dat
Running aprates for single/run2_broad0001_rates.par
Making response files for single/run2_0001
Running eff2evt for single/run2_broad_0001_bkg.dat
Running modeflux for region 1
Adding net rates to output
Appending flux results onto output
Appending photflux results onto output
Computing Net fluxes
Adding model fluxes to output
Scaling model flux confidence limits


Summary of source fluxes

Position                               0.5 - 7.0 keV
                                       Value        90% Conf Interval
3 29 29.25 +31 18 34.7  Rate           0.0398 c/s (0.0381,0.0415)
                        Flux           5.17E-13 erg/cm2/s (4.94E-13,5.39E-13)
                        Mod.Flux       4.45E-13 erg/cm2/s (4.26E-13,4.64E-13)
                        Unabs Mod.Flux 5.51E-13 erg/cm2/s (5.27E-13,5.75E-13)

So, in comparison to the original run, the model flux is slightly higher (6.08 versus 5.97) and there is now an unabsorbed model-flux value (the NET_RATE_APER and NET_FLUX_APER values do not change, since their values are model independent):

unix% dmlist single/run\*_broad.flux"[cols net_rate_aper,net_flux_aper,net_mflux_aper,net_umflux_aper]" data,clean
#  NET_RATE_APER        NET_FLUX_APER        NET_MFLUX_APER       NET_UMFLUX_APER
           0.03979810      5.167279112E-13      4.384556677E-13                  NaN
#  NET_RATE_APER        NET_FLUX_APER        NET_MFLUX_APER       NET_UMFLUX_APER
           0.03979810      5.167279112E-13      4.450621523E-13      5.509250983E-13
[WARNING]
Changing the model

Although we changed the absorbing model parameter, we did not change the source model from the default value of a power law with a photon index of 2. This should be changed to match the expected properties of the source, or sources, being analyzed.


PSF correction

If we set psfmethod=quick, then an aperture correction will be made to the count rate and fluxes:

unix% srcflux repro/acisf06436_repro_evt2.fits "$ra $dec" single/run3 psfmethod=quick
srcflux
          infile = repro/acisf06436_repro_evt2.fits
             pos = 03:29:29.250 +31:18:34.73
         outroot = single/run3
           bands = broad
          srcreg =
          bkgreg =
         bkgresp = yes
       psfmethod = quick
         psffile =
            conf = 0.9
         rmffile =
         arffile =
           model = xspowerlaw.pow1
       paramvals = pow1.phoindex=2
        absmodel = xsphabs.abs1
       absparams = abs1.nh=0.1464
           abund = angr
         fovfile =
        asolfile =
         mskfile =
        bpixfile =
         dtffile =
         ecffile = CALDB
        parallel = yes
           nproc = INDEF
          tmpdir = /tmp
         clobber = no
         verbose = 1
            mode = ql

Extracting counts
Getting net rate and confidence limits
Getting model independent fluxes
Getting model fluxes
Getting photon fluxes
Running tasks in parallel with 4 processors.
Running eff2evt for single/run3_broad_0001_bkg.dat
Making response files for single/run3_0001
Running aprates for single/run3_broad0001_rates.par
Running eff2evt for single/run3_broad_0001_src.dat
Running modeflux for region 1
Adding net rates to output
Appending flux results onto output
Appending photflux results onto output
Computing Net fluxes
Adding model fluxes to output
Scaling model flux confidence limits


Summary of source fluxes

Position                               0.5 - 7.0 keV
                                       Value        90% Conf Interval
3 29 29.25 +31 18 34.7  Rate           0.0458 c/s (0.0438,0.0478)
                        Flux           5.94E-13 erg/cm2/s (5.69E-13,6.2E-13)
                        Mod.Flux       5.12E-13 erg/cm2/s (4.9E-13,5.34E-13)
                        Unabs Mod.Flux 6.34E-13 erg/cm2/s (6.06E-13,6.61E-13)

The same regions are used as before, but this time the PSF fraction is calculated, and used to correct the count rate and flux estimates (the fraction of the PSF that falls in the background area is assumed to be zero):

unix% dmlist "single/run3_broad.flux[cols shape,r,area,bg_area]" data,clean
#  SHAPE              R[2]                                     AREA                 BG_AREA
 Circle                        10.28780                    0               332.50           7979.43750
unix% dmlist "single/run3_broad.flux[cols psffrac,bg_psffrac]" data,clean
#  PSFFRAC              BG_PSFFRAC
     0.86921826932448                    0
unix% dmlist "single/run\*_broad.flux[cols net_rate_aper,net_flux_aper,net_mflux_aper,net_umflux_aper]" data,clean
#  NET_RATE_APER        NET_FLUX_APER        NET_MFLUX_APER       NET_UMFLUX_APER
           0.03979810      5.167279112E-13      4.384556677E-13                  NaN
#  NET_RATE_APER        NET_FLUX_APER        NET_MFLUX_APER       NET_UMFLUX_APER
           0.03979810      5.167279112E-13      4.450621523E-13      5.509250983E-13
#  NET_RATE_APER        NET_FLUX_APER        NET_MFLUX_APER       NET_UMFLUX_APER
            0.0457860      5.944742874E-13       5.12024838E-13       6.33815598E-13

The dmlist output shows the results for the three runs; the last run has larger values, by 1/0.8692 = 1.150.

There are two other settings for the psfmethod parameter:

arfcorr

A model of the PSF is used to calculate the enclosed-count fraction (ECF) for both the source and background apertures (the background region is assumed to be free of source counts for both the ideal and quick options). This model is generated by the arfcorr tool.

Repeating the analysis, but with psfmethod=arfcorr, returns (using outroot=single/run4):

unix% dmlist "single/run4_broad.flux[cols psffrac,bg_psffrac]" data,clean
#  PSFFRAC              BG_PSFFRAC
     0.87274368815037     0.10948755970671
unix% dmlist "single/run4_broad.flux[cols net_rate_aper,net_flux_aper,net_mflux_aper,net_umflux_aper]" data,clean
#  NET_RATE_APER        NET_FLUX_APER        NET_MFLUX_APER       NET_UMFLUX_APER
           0.04584070      6.770046017E-13      5.126365481E-13      6.345728101E-13

The count rate and fluxes are slightly higher than the psfmethod=quick (run3) results because of the fact that BG_PSFFRAC is no longer zero.

psffile

This supports providing an image of the PSF, rather than using the model of arfcorr. Users can run ChaRT and MARX to generate an image of the PSF with the specific spectral model of the source.


Specifying the region

So far the source and background region has been calculated for us by srcflux, but you can also specify them, as shown in this section. Further examples are discussed in the multiple-source section.

For this example we shall use the following manually-defined regions (no attempt has been made to ensure that the background region is free of contamination by other sources):

Source
unix% cat src.reg
circle(3397,3782,20)
Background
unix% cat bg.reg
annulus(3397,3782,30,60)

We run it with psfmethod=arfcorr to see how good our choice of the background region is. Note that we have not changed the pos parameter, which corresponds in this case to a slightly different location than the center of the source region (since we used rounded values in src.reg and bg.reg). The value given in the pos parameter is used to define the off-axis angle for the PSF corrections.

unix% srcflux repro/acisf06436_repro_evt2.fits "$ra $dec" single/run5 src=src.reg bkgreg=bg.reg psfmethod=arfcorr
srcflux
          infile = repro/acisf06436_repro_evt2.fits
             pos = 03:29:29.250 +31:18:34.73
         outroot = single/run5
           bands = broad
          srcreg = src.reg
          bkgreg = bg.reg
         bkgresp = yes
       psfmethod = arfcorr
         psffile =
            conf = 0.9
         rmffile =
         arffile =
           model = xspowerlaw.pow1
       paramvals = pow1.phoindex=2
        absmodel = xsphabs.abs1
       absparams = abs1.nh=0.1464
           abund = angr
         fovfile =
        asolfile =
         mskfile =
        bpixfile =
         dtffile =
         ecffile = CALDB
        parallel = yes
           nproc = INDEF
          tmpdir = /tmp
         clobber = no
         verbose = 1
            mode = ql

Extracting counts
Making PSF models
Getting PSF fraction by running arfcorr 1
Combining PSF fractions together
Getting net rate and confidence limits
Getting model independent fluxes
Getting model fluxes
Getting photon fluxes
Running tasks in parallel with 4 processors.
Running aprates for single/run5_broad0001_rates.par
Running eff2evt for single/run5_broad_0001_src.dat
Running eff2evt for single/run5_broad_0001_bkg.dat
Making response files for single/run5_0001
Running modeflux for region 1
Adding net rates to output
Appending flux results onto output
Appending photflux results onto output
Computing Net fluxes
Adding model fluxes to output
Scaling model flux confidence limits


Summary of source fluxes

Position                               0.5 - 7.0 keV
                                       Value        90% Conf Interval
3 29 29.25 +31 18 34.7  Rate           0.0432 c/s (0.0414,0.045)
                        Flux           5.64E-13 erg/cm2/s (5.41E-13,5.88E-13)
                        Mod.Flux       4.84E-13 erg/cm2/s (4.64E-13,5.05E-13)
                        Unabs Mod.Flux 6E-13 erg/cm2/s (5.74E-13,6.25E-13)

There is now a small contamination of the background by the PSF:

unix% dmlist single/run5_broad.flux"[cols psffrac,bg_psffrac]" data,clean
#  PSFFRAC              BG_PSFFRAC
     0.97144798019988     0.00315935080555

Upper limits

Here we have picked a location with no obvious source emission (Figure 3). When given to srcflux, upper limits are returned

unix% punlearn srcflux
unix% srcflux repro/acisf06436_repro_evt2.fits "3:29:01.24 +31:19:30.72" ulim/src
srcflux
          infile = repro/acisf06436_repro_evt2.fits
             pos = 3:29:01.24 +31:19:30.72
         outroot = ulim/src
           bands = broad
          srcreg =
          bkgreg =
         bkgresp = yes
       psfmethod = ideal
         psffile =
            conf = 0.9
         rmffile =
         arffile =
           model = xsphabs.abs1*xspowerlaw.pow1
       paramvals = abs1.nH=0.0;pow1.PhoIndex=2.0
        absmodel =
       absparams =
           abund = angr
         fovfile =
        asolfile =
         mskfile =
        bpixfile =
         dtffile =
         ecffile = CALDB
        parallel = yes
           nproc = INDEF
          tmpdir = /tmp
         clobber = no
         verbose = 1
            mode = ql

Extracting counts
Setting Ideal PSF : alpha=1 , beta=0
Getting net rate and confidence limits
Getting model independent fluxes
Getting model fluxes
Getting photon fluxes
Running tasks in parallel with 4 processors.
Running eff2evt for ulim/src_broad_0001_bkg.dat
Making response files for ulim/src_0001
Running eff2evt for ulim/src_broad_0001_src.dat
Running aprates for ulim/src_broad0001_rates.par
Running modeflux for region 1
Adding net rates to output
Appending flux results onto output
Appending photflux results onto output
Computing Net fluxes
Adding model fluxes to output
Scaling model flux confidence limits


Summary of source fluxes

Position                               0.5 - 7.0 keV
                                       Value        90% Conf Interval
3 29 1.24 +31 19 30.7   Rate           0 c/s (NAN,6.31E-05)
                        Flux           NAN erg/cm2/s (NAN,NAN)
                        Mod.Flux       0 erg/cm2/s (NAN,6.03E-16)

The best estimates are either 0 or NaN, with upper limits given in the _HI fields:

unix% dmlist ulim/src_broad.flux"[cols upper_limit]" data,clean
#  UPPER_LIMIT
  TRUE
unix% dmlist ulim/src_broad.flux"[cols net_rate_aper,net_flux_aper,net_mflux_aper]" data,clean
#  NET_RATE_APER        NET_FLUX_APER        NET_MFLUX_APER
                    0                  NaN                    0
unix% dmlist ulim/src_broad.flux"[cols net_rate_aper_hi,net_flux_aper_hi,net_mflux_aper_hi]" data,clean
#  NET_RATE_APER_HI     NET_FLUX_APER_HI     NET_MFLUX_APER_HI
           6.3129E-05                  NaN        6.0288195E-16
[Thumbnail image: There are only a few counts near this location.]

[Version: full-size]

[Print media version: There are only a few counts near this location.]

Figure 3: An area with no obvious source emission

The circle indicates the location of a region with no obvious source emission.

[NOTE]
Regions with no counts

If the region contains no counts - e.g. because the location is close to the aim point of the observation and so the extraction radius used by srcflux is small - then an error from fluximage will be reported and the upper limits will not be calculated, but will be set to NaN.


Off chip

In this section we show two examples that show what can happen when the source lies outside of, or overlaps, the field of view of the observation.

We start with a source that lies far enough outside the FOV that the source aperture does not cover the observation at all:

unix% punlearn srcflux
unix% srcflux repro/acisf06436_repro_evt2.fits "3:29:48 +31:27:20" offchip/run1
srcflux
          infile = repro/acisf06436_repro_evt2.fits
             pos = 3:29:48 +31:27:20
         outroot = offchip/run1
           bands = broad
          srcreg =
          bkgreg =
         bkgresp = yes
       psfmethod = ideal
         psffile =
            conf = 0.9
         rmffile =
         arffile =
           model = xsphabs.abs1*xspowerlaw.pow1
       paramvals = abs1.nH=0.0;pow1.PhoIndex=2.0
        absmodel =
       absparams =
           abund = angr
         fovfile =
        asolfile =
         mskfile =
        bpixfile =
         dtffile =
         ecffile = CALDB
        parallel = yes
           nproc = INDEF
          tmpdir = /tmp
         clobber = no
         verbose = 1
            mode = ql

Extracting counts
Setting Ideal PSF : alpha=1 , beta=0
Getting net rate and confidence limits
Getting model independent fluxes
Getting model fluxes
Getting photon fluxes
Running tasks in parallel with 4 processors.
Running eff2evt for offchip/run1_broad_0001_src.dat
Running aprates for offchip/run1_broad0001_rates.par
Running eff2evt for offchip/run1_broad_0001_bkg.dat
Making response files for offchip/run1_0001
Adding net rates to output
Appending flux results onto output
Appending photflux results onto output
Computing Net fluxes
Adding model fluxes to output
Scaling model flux confidence limits


Summary of source fluxes

Position                               0.5 - 7.0 keV
                                       Value        90% Conf Interval
3 29 48.0 +31 27 20.0   Rate           NAN c/s (NAN,NAN)
 Outside FOV            Flux           NAN erg/cm2/s (NAN,NAN)
                        Mod.Flux       NAN erg/cm2/s (NAN,NAN)

The Outside FOV screen warning indicates that the source position has been determined to lie outside the field-of-view (FOV) of the observation. As there is no overlap, the count rate and fluxes are all set to NaN.

In the output file, the source is flagged as lying outside the field of view by its INSIDE_FOV value, and the count-rate and flux measurements are set to NaN. The region stored in the output is no longer a Circle, but a Point at (0,0), because the source region lies outside the FOV area for the observation: this is why the source aperture AREA is 0, but the background aperture BG_AREA is non-zero since it partly overlaps the observation in this case.

unix% dmlist "offchip/run1_broad.flux[cols inside_fov,upper_limit,net_rate_aper,net_rate_aper_lo,net_rate_aper_hi]" data,clean
#  INSIDE_FOV UPPER_LIMIT NET_RATE_APER        NET_RATE_APER_LO     NET_RATE_APER_HI
  FALSE  FALSE                  NaN                  NaN                  NaN
unix% dmlist "offchip/run1_broad.flux[cols shape,x,y,r,area,bg_area]" data,clean
#  SHAPE              sky(X,Y)                                 R[2]                                     AREA                 BG_AREA
 Point                                 0                    0                    0                    0                    0           5117.43750

We now pick a position that is just inside the FOV but near enough to the chip edge that the source and background apertures extend outside it:

unix% srcflux repro/acisf06436_repro_evt2.fits "3:29:43.5 +31:26:35" overlap/run1
srcflux
          infile = repro/acisf06436_repro_evt2.fits
             pos = 3:29:43.5 +31:26:35
         outroot = overlap/run1
           bands = broad
          srcreg =
          bkgreg =
         bkgresp = yes
       psfmethod = ideal
         psffile =
            conf = 0.9
         rmffile =
         arffile =
           model = xsphabs.abs1*xspowerlaw.pow1
       paramvals = abs1.nH=0.0;pow1.PhoIndex=2.0
        absmodel =
       absparams =
           abund = angr
         fovfile =
        asolfile =
         mskfile =
        bpixfile =
         dtffile =
         ecffile = CALDB
        parallel = yes
           nproc = INDEF
          tmpdir = /tmp
         clobber = no
         verbose = 1
            mode = ql

Extracting counts
...

Summary of source fluxes

Position                               0.5 - 7.0 keV
                                       Value        90% Conf Interval
3 29 43.5 +31 26 35.0   Rate           0 c/s (NAN,0.00011)
                        Flux           NAN erg/cm2/s (NAN,NAN)
                        Mod.Flux       0 erg/cm2/s (NAN,3.69E-15)

In this case values were calculated, since the source and background apertures are not zero, but because there is no actual source at this position an upper limit is returned.

unix% dmlist "overlap/run1_broad.flux[cols shape,x,y,r,area,bg_area]" data,clean
#  SHAPE              sky(X,Y)                                 R[2]                                     AREA                 BG_AREA
 Circle                               3027.670      4758.190            23.92080                    0           1550.81250          24399.81250
unix% dmlist "overlap/run1_broad.flux[cols inside_fov,upper_limit,near_chip_edge]" data,clean
#  INSIDE_FOV UPPER_LIMIT NEAR_CHIP_EDGE
  TRUE   TRUE   TRUE
unix% dmlist "overlap/run1_broad.flux[cols net_rate_aper,net_rate_aper_lo,net_rate_aper_hi]" data,clean
#  NET_RATE_APER        NET_RATE_APER_LO     NET_RATE_APER_HI
                    0                  NaN          0.000109806
[NOTE]
Note

There is no indication, either on screen, or in the output file - e.g. overlap/run1_broad.flux - that an aperture has been reduced because it extends outside the FOV. The NEAR_CHIP_EDGE column can be used to see if the source lies near a chip edge, which indicates that there may be truncation of the background or source regions.


The output file

There is one output file per band which contains the source count rate and fluxes. If multiple sources are used then the table will contain multiple rows. Here we show the output of the first run:

unix% dmlist single/run1_broad.flux blocks

--------------------------------------------------------------------------------
Dataset: single1/run1_broad.flux
--------------------------------------------------------------------------------

     Block Name                          Type         Dimensions
--------------------------------------------------------------------------------
Block    1: PRIMARY                        Null
Block    2: HISTOGRAM                      Table        60 cols x 1        rows
Block    3: GTI3                           Table         2 cols x 1        rows
Block    4: GTI6                           Table         2 cols x 1        rows
Block    5: GTI7                           Table         2 cols x 1        rows
Block    6: GTI2                           Table         2 cols x 1        rows
Block    7: GTI1                           Table         2 cols x 1        rows
Block    8: GTI0                           Table         2 cols x 3        rows

The file resembles that created by dmextract when used in its "spatial extraction" mode (e.g. see the Estimate Source Counts in an Event File and Obtain and Fit a Radial Profile threads), but with extra columns added:

unix% dmlist single/run1_broad.flux cols

--------------------------------------------------------------------------------
Columns for Table Block HISTOGRAM
--------------------------------------------------------------------------------

ColNo  Name                 Unit        Type             Range
   1   sky(X,Y)             pixel        Real8          -Inf:+Inf            Position
   2   EQPOS(RA,Dec)        deg          Real8          -360.0:      360.0   Position
   3   SHAPE                             String[16]                          Region shape type
   4   R[2]                 pixel        Real8(2)       -Inf:+Inf            Radius
   5   ROTANG[2]            pixel        Real8(2)       -Inf:+Inf            Angle
   6   COMPONENT                         Int2           -                    Component number
   7   COUNTS               count        Real8          -Inf:+Inf            Counts
   8   ERR_COUNTS           count        Real8          -Inf:+Inf            Error on counts
   9   AREA                 pixel**2     Real8          -Inf:+Inf            Area of extraction
  10   EXPOSURE             s            Real8          -Inf:+Inf            Exposure time of source file
  11   COUNT_RATE           count/s      Real8          -Inf:+Inf            Rate
  12   COUNT_RATE_ERR       count/s      Real8          -Inf:+Inf            Rate Error
  13   BG_COUNTS            count        Real8          -Inf:+Inf            Background Counts
  14   BG_ERR               count        Real8          -Inf:+Inf            Error on Background counts
  15   BG_AREA              pixel**2     Real8          -Inf:+Inf            Background Area of Extraction
  16   BG_EXPOSURE          s            Real8          -Inf:+Inf            Exposure time of background file
  17   BG_RATE              count/s      Real8          -Inf:+Inf            Background Rate
  18   BG_SUR_BRI           count/pixel**2 Real8          -Inf:+Inf            Background Counts per square pixel
  19   BG_SUR_BRI_ERR       count/pixel**2 Real8          -Inf:+Inf            Error on background counts per square pixel
  20   NET_COUNTS           count        Real8          -Inf:+Inf            Net Counts
  21   NET_ERR              count        Real8          -Inf:+Inf            Error on Net Counts
  22   NET_RATE             count/s      Real8          -Inf:+Inf            Net Count Rate
  23   ERR_RATE             count/s      Real8          -Inf:+Inf            Error Rate
  24   SUR_BRI              count/pixel**2 Real8          -Inf:+Inf            Net Counts per square pixel
  25   SUR_BRI_ERR          count/pixel**2 Real8          -Inf:+Inf            Error on net counts per square pixel
  26   XPOS                 pixel        Real8          -Inf:+Inf            X center
  27   YPOS                 pixel        Real8          -Inf:+Inf            Y center
  28   THETA                arcmin       Real8          -Inf:+Inf            Off axis angle
  29   PHI                  deg          Real8          -Inf:+Inf            Azimuth angle
  30   RAPOS                deg          Real8          -Inf:+Inf            Right Ascencion
  31   DECPOS               deg          Real8          -Inf:+Inf            Declination
  32   INSIDE_FOV                        Logical                             Is XPOS,YPOS inside the FOV?
  33   NEAR_CHIP_EDGE                    Logical                             Is POS near or off any chip edge?
  34   PSFFRAC                           Real8          -Inf:+Inf            Source region PSF fraction
  35   BG_PSFFRAC                        Real8          -Inf:+Inf            Background region PSF fraction
  36   NET_RATE_APER        counts/s     Real8          -Inf:+Inf            Net count rate
  37   NET_RATE_APER_LO     counts/s     Real8          -Inf:+Inf            Lower limit on net count rate
  38   NET_RATE_APER_HI     counts/s     Real8          -Inf:+Inf            Upper limit on net count rate
  39   SRC_SIGNIFICANCE                  Real8          -Inf:+Inf            Source significance
  40   FLUX_APER            ergs/cm**2/s Real8          -Inf:+Inf            Sum eff2evt flux in src region
  41   BG_FLUX_APER         ergs/cm**2/s Real8          -Inf:+Inf            Sum eff2evt flux in bkg region
  42   SRC_PHOTFLUX         photon/cm**2/s Real8          -Inf:+Inf            Sum of flux image in src region
  43   BG_PHOTFLUX          photon/cm**2/s Real8          -Inf:+Inf            Sum of the flux image in background region
  44   MEAN_SRC_EXP         cm**2        Real8          -Inf:+Inf            Mean source expmap value
  45   MEAN_BG_EXP          cm**2        Real8          -Inf:+Inf            Mean background expmap value
  46   NET_FLUX_APER        ergs/cm**2/s Real8          -Inf:+Inf            Model independent flux
  47   NET_FLUX_APER_LO     ergs/cm**2/s Real8          -Inf:+Inf            Model independent flux lower limit
  48   NET_FLUX_APER_HI     ergs/cm**2/s Real8          -Inf:+Inf            Model independent flux upper limit
  49   UPPER_LIMIT                       Logical                             Was upper limit used?
  50   NET_PHOTFLUX_APER    photon/cm**2/s Real8          -Inf:+Inf            Photon flux counts/expmap
  51   NET_PHOTFLUX_APER_LO photon/cm**2/s Real8          -Inf:+Inf            Photon flux lower limit
  52   NET_PHOTFLUX_APER_HI photon/cm**2/s Real8          -Inf:+Inf            Photon flux upper limit
  53   MFLUX_CNV                         Real8          -Inf:+Inf            model flux rate conversion
  54   UMFLUX_CNV                        Real8          -Inf:+Inf            unabsorbed model flux rate conversion
  55   NET_MFLUX_APER       ergs/cm**2/s Real8          -Inf:+Inf            Model scaled flux
  56   NET_MFLUX_APER_LO    ergs/cm**2/s Real8          -Inf:+Inf            Model scaled flux lower limit
  57   NET_MFLUX_APER_HI    ergs/cm**2/s Real8          -Inf:+Inf            Model scaled flux upper limit
  58   NET_UMFLUX_APER      ergs/cm**2/s Real8          -Inf:+Inf            Unabs. model scaled flux
  59   NET_UMFLUX_APER_LO   ergs/cm**2/s Real8          -Inf:+Inf            Unabs. model scaled flux lower limit
  60   NET_UMFLUX_APER_HI   ergs/cm**2/s Real8          -Inf:+Inf            Unabs. model scaled flux upper limit

--------------------------------------------------------------------------------
World Coord Transforms for Columns in Table Block HISTOGRAM
--------------------------------------------------------------------------------

ColNo    Name
4:    CEL_R                = +0.2460 [arcsec] +0.4920 * (R  -0.50)
9:    CEL_AREA             = +0.1210 [arcsec**2] +0.2421 * (AREA  -0.50)
18:   BG_CEL_BRI           = +2.0656 [count/arcsec**2] +4.1311 * (BG_SUR_BRI  -0.50)
19:   BG_CEL_BRI_ERR       = +2.0656 [count/arcsec**2] +4.1311 * (BG_SUR_BRI_ERR  -0.50)
24:   CEL_BRI              = +2.0656 [count/arcsec**2] +4.1311 * (SUR_BRI  -0.50)
25:   CEL_BRI_ERR          = +2.0656 [count/arcsec**2] +4.1311 * (SUR_BRI_ERR  -0.50)

The main new columns, shown in bold above, are:

THETA and PHI

The distance of the source from the optical center of the observation given using the MSC coordinate system.

INSIDE_FOV

This is True if the source position falls inside the field of view of the observation, as defined by the input to the fovfile parameter.

NEAR_EDGE_CHIP

This is True if the source position falls close to one of the ACIS chip edges, where this is defined to be 32 pixels, as this is the size of the ACIS dither pattern. This is not set for HRC data (i.e. it is always False).

PSFFRAC and BG_PSFFRAC

The estimated PSF fraction within the source and aperture regions. This calculation is based on the center of the source - i.e. the value given to the pos parameter - and so it is possible to still have some signal within the aperture, even if the center is outside of the field of view (e.g. Figure 8).

The psfmethod parameter controls how these values are calculated.

NET_RATE_APER, NET_RATE_APER_LO, and NET_RATE_APER_HI

These columns give the net count rate, and the lower and upper limits, for the aperture in counts/s. The confidence level for these limits is determined by the conf parameter. The PSF correction has been made to this value.

The lower error can be NaN, and if the rate itself is zero then the NET_RATE_APER_HI value is an upper limit.

NET_FLUX_APER, NET_FLUX_APER_LO, and NET_FLUX_APER_HI

These give the model-independent flux estimate, and the lower and upper limits, for the aperture in ergs cm-2 s-1. The confidence level for these limits is determined by the conf parameter. The PSF correction has been made to this value.

The model-independent flux is calculated by summing up the "flux" of each event - as calculated by the eff2evt tool - that lies within the aperture and is within the requested energy band. The background flux is estimated from the background aperture and subtracted by scaling by the ratio of the aperture areas.

The lower error can be NaN, and if the flux itself is zero then the NET_FLUX_APER_HI value is an upper limit.

UPPER_LIMIT

If True, then the NET_FLUX_APER limits are computed from an upper limit estimate rather than a measured value.

NET_PHOTFLUX_APER, NET_PHOTFLUX_APER_LO, and NET_PHOTFLUX_APER_HI

These have the same meaning as the corresponding NET_FLUX_APER value, except that the units are photon cm-2 s-1 rather than ergs cm-2 s-1.

NET_MFLUX_APER, NET_MFLUX_APER_LO, and NET_MFLUX_APER_HI

This is the background-subtracted, PSF-corrected flux, in ergs cm-2 s-1, for the source, where the conversion from count rate to flux uses the model and parameters defined by the model and paramvals parameters. See modelflux for more information on how this conversion is done.

The lower error can be NaN, and if the flux itself is zero then the NET_MFLUX_APER_HI value is an upper limit.

NET_UMFLUX_APER, NET_UMFLUX_APER_LO, and NET_UMFLUX_APER_HI

This are similar to the NET_MFLUX_APER values but the conversion from count rate to flux also includes accounting for the flux lost due to an absorbing component. These values are only set if the absmodel and absparams parameters are set. See modelflux for more information on how this conversion is done.

The lower error can be NaN, and if the flux itself is zero then the NET_UMFLUX_APER_HI value is an upper limit.


Source lists

In the following section we supply srcflux with a list of positions. In this section we create the lists to be used:

  • from a catalog

  • from the data itself (using wavdetect)

Using a catalog as a source list

Here we use a list of positions from the Chandra Source Catalog (CSC), which has analysed the observations in this area, but any catalog with RA and Dec values (ICRS or J2000) can be used. We take advantage of the search_csc command-line tool to create a list of sources identified in the region:

unix% mkdir csc
unix% punlearn search_csc
unix% search_csc ngc1333 10 csc/ngc1333.tsv
search_csc
             pos = ngc1333
          radius = 10
         outfile = csc/ngc1333.tsv
         radunit = arcmin
         columns = INDEF
     sensitivity = no
        download = none
            root = ./
           bands = broad,wide
       filetypes = regevt,pha,arf,rmf,lc,psf,regexp
         catalog = csc1
         verbose = 1
         clobber = no
            mode = ql


222 rows returned by query
101 Different Master Source(s).
3 Different Observation(s).

name                	ra          	dec         	sepn	obsid
CXO J032828.8+312037	 52.12018   	 31.34361   	7.1'	 6436
CXO J032829.7+312512	 52.12398   	 31.42010   	8.1'	 6437
...
CXO J032945.3+312352	 52.43878   	 31.39789   	9.7'	  642
CXO J032946.3+312039	 52.44328   	 31.34421   	9.5'	  642

If you use this data, please cite Evans et al 2010, ApJS 189, 37

Note that the file contains 222 rows but only 101 different sources, this is because the same source is reported for each ObsId it is detected in.

unix% dmcopy csc/ngc1333.tsv"[opt kernel=text/tsv][cols ra,dec]" csc.fits
unix% dmlist csc.fits cols

--------------------------------------------------------------------------------
Columns for Table Block ngc1333.tsv
--------------------------------------------------------------------------------

ColNo  Name                 Unit        Type             Range
   1   ra                   deg          Real4          -Inf:+Inf            Source position, ICRS right ascension
   2   dec                  deg          Real4          -Inf:+Inf            Source position, ICRS declination

As srcflux only needs the RA and DEC columns, we have created a file (csc.fits) with just this data, using dmcopy. The resulting source list can be viewed in ds9 (Figure 4). Since we used the search_csc tool, rather than obsid_search_csc, there may be sources that lie outside the field of view of the observation, as well as the same location appearing on consecutive rows, since the table contains a row per ObsId.

[Thumbnail image: The CSC covers a larger area than this observation so the sources extend outside of the field of view.]

[Version: full-size]

[Print media version: The CSC covers a larger area than this observation so the sources extend outside of the field of view.]

Figure 4: The CSC sources

The circles shown by ds9 are "points", since there is no region information in the TSV file created by search_csc. As you zoom in the circles will get smaller, as can be seen in the inset view, which shows the two close sources in the North-East of the field (it is the same pair as shown in Figure 7).

[NOTE]
Note

In this case the source list is from Chandra, and so we expect to see a one-to-one correspondance between the source list and the sources seen in the data (e.g. Figure 4). However, there is no reason that an X-ray source list has to be used.


Creating a source list with wavdetect

For this example we shall use wavdetect to create the source list, but other methods can be used. The image and exposure map, created earlier, are going to be used. For your actual analysis it is likely that you should use a smaller binning factor than the value used here (4), which may mean increasing the set of scales used by wavdetect.

First we need to make a PSF map, that is an image showing the size of the PSF for each pixel in the image, which we do using mkpsfmap, where the values used - an energy of 1.49 keV and enclosed-count fraction of 0.393 are chosen to match the simulations used to characterize wavdetect.

unix% cd fimg
unix% punlearn mkpsfmap
unix% mkpsfmap broad_thresh.img broad_thresh.psfmap 1.49 ecf=0.393

The resulting image is shown in Figure 5.

[Thumbnail image: The PSF size increases with off axis angle.]

[Version: full-size]

[Print media version: The PSF size increases with off axis angle.]

Figure 5: PSF variation across the field of view

The image was created by saying

unix% dmlist broad_thresh.psfmap header,clean,raw | grep BUNIT
BUNIT        = arcsec               / Units after BSCALE applied
unix% ds9 broad_thresh.psfmap -region ../repro/acisf06436_000N002_fov1.fits \
         -contour yes -contour levels "1"

so that the circular region shows the location where the PSF increases to 1 arcsecond (the BUNIT keyword lists the units of the image), and the boxes show the outlines of the ACIS chips (using the FOV files).

With this, we can now run wavdetect (see the Running wavdetect thread for more information):

unix% cd ..
unix% mkdir wav
unix% punlearn wavdetect
unix% pset wavdetect psffile=fimg/broad_thresh.psfmap
unix% pset wavdetect expfile=fimg/broad_thresh.expmap
unix% pset wavdetect regfile=wav/src.reg
unix% pset wavdetect scales="2 4 8 16"
unix% wavdetect fimg/broad_thresh.img wav/src.fits wav/src.scell wav/src.img wav/src.nbkg mode=h
unix% dmlist wav/src.fits counts
81

and the resulting source list is shown in Figure 6.

[Thumbnail image: The obvious-to-the eye sources are detected. There are a number of close, almost overlapping, sources.]

[Version: full-size]

[Print media version: The obvious-to-the eye sources are detected. There are a number of close, almost overlapping, sources.]

Figure 6: Sources detected by wavdetect

unix% ds9 fimg/broad_flux.img -region wav/src.fits -log -cmap b
[IMPORTANT]
Important

Users are reminded that the output from wavdetect is only a list of candidate sources and that the source properties, including the region defintion, are approximations.

Although the source list created by wavdetect can be used as a region file (e.g. Figure 6), it is not usable here because:

  1. there are no background regions,

  2. and there is no check for overlapping sources.

Both issues can be addresed by using the roi tool. Given a set of regions, it outputs one region per source with a source region in the SRCREG extension and the corresponding background region in the BKGREG extension. The background is an annulus around the source, with a number of parameters - described in ahelp roi - for controlling the size and spacing relative to the source area. The parameters chosen here - namely group=exclude and targetbkg=target - ensure that each source in the input file has a region, that any other overlapping sources are excluded from both the source and background regions, and that there is a single annulus used for the background (rather than multiple annuli, one for each source that overlaps the output source). The roi tool has many capabilities and you are encouraged to change the parameters to see whether they are better for your science needs.

unix% mkdir sources
unix% punlearn roi
unix% pset roi group=exclude bkgfactor=1
unix% pset roi outsrcfile="sources/src%02d.fits"
unix% pset roi targetbkg=target
unix% roi wav/src.fits "region(repro/acisf06436_000N002_fov1.fits)"
Input streak region ():
Output source list (sources/src%02d.fits):
Background radius computation method (add|mul|area) (mul):
Background radius (0:) (3):
unix% ls -1 sources/src*fits | wc -l
      81
unix% dmlist sources/src01.fits blocks

--------------------------------------------------------------------------------
Dataset: sources/src01.fits
--------------------------------------------------------------------------------

     Block Name                          Type         Dimensions
--------------------------------------------------------------------------------
Block    1: PRIMARY                        Null
Block    2: SRCREG                         Table         5 cols x 1        rows
Block    3: BKGREG                         Table         5 cols x 2        rows
[NOTE]
Numbering

The outsrcfile parameter uses %02d rather than %d so that later processing, in particular the splitroi call, can easily match up the correct source and background regions; if you have more than 99 sources use a larger number of characters, such as %04d.

In Figure 7 we show the source and background regions created by roi for a source which has a close neighbor.

[Thumbnail image: Two close point sources create complicated source and background regions.]

[Version: full-size]

[Print media version: Two close point sources create complicated source and background regions.]

Figure 7: A source and background region, created by roi

As the source regions for these two sources overlap, the source and background regions created by roi require both included and excluded regions for each source.

unix% ds9 fimg/broad_flux.img -log -region sources/src75.fits \
     -pan to 3460 4780 -zoom 4 fimg/broad_flux.img -log \
     -region "sources/src75.fits[bkgreg]" -pan to 3460 4780

Note how the extension bkgreg had to be specified for the background, otherwise ds9 assumes you mean the first region block (srcreg in this case).

The final step is to create a list of source and background regions from the output of roi, which can be performed by the splitroi script:

unix% splitroi sources/src\*fits sources/wav
unix% ls -1 sources/wav*reg
sources/wav.bg.reg
sources/wav.src.reg

Multiple sources

We start by using the CSC results, whereby srcflux is given a list of positions only. We then show how region information can be included by using the wavdetect source list.

Using a catalog

Here we try running srcflux with just a source list, letting it calculate the source and background regions. In this case we are going to use the source list from the CSC, but data from other wave bands can be used.

To keep the run-time manageable we choose a subset of sources, where row number 210 is the source used in the single-source analysis above. A single nH value is assumed here, even though it does vary across the ACIS field.

[WARNING]
Multiple sources

The CSC results created by search_csc contain multiple rows with the same source; if these multiple occurrences are not filtered out at this stage then srcflux will treat these repeats as separate sources, resulting in sources with zero areas (due to the areas cancelling out), and then flux=NAN).

unix% punlearn srcflux
unix% pset srcflux model=xspowerlaw.pow1 paramvals="pow1.phoindex=2"
unix% pset srcflux absmodel=xsphabs.abs1 absparams="abs1.nh=0.1464"
unix% srcflux repro/acisf06436_repro_evt2.fits csc.fits"[#row=1,7,10,210,222]" multiple-csc/run
srcflux
          infile = repro/acisf06436_repro_evt2.fits
             pos = csc.fits[#row=1,7,10,210,222]
         outroot = multiple-csc/run
           bands = broad
          srcreg =
          bkgreg =
         bkgresp = yes
       psfmethod = ideal
         psffile =
            conf = 0.9
         rmffile =
         arffile =
           model = xspowerlaw.pow1
       paramvals = pow1.phoindex=2
        absmodel = xsphabs.abs1
       absparams = abs1.nh=0.1464
           abund = angr
         fovfile =
        asolfile =
         mskfile =
        bpixfile =
         dtffile =
         ecffile = CALDB
        parallel = yes
           nproc = INDEF
          tmpdir = /tmp
         clobber = no
         verbose = 1
            mode = ql

Extracting counts
Setting Ideal PSF : alpha=1 , beta=0
Getting net rate and confidence limits
Getting model independent fluxes
Getting model fluxes
Getting photon fluxes
Running tasks in parallel with 4 processors.
Running eff2evt for multiple-csc/run_broad_0003_bkg.dat
Running eff2evt for multiple-csc/run_broad_0005_src.dat
Running eff2evt for multiple-csc/run_broad_0004_bkg.dat
Running eff2evt for multiple-csc/run_broad_0001_src.dat
Running eff2evt for multiple-csc/run_broad_0002_src.dat
Running aprates for multiple-csc/run_broad0001_rates.par
Running aprates for multiple-csc/run_broad0004_rates.par
Running aprates for multiple-csc/run_broad0003_rates.par
Running aprates for multiple-csc/run_broad0002_rates.par
Making response files for multiple-csc/run_0001
Making response files for multiple-csc/run_0002
Running eff2evt for multiple-csc/run_broad_0005_bkg.dat
Running aprates for multiple-csc/run_broad0005_rates.par
Running eff2evt for multiple-csc/run_broad_0001_bkg.dat
Running modeflux for region 1
Running eff2evt for multiple-csc/run_broad_0002_bkg.dat
Running eff2evt for multiple-csc/run_broad_0004_src.dat
Running modeflux for region 2
Running eff2evt for multiple-csc/run_broad_0003_src.dat
Making response files for multiple-csc/run_0005
Making response files for multiple-csc/run_0003
Making response files for multiple-csc/run_0004
Running modeflux for region 3
Running modeflux for region 4
Adding net rates to output
Appending flux results onto output
Appending photflux results onto output
Computing Net fluxes
Adding model fluxes to output
Scaling model flux confidence limits


Summary of source fluxes

Position                               0.5 - 7.0 keV
                                       Value        90% Conf Interval
3 28 28.84 +31 20 36.9  Rate           0.000325 c/s (0.000166,0.000533)
                        Flux           7.5E-15 erg/cm2/s (3.84E-15,1.23E-14)
                        Mod.Flux       6.05E-15 erg/cm2/s (3.1E-15,9.93E-15)
                        Unabs Mod.Flux 7.49E-15 erg/cm2/s (3.83E-15,1.23E-14)

3 28 36.50 +31 19 29.0  Rate           0.000591 c/s (0.000393,0.00084)
                        Flux           4.05E-15 erg/cm2/s (2.69E-15,5.76E-15)
                        Mod.Flux       6.87E-15 erg/cm2/s (4.57E-15,9.77E-15)
                        Unabs Mod.Flux 8.51E-15 erg/cm2/s (5.66E-15,1.21E-14)

3 28 36.91 +31 17 35.3  Rate           0.00703 c/s (0.00631,0.00776)
                        Flux           6.31E-14 erg/cm2/s (5.65E-14,6.96E-14)
                        Mod.Flux       8.22E-14 erg/cm2/s (7.37E-14,9.08E-14)
                        Unabs Mod.Flux 1.02E-13 erg/cm2/s (9.13E-14,1.12E-13)

3 29 29.24 +31 18 34.7  Rate           0.0398 c/s (0.0381,0.0416)
                        Flux           5.17E-13 erg/cm2/s (4.95E-13,5.39E-13)
                        Mod.Flux       4.45E-13 erg/cm2/s (4.26E-13,4.65E-13)
                        Unabs Mod.Flux 5.51E-13 erg/cm2/s (5.27E-13,5.75E-13)

3 29 46.38 +31 20 39.1  Rate           0 c/s (NAN,7.71E-05)
 Outside FOV            Flux           NAN erg/cm2/s (NAN,NAN)
                        Mod.Flux       NAN erg/cm2/s (NAN,NAN)
                        Unabs Mod.Flux NAN erg/cm2/s (NAN,NAN)

Note that the center of the last region (row number 222) lies outside the FOV, even though it overlaps the chip slightly (Figure 8).

[Thumbnail image: A small part of the source area covers the edge of the chip.]

[Version: full-size]

[Print media version: A small part of the source area covers the edge of the chip.]

Figure 8: Source at the edge of the chip

unix% ds9 fimg/broad_flux.img -log -cmap b fimg/broad_thresh.expmap \
         -pan to 3:29:46 31:20:39 wcs fk5 -zoom 4 -match frame wcs \
         -region load all multiple-csc/run_broad.flux

The left frame shows the fluxed image and the right frame the broad-band exposure map. Here we zoom in on the last point, showing that the source region just intersects the observation.

Note that we are able to use the output of srcflux as a region file.

Since we have multiple sources, the output file contains many rows, unlike in the single-source case:

unix% dmlist multiple-csc/run_broad.flux"[cols near_chip_edge,inside_fov,upper_limit]" data,clean
#  NEAR_CHIP_EDGE INSIDE_FOV UPPER_LIMIT
  TRUE   TRUE   FALSE
  FALSE  TRUE   FALSE
  FALSE  TRUE   FALSE
  FALSE  TRUE   FALSE
  TRUE   FALSE  TRUE
unix% dmlist "multiple-csc/run_broad.flux[cols component,psffrac,bg_psffrac]" data,clean
#  COMPONENT  PSFFRAC              BG_PSFFRAC
          1                  1.0                    0
          2                  1.0                    0
          3                  1.0                    0
          4                  1.0                    0
          5                  1.0                    0

The PSF correction is 1/0 for all the sources because the psfmethod parameter was set to ideal. The COMPONENT value refers to the numbering by srcflux and not the row numbers from the original file.

The count rate and fluxes are:

unix% dmlist "multiple-csc/run_broad.flux[cols net_rate_aper,net_flux_aper,net_mflux_aper,net_umflux_aper]" data,clean
#  NET_RATE_APER        NET_FLUX_APER        NET_MFLUX_APER       NET_UMFLUX_APER
          0.000325157      7.498628154E-15      6.050521456E-15      7.489666338E-15
          0.000590708      4.051307658E-15       6.87288758E-15      8.507376616E-15
          0.007032830      6.305845059E-14       8.22137827E-14      1.017720829E-13
           0.03982670      5.169775982E-13       4.45262506E-13       5.51201528E-13
                    0                  NaN                  NaN                  NaN
unix% dmlist "multiple-csc/run_broad.flux[cols net_rate_aper,net_rate_aper_lo,net_rate_aper_hi]" data,clean
#  NET_RATE_APER        NET_RATE_APER_LO     NET_RATE_APER_HI
          0.000325157          0.000166436          0.000533477
          0.000590708          0.000392908          0.000839639
          0.007032830          0.006306370          0.007763720
           0.03982670           0.03810890           0.04155490
                    0                  NaN          7.70807E-05
unix% dmlist "multiple-csc/run_broad.flux[cols net_umflux_aper,net_umflux_aper_lo,net_umflux_aper_hi]" data,clean
#  NET_UMFLUX_APER      NET_UMFLUX_APER_LO   NET_UMFLUX_APER_HI
      7.489666338E-15      3.833686824E-15      1.228810922E-14
      8.507376616E-15      5.658661016E-15      1.209248088E-14
      1.017720829E-13      9.125948027E-14      1.123487921E-13
       5.51201528E-13       5.27427176E-13       5.75119816E-13
                  NaN                  NaN                  NaN

Comparing the results for source number 210 with those from above (picking the same choice of spectral model and aperture correction strategies), we see similar results:

unix% dmlist "multiple-csc/run_broad.flux[component=4][cols x,y,r,net_rate_aper,net_rate_aper_lo,net_rate_aper_hi]" data,clean
#  sky(X,Y)                                 R[2]                                     NET_RATE_APER        NET_RATE_APER_LO     NET_RATE_APER_HI
                   3397.380      3781.510            10.28740                    0           0.03982670           0.03810890           0.04155490
unix% dmlist "single/run2_broad.flux[cols x,y,r,net_rate_aper,net_rate_aper_lo,net_rate_aper_hi]" data,clean
#  sky(X,Y)                                 R[2]                                     NET_RATE_APER        NET_RATE_APER_LO     NET_RATE_APER_HI
                   3397.340      3781.560            10.28780                    0           0.03979810           0.03808090           0.04152570

Using source and region files

In this example a source list and a set of source and background regions are given. Since there are 81 sources this can take a long time (note that srcflux will use all available CPUs on your machine for parts of the analysis; this can be controlled with the parallel and nproc parameters).

unix% punlearn srcflux
unix% pset srcflux model=xspowerlaw.pow1 paramvals="pow1.phoindex=2"
unix% pset srcflux absmodel=xsphabs.abs1 absparams="abs1.nh=0.1464"
unix% pset srcflux psfmethod=arfcorr
unix% pset srcflux srcreg=@-sources/wav.src.reg
unix% pset srcflux bkgreg=@-sources/wav.bg.reg
[NOTE]
Stacks and directory names

The stacks for the source and background regions use the "@-" syntax rather than just "@ to avoid the directory name containing the stack file being appended to each region, as shown in the first stk_read_num call below:

unix% stk_read_num @sources/wav.src.reg 1 echo+
sources/Ellipse(4151.58,3178.88,16.4402,11.3052,27.7724)
unix% stk_read_num @-sources/wav.src.reg 1 echo+
Ellipse(4151.58,3178.88,16.4402,11.3052,27.7724)

See the stack ahelp page for more information on stack handling in CIAO tools.

unix% srcflux repro/acisf06436_repro_evt2.fits wav/src.fits multiple-wav/run
srcflux
          infile = repro/acisf06436_repro_evt2.fits
             pos = wav/src.fits
         outroot = multiple-wav/run
           bands = broad
          srcreg = @-sources/wav.src.reg
          bkgreg = @-sources/wav.bg.reg
         bkgresp = yes
       psfmethod = arfcorr
         psffile =
            conf = 0.9
         rmffile =
         arffile =
           model = xspowerlaw.pow1
       paramvals = pow1.phoindex=2
        absmodel = xsphabs.abs1
       absparams = abs1.nh=0.1464
           abund = angr
         fovfile =
        asolfile =
         mskfile =
        bpixfile =
         dtffile =
         ecffile = CALDB
        parallel = yes
           nproc = INDEF
          tmpdir = /tmp
         clobber = no
         verbose = 1
            mode = ql

Extracting counts
Making PSF models
Getting PSF fraction by running arfcorr 2
Getting PSF fraction by running arfcorr 3
...
Getting PSF fraction by running arfcorr 49
Combining PSF fractions together
Getting net rate and confidence limits
Getting model independent fluxes
Getting model fluxes
Getting photon fluxes
Running tasks in parallel with 4 processors.
Running eff2evt for multiple-wav/run_broad_0051_bkg.dat
Running aprates for multiple-wav/run_broad0055_rates.par
Running aprates for multiple-wav/run_broad0056_rates.par
...
Running eff2evt for multiple-wav/run_broad_0071_src.dat
Running modeflux for region 19
Adding net rates to output
Appending flux results onto output
Appending photflux results onto output
Computing Net fluxes
Adding model fluxes to output
Scaling model flux confidence limits


Summary of source fluxes

Position                               0.5 - 7.0 keV
                                       Value        90% Conf Interval
3 29 0.29 +31 13 38.3   Rate           0.0185 c/s (0.0172,0.0198)
                        Flux           2.28E-13 erg/cm2/s (2.12E-13,2.44E-13)
                        Mod.Flux       2.14E-13 erg/cm2/s (1.99E-13,2.29E-13)
                        Unabs Mod.Flux 2.65E-13 erg/cm2/s (2.46E-13,2.84E-13)

3 28 57.20 +31 14 18.8  Rate           0.0637 c/s (0.0613,0.0661)
                        Flux           6.27E-13 erg/cm2/s (6.04E-13,6.51E-13)
                        Mod.Flux       7.49E-13 erg/cm2/s (7.21E-13,7.77E-13)
                        Unabs Mod.Flux 9.27E-13 erg/cm2/s (8.92E-13,9.62E-13)
...
3 28 45.65 +31 22 57.2  Rate           0.000349 c/s (0.000133,0.000612)
                        Flux           1.4E-14 erg/cm2/s (5.34E-15,2.46E-14)
                        Mod.Flux       3.61E-15 erg/cm2/s (1.38E-15,6.33E-15)
                        Unabs Mod.Flux 4.46E-15 erg/cm2/s (1.7E-15,7.84E-15)

3 28 49.95 +31 28 28.6  Rate           0.000352 c/s (0.000109,0.000641)
                        Flux           5.73E-15 erg/cm2/s (1.78E-15,1.05E-14)
                        Mod.Flux       3.92E-15 erg/cm2/s (1.22E-15,7.15E-15)
                        Unabs Mod.Flux 4.85E-15 erg/cm2/s (1.5E-15,8.85E-15)

The screen output will indicate whether there were issues with any source, but we can also look at the INSIDE_FOV and UPPER_LIMIT columns to find problem cases; in this case there aren't any.

unix% dmlist "multiple-wav/run_broad.flux[inside_fov=false||upper_limit=true]" counts
0

We can use ChIPS - or prism - to visualize the results; for example Figure 9 was created with the following:

unix% chips -n
chips> cr = read_file("multiple-wav/run_broad.flux")
chips> cpt = cr.get_column("COMPONENT").values
chips> umflux = cr.get_column("NET_UMFLUX_APER").values
chips> umflux_lo = cr.get_column("NET_UMFLUX_APER_LO").values
chips> umflux_hi = cr.get_column("NET_UMFLUX_APER_HI").values
chips> add_window(8, 6, 'inches')
chips> add_curve(cpt, umflux, [umflux_lo, umflux_hi], ['line.style', 'noline'])
chips> log_scale(Y_AXIS)
chips> umflux_units = cr.get_column("NET_UMFLUX_APER").unit
chips> set_plot_ylabel("Unabsorbed flux ({})".format(umflux_units))
chips> set_yaxis(['offset.perpendicular', 70, 'label.size', 16])
chips> hide_axis('ax1')
chips> split(2, 1, 0)
chips> theta = cr.get_column("THETA").values
chips> theta_units = cr.get_column("THETA").unit
chips> add_curve(cpt, theta, ['line.style', 'noline'])
chips> set_plot_ylabel("Off axis angle ({})".format(theta_units))
chips> set_yaxis(['offset.perpendicular', 70, 'label.size', 16])
chips> set_plot_xlabel("Source number")
chips> set_xaxis(['label.size', 16])

Something went wrong

Here's a few things that can go wrong:

Coordinate issues

The error

# srcflux (16 Oct 2013): ERROR An error occurred while running 'psfsize_srcs':
  psfsize_srcs
            infile = repro/acisf06436_repro_evt2.fits
               pos = 52.3235594436 31.3791611941
           outfile = test_srcs.fits
            energy = 1.0
               ecf = 0.9
           psffile = CALDB
           verbose = 1
           clobber = no
              mode = hl

  # psfsize_srcs (2 Oct Sep 2013): ERROR pos value must be a filename or have a +, -, or comma separator

means that the pos parameter is invalid; in this particular case srcflux was run with pos="52.3235594436 31.3791611941" which is missing the sign on the declination; it should have been pos="52.3235594436 +31.3791611941".

This error is also seen when the pos argument is given a file that does not exist or can not be opened.


Sources at the edge of the field of view

You can see this error, when using psfmethod=quick:

# src_psffrac (5 Aug 2013): ERROR Only circle shapes are allowed

which means that your source region (or one of them) intersects the FOV or there's another source overlapping it that gets cut out. In this case try psfmethod=quick.


No counts

The following message means that the source region contains no counts. In this case an upper limit should be calculated but currently is not (the upper limit will be set to NaN instead).

An error occurred while running 'fluximage':
  Running fluximage
  Version: 13 December 2013

  # fluximage (13 December 2013): ERROR There are no events in repro/acisf06436_repro_evt2.fits...

History

12 Dec 2013 New for CIAO 4.6.
31 Dec 2013 Added note about wavdetect source candidates.
04 Dec 2014 Review for CIAO 4.7. Updated dmcoords call as the aspect solution file is no longer required; the information needed to account for the SIM drift is now included in the headers.


Last modified: 4 December 2014
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email:   cxchelp@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2017. All rights reserved.