Last modified: 15 Feb 2022


Computing the Intensity Upper Limit for an Unresolved Source

CIAO 4.14 Science Threads



The tool aprates, computes values and bounds for source intensity quantities (net counts, source rate, photon flux, energy flux) using counts and exposure data obtained in source and background apertures, as shown in the Compute Net Counts, Rate, or Flux for Point Sources thread.

The steps in this thread have been automated in the srcflux script. This thread shows how to get upper limits this way.

The thread then uses aprates to determine how x-ray bright a source could be at the given location in the observation. The intensity upper limit is calculated in flux units in this thread.

aprates uses Bayesian statistics to compute the background-marginalized, posterior probability distribution for source intensity, assuming non-informative prior distributions for background and source intensity (for details on the algorithm, see the Background Marginalized X-ray Source Intensity memo). The posterior distribution can be used to determine intensity value and confidence bounds or intensity upper limit.


To calculate the intensity upper limit for a source within a specified aperture.

Last Update: 15 Feb 2022 - Review for CIAO 4.14. Updated for Repro-5/CALDB 4.9.6.


Get Started

Download the sample data: 315 (ACIS-S, NGC 4038/39)

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.

Run srcflux

Figure 1 shows the x-ray data (left) and an optical image from the Digital Sky Survey (right). The optical image was retrieved from SAO-DSS via the ds9 "Analysis → Image Servers" menu. The star circled in white - 2MASS J12014790-1851156 - is clearly visible in the optical but not in x-ray.

Figure 1: Apertures overlaid on x-ray and optical data

[Thumbnail image: The source of interest is marked as a white circle in both ds9 frames.]

[Version: full-size]

[Print media version: The source of interest is marked as a white circle in both ds9 frames.]

Figure 1: Apertures overlaid on x-ray and optical data

The left frame contains the Chandra x-ray data and the right frame contains an optical image from the DSS. The location (ra,dec)=(12:01:47.9, -18:51:15.6) is circled in both frames.

The location (ra,dec)=(12:01:47.9, -18:51:15.6) will be used as the center of the apertures in this thread.

With srcflux we can get the upper limit on in the Chandra broad-band (0.5 to 7.0 keV) by simply

unix% punlearn srcflux
unix% pset srcflux infile=acisf00315_repro_evt2.fits
unix% pset srcflux outroot=dss
unix% pset srcflux pos="12:01:47.9 -18:51:15.6"
unix% pset srcflux psfmethod=quick
unix% srcflux
Summary of source fluxes

      Position                               0.5 - 7.0 keV                           
                                             Value        90% Conf Interval          
#0001|12 1 47.89 -18 51 15.6  Rate           1.3E-06 c/s (0,5.28E-05)                
                              Flux           NAN erg/cm2/s (NAN,NAN)                 
                              Mod.Flux       6.48E-18 erg/cm2/s (0,2.63E-16)         
                              Unabs Mod.Flux 6.92E-18 erg/cm2/s (0,2.81E-16)        

srcflux automatically creates source and background regions and extracts all the quantities discussed in the Step by Step section (below). The output shows that the 90% upper limit at the source location in the 0.5 to 7.0 keV range is roughly 5.31E-5 counts per second.

The tool outputs several files including the dss_broad.flux file that contains a summary of all the counts, rates, areas, and flux values.

unix% dmlist "dss_broad.flux[cols counts,bg_counts,area,bg_area,net_rate_aper_hi]"  data,clean
#  COUNTS               BG_COUNTS            AREA                 BG_AREA              NET_RATE_APER_HI
                  1.0                 23.0               20.750               518.50          5.28062E-05

The next section shows how to run the steps necessary to run the aprates tool.

Step By Step

Selecting the Apertures

A circle with radius 5" is used as the source region and an annulus with inner radius of 5" and outer radius of 10" is used for the background:



These are not the same as the apertures used above so the results are expected to be slightly different.

Counts in source and background apertures

The number of counts in the source (n) and background (m) apertures is found by running dmlist on the event file with the source and background regions. The energy range of the events is restricted to 0.5-7.0 keV:

unix% dmlist 'acisf00315_repro_evt2.fits[energy=500:7000][(ra,dec)=circle(12:01:47.9,-18:51:15.6,5")]' counts

unix% dmlist 'acisf00315_repro_evt2.fits[energy=500:7000][(ra,dec)=annulus(12:01:47.9,-18:51:15.6,5",15")]' counts

There are 14 source counts (n=14) and 130 background counts (m=130).

Areas of source and background apertures

The area of the source (A_s) and background (A_b) apertures is computed:

Source:   5^2 * pi = 78.5

Background: (15^2 - 5^2) * pi = 628.3

The source area is 78.5 square arcsec (A_s=78.5) and the background area is 628.3 square arcsec (A_b=628.3).

Exposure time of the observation

By setting the exposure times in the source (T_s) and background (T_b) apertures, the net source rate and errors will be computed.

For this example, the exposure time is the same for the source and background since they come from the same file:

unix% dmkeypar acisf00315_repro_evt2.fits LIVETIME echo+

The exposure time is 72242.2 s.

Run aprates to find the limit

For this calculation, it is assumed that 99% of the PSF is contained within the source region (alpha=.99) and 1% is in the background region (beta=.01). The following parameters are all set to "1" as we are not calculating flux: E_s, eng_s, flux_s, E_b, eng_b, and flux_b.

The aprates parameters are set with the values determined above and the tool is run. For details on how the tool does the calculations, refer to the aprates help file.

unix% punlearn aprates
unix% pset aprates n=15 m=130
unix% pset aprates A_s=78.5 A_b=628.3
unix% pset aprates alpha=0.99 beta=0.01
unix% pset aprates T_s=72242.2 T_b=72242.2
unix% pset aprates E_s=1 eng_s=1 flux_s=1 E_b=1 eng_b=1 flux_b=1 
unix% pset aprates outfile=ulimit.par

unix% aprates mode=h

You may see a warning:

# aprates (CIAO 4.4): WARNING: Large number of counts, just using Gaussian pdf

It indicates that Gaussian statistics were used instead of Poisson statistics; the threshold is controlled by the max_counts parameter.

The output file is in parameter file format, which makes it possible to query the output values with the tool pget:

unix% pget ulimit.par src_rate src_rate_err_lo src_rate_err_up

At the 68% confidence level, the upper limit on the x-ray count rate is 5.775e-05 counts/s.

The full output file, ulimit.par, is included at the end of the thread.

Parameters for /home/username/cxcds_param/ulimit.par

# ---- Inputs below ----


24 Jul 2009 New for CIAO 4.1: title updated to "Computing the Intensity Upper Limit for an Unresolved Source"
27 Jan 2010 updated for CIAO 4.2: use N004 version of data products from the Archive; screen output updated
15 Dec 2010 updated for CIAO 4.3: minor changes to screen output
10 Jan 2012 reviewed for CIAO 4.4: no changes
03 Dec 2012 Review for CIAO 4.5; no changes
11 Dec 2013 Review for CIAO 4.6; made step-by-step section and introduced a new section showing how to do in 1 command with srcflux
23 Dec 2014 Review for CIAO 4.7; minor edits only.
15 Feb 2022 Review for CIAO 4.14. Updated for Repro-5/CALDB 4.9.6.