Last modified: 05 December 2022

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

Calculate source count rates and fluxes for combined datasets

CIAO 4.15 Science Threads


Overview

Synopsis:

In this thread users will learn how to use srcflux to compute net count rates and fluxes for sources imaged in multiple observations (multi-obi, multi-obsid, aka merged).

Many parts of the sky have been observed by Chandra multiple times. Early in the mission these repeat pointings were often for large programs or for monitoring observations. More recently many observations are now also split into multiple shorter exposures due to thermal constraints. This has increased the need to easily obtain estimates of source properties from multiple observations.

The srcflux tool has been updated to produce estimates of the count rates, photon fluxes, and model-dependent fluxes by combining data from multiple observations. srcflux uses the aprates tool to estimate the uncertainties on these quantities similar to the approach taken in Version 1 of the Chandra Source Catalog.

It can be easy to obtain misleading results when this tool is used blindly. For example, source variability is not considered when estimating fluxes.

Run this thread if:

you want to compute counts, rates, photon fluxes, and model fluxes by combining data from multiple observations.

Related Links:

Last Update: 05 Dec 2022 - Review for CIAO 4.15. Updated to set bkgresp=yes to work around a bug introduced in CIAO 4.15.


Contents


Simple Case I: Single source, two observations

This thread will show how to use srcflux in increasingly complicated situations.

Identify Observations

We begin with a simple dataset comprised of two observations of Mrk 975.

unix% find_chandra_obsid "Mrk 975"
# obsid  sepn   inst grat   time    obsdate    piname    target
13899     0.0 ACIS-S NONE   10.0 2012-10-28 Mushotzky "Mrk 975"
15575     0.0 ACIS-S NONE    9.1 2012-11-02 Mushotzky "Mrk 975"

We can see that these two observations were taken a few days apart and have approximately the same exposure time.

[NOTE]
Note

There is no flag nor specific piece of metadata that indicates that multiple observations were split due to thermal constraints. Generally speaking they will be closely spaced in time, have identical detector configurations, and the mission planners try to match the pointings as best as possible.


Download Data

Download the sample data: 13899 (Mrk 975); 15575 (Mrk 975)

unix% download_chandra_obsid 13899,15575 

Before working with multiple observations, it can be useful to check various observation parameters. While it may be mechanically possible to compute fluxes for disparate datasets, users may encounter unexpected results so knowing what is being input into the processing before hand may help.

unix% dmdiff 13899/primary/*evt2.fits.gz 15575/primary/*evt2.fits.gz  data-  | \
  egrep 'SIM_|_NOM|_PNT|DATE-OBS|MJD_OBS|OBS_ID|FP_TEMP' 
DATE-OBS Values are not equal                   2012-10-28T12:07:12  2012-11-02T20:41:44
SIM_Z    Values are not equal                   -190.14006604987  -190.14258036517  -0.00251432 (+0.00132%)
RA_PNT   Values are not equal                    18.460110371879  18.460525677222  +0.000415305 (+0.00225%)
DEC_PNT  Values are not equal                    13.273523446552  13.272951427789  -0.000572019 (-0.00431%)
ROLL_PNT Values are not equal                    278.15394087308  278.15381775507  -0.000123118 (-4.43e-05%)
RA_NOM   Values are not equal                    18.460110371879  18.460525677222  +0.000415305 (+0.00225%)
DEC_NOM  Values are not equal                    13.273523446552  13.272951427789  -0.000572019 (-0.00431%)
ROLL_NOM Values are not equal                    278.15394087308  278.15381775507  -0.000123118 (-4.43e-05%)
OBS_ID   Values are not equal                              13899  15575           

These differences are all very small so we can proceed with the analysis.

[IMPORTANT]
Limitations

Users cannot combine ACIS with HRC data.

Users cannot combine ACIS TIMED modes (GRADED, FAINT, VFAINT) with CONTINIOUS clocking modes.

Users should be extra cautious if trying to combine 0th order grating data (either together or with non-grating observations).


Reprocessing the data

Users should, unless other wise instructed, always reprocess the data they obtain from the Chandra archive. This will make sure that the energy calibrations (gain) applied to the individual events matches the calibrations used to create the associated response files (ARF and RMF files) which are used to compute the fluxes. This can be especially important when working with data spanning multiple years with different calibrations (CALDBVER) and software versions (ASCDSVER).

unix% chandra_repro 13899,15575 outdir=""
[IMPORTANT]
Directory Structure

Users are strongly encouraged to use the default output directory name, outdir="" (ie a blank string, quotes added for emphasis). This will create individual repro directories under each OBS_ID; at the same level as the primary and secondary directories.

Various scripts such as srcflux and merge_obs need to locate several ancillary files including the badpixel file, aspect solution, and detector mask files. The file names for these products are stored in the header of the event file. The tools then need to search for these ancillary files in directories relative to the location of the event file. The list of directories searched, relative to the location of the event file, includes ./ (current directory), ../ (parent directory), ./repro, ../repro, ./primary, ./secondary, ../primary, and ../secondary.

The reprocessed data are shown in Figure 1

Figure 1: Mrk 975 Observations

[Thumbnail image: 2 frame image showing counts of Mrk 975]

[Version: full-size]

[Print media version: 2 frame image showing counts of Mrk 975]

Figure 1: Mrk 975 Observations

Unfiltered counts images of OBS_ID 13899 (left) and OBS_ID 15575 (right). The images have been zoomed to 8 and aligned on world-coordinates (wcs).

unix% ds9 -tile -log \
  13899/repro/acisf13899_repro_evt2.fits \
  -zoom to 8 -pan to 01:13:51.0426 +13:16:17.594 fk5 \
  15575/repro/acisf15575_repro_evt2.fits \
  -zoom to 8 -pan to 01:13:51.0426 +13:16:17.594 fk5

The point-like source is isolated; although for its proximity to the aimpoint (4096.5,4096.5 in physical coordinate for ACIS), the source does appear somewhat larger than the PSF. We may need to account for this later in the analysis.


Check for Offsets

It is in general a good idea to check the astrometric alignment of observations before trying to combine them. Even seemingly small offsets may lead to unexpected (incorrect) results. This can be done using a single source or an entire source catalog.

We start by computing the centroid of the source. We will restrict the energy band to the CSC "broad" band energy range (500 to 7000 eV). Since the source is so near the aimpoint and the source is bright we do not need to worry about the background skewing the centroid location. The centroid will be computed using dmstat in physical pixels and will need to be converted to celestial coordinates using dmcoords to be able to compare the two observations.

OBS_ID 13899 first:

unix% dmstat 13899/repro/acisf13899_repro_evt2.fits'[energy=500:7000,sky=circle(01:13:51.0436,+13:16:17.594,4")][bin sky=1]' \
      centroid=yes verb=0  
unix% pget dmstat out_cntrd_phys
4077.8910965,4082.5180297
unix% punlearn dmcoords
unix% dmcoords 13899/repro/acisf13899_repro_evt2.fits op=sky x=4077.8910965 y=4082.5180297 celfmt=hms v=0
unix% pget dmcoords ra dec
01:13:51.053
+13:16:17.80

and now for obsid 15575

unix% dmstat 15575/repro/acisf15575_repro_evt2.fits'[energy=500:7000,sky=circle(01:13:51.0436,+13:16:17.594,4")][bin sky=1]' \
      centroid=yes verb=0 
unix% pget dmstat out_cntrd_phys
4080.5849903,4086.5903161
unix% punlearn dmcoords
unix% dmcoords 15575/repro/acisf15575_repro_evt2.fits op=sky x=4080.5849903 y=4086.5903161 celfmt=hms v=0
unix% pget dmcoords ra dec
01:13:51.062
+13:16:17.74

We can see that the difference in the centroid location is much, much less than a pixel (0.492 arcsec) so applying a fine astrometric correction is not necessary for this source.


Merge Observations

Next we will create a combined image, exposure map, fluxed image, and PSF map from these two OBS_IDs. Technically, this step is not really even needed with this specific example; however, it can be useful to visualize the merged dataset before extracting the fluxes. As we will see later srcflux uses the individual observation data products.

unix% merge_obs 13899/repro,15575/repro out=merge/ bin=1 band=broad psfecf=0.9 clob+

The output are shown in Figure 2.

Figure 2: Merged Mrk 975 Observations

[Thumbnail image: merge image]

[Version: full-size]

[Print media version: merge image]

Figure 2: Merged Mrk 975 Observations

The broad band (0.5-7.0keV) counts image obtained by combining the reprojected events from the two datasets.

The faint line of events going left-to-right is the readout streak.

unix% ds9 -log merge/broad_thresh.img \
  -pan to 01:13:51.0436 +13:16:17.594 wcs \
  -zoom to 4 -scale limits 0 25 \
  -region command 'fk5;circle(01:13:51.0436,+13:16:17.594,4")'

Run wavdetect to get centroid

In this specific example where the centroid in both individual observations are so well determined we do not really need to do this step. However in the interest of generality we show how to use wavdetect to obtain the centroid of the source position. Users should consult the Running wavdetect thread for details about using the tool.

unix% punlearn wavdetect 
unix% pset wavdetect \
  infile=merge/broad_thresh.img \
  expfile=merge/broad_thresh.expmap \
  psffile=merge/broad_thresh.psfmap \
  outfile=merge/wav.src \
  scell=merge/wav.cell defnbkg=merge/wav.nbk imagef=merge/wav.recon \
  scale="1.4 2 4" mode=h clob+
  
unix% wavdetect mode=h

The output source list, merge/wav.src, contains the candidate sources and some preliminary source properties. Two sources were detected in this combined dataset

unix% dmlist merge/wav.src counts
2

and we can display them as in Figure 3.

Figure 3: Source Detections on Merged Dataset

[Thumbnail image: merge image]

[Version: full-size]

[Print media version: merge image]

Figure 3: Source Detections on Merged Dataset

Broad band merged data set with overlaid source regions.

unix% ds9 -log merge/broad_thresh.img -region merge/wav.src -block to 2 

Examining the source list we see that the source we are interested in is listed first. We can use dmlist to obtain the source position and prop_precess to convert to sexagesimal format.

unix% dmlist merge/wav.src"[cols x,y,ra,dec][#row=1]" data,clean
#  POS(X,Y)                                 RA                   DEC
     4079.2460881935      4084.6097676624        18.4627407642        13.2716124274
      
unix% prop_precess from j/deg to j/hms p0 eval 18.4627407642 13.2716124274
01 13 51.06 +13 16 17.80

This is consistent with the centroid obtained from the individual observations.

We also get the same result if we just use dmstat on the merged image.

unix% dmstat 'merge/broad_thresh.img[sky=circle(01:13:51.0436,+13:16:17.594,4")]' cen+ v=0
unix% pget dmstat out_cntrd_phys
4079.2495379,4084.5799445
unix% punlearn dmcoords 
unix% dmcoords merge/broad_thresh.img op=sky x=4079.2495379 y=4084.5799445 celfmt=hms verb=0
unix% pget dmcoords ra dec
01:13:51.057
+13:16:17.79
[TIP]
Short Cuts

In the example above we make use of several short cuts by specifying cen+ rather than the full centroid=yes and v=0 and verb=0 instead of the full verbose=0.


Run srcflux I: automatically generate regions

We are now ready to run srcflux. Users will want to review the Calculate source count rates and fluxes thread to review all the tool parameters and modes of operation.

To generate properties for a combined data, users should keep a few key points in mind when running srcflux

  • The infile parameter is a stack of event lists. Any valid stack syntax is supported.
  • The position parameter, pos, can be a single value, a stack of values, or read in from a file (eg a source list).
  • The srcreg and bkgreg parameters are optional. If omitted, the tool will create circular regions which enclose ~90% of the 1.0keV PSF. This is done separately for each observation in the infile stack. If these parameters are specified, then they both must be specified. They are stacks and must contain the same number of regions as positions listed in the pos parameter. The same region is used for all observations. Therefore, unless the input event files have been reprojected to a common tangent plane, users must use regions in celestial coordinates.

With these considerations in mind we create a stack of the per-observation event files.

unix% /bin/ls */repro/*evt2.fits > evt.lis
unix% cat evt.lis
13899/repro/acisf13899_repro_evt2.fits
15575/repro/acisf15575_repro_evt2.fits

The merged event file, merge/merged_evt.fits cannot be used. The event files for the individual OBS_IDs created by merge_obs could be used: merge/13899_reproj_evt.fits and merge/13899_reproj_evt.fits; however, users would need to be sure that the ancillary files are located in the same directory.

We then run srcflux with the stack of event files and the position of the source centroid computed above. The source and background regions are left as blank so that the script will automatically generate the 90%ECF @ 1keV circular regions for each OBS_ID.

unix% punlearn srcflux
unix% srcflux \
  infile=@evt.lis \
  out=sf1/out \
  srcreg="" bkgreg="" \
  pos="01:13:51.048,+13:16:17.84" \
  psfmethod=arfcorr bkgresp=yes conf=0.68 \
  mode=h clob+

The output looks like this. Note: the order of the processing is random.

srcflux
          infile = @evt.lis
             pos = 01:13:51.048,+13:16:17.84
         outroot = sf1/out
           bands = default
          srcreg = 
          bkgreg = 
         bkgresp = no
       psfmethod = arfcorr
         psffile = 
            conf = 0.68
         binsize = 1
         rmffile = 
         arffile = 
           model = xspowerlaw.pow1
       paramvals = pow1.PhoIndex=2.0
        absmodel = xsphabs.abs1
       absparams = abs1.nH=%GAL%
           abund = angr
         fovfile = 
        asolfile = 
         mskfile = 
        bpixfile = 
         dtffile = 
         ecffile = CALDB
        parallel = yes
           nproc = INDEF
          tmpdir = ./
     random_seed = -1
         clobber = yes
         verbose = 1
            mode = h

Processing OBI 001
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 sf1/out_obi001_0001_broad_rates.par
Running eff2evt for sf1/out_obi001_broad_0001_bkg.dat
Running eff2evt for sf1/out_obi001_broad_0001_src.dat
Making response files for sf1/out_obi001_0001
Running modeflux for region 1
Using GAL=0.0392 for source 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
Processing OBI 002
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 sf1/out_obi002_0001_broad_rates.par
Running eff2evt for sf1/out_obi002_broad_0001_src.dat
Running eff2evt for sf1/out_obi002_broad_0001_bkg.dat
Making response files for sf1/out_obi002_0001
Running modeflux for region 1
Using GAL=0.0392 for source 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
Combining count rates
Combining spectra and running model flux for each source
Running modeflux for region 1
Using GAL=0.0392 for source 1


Summary of source fluxes in OBI 001

      Position                               0.5 - 7.0 keV                           
                                             Value        68% Conf Interval          
#0001|1 13 51.04 +13 16 17.8  Rate           0.123 c/s (0.119,0.127)                 
                              Flux           2.32E-12 erg/cm2/s (2.25E-12,2.4E-12)   
                              Mod.Flux       8.92E-13 erg/cm2/s (8.64E-13,9.19E-13)  
                              Unabs Mod.Flux 9.51E-13 erg/cm2/s (9.22E-13,9.8E-13)   



Summary of source fluxes in OBI 002

      Position                               0.5 - 7.0 keV                           
                                             Value        68% Conf Interval          
#0001|1 13 51.04 +13 16 17.8  Rate           0.104 c/s (0.1,0.108)                   
                              Flux           1.87E-12 erg/cm2/s (1.81E-12,1.94E-12)  
                              Mod.Flux       7.55E-13 erg/cm2/s (7.28E-13,7.81E-13)  
                              Unabs Mod.Flux 8.05E-13 erg/cm2/s (7.77E-13,8.33E-13)  



Summary of merged source fluxes

      Position                               0.5 - 7.0 keV                           
                                             Value        68% Conf Interval          
#0001|1 13 51.04 +13 16 17.8  Rate           0.114 c/s (0.111,0.117)                 
  NumObi=2                    Mod.Flux       8.26E-13 erg/cm2/s (8.07E-13,8.45E-13)  
                              Unabs Mod.Flux 8.81E-13 erg/cm2/s (8.61E-13,9.02E-13)  

At the end, the normal per OBS_ID information about each source is shown along with a new section with the Summary of merged source fluxes.

Currently, we do not compute an estimate of the model-independent, eff2evt flux. Also since in general a source may only be imaged in some of the observations (due to differences in pointing or even spacecraft roll), the number of observations, NumObi, contributing to the merged fluxes is also reported.


Description of columns in the merged .flux file

When working with multiple observations srcflux appends obiNNN to the output root file name, where NNN is simply a number from 1 to N matching the order of the infile event lists.

The final merged output flux file is then simply ${root}_${band}.flux The columns in the merged .flux file are different from the individual obi files. The columns are described below.

Merged Flux Output Columns:

RAPOS, DECPOS, COMPONENT

Same as in the per-obi files.

TOTAL_COUNTS, TOTAL_BG_COUNTS

Simply the sum of the per-obi COUNTS and BG_COUNTS.

TOTAL_COUNTS, TOTAL_BG_COUNTS

Simply the sum of the per-obi COUNTS and BG_COUNTS.

NUM_OBI

Number of observations where the RAPOS,DECPOS is inside the that observation's field of view.

MERGED_NET_RATE_APER, MERGED_NET_RATE_APER_LO, MERGED_NET_RATE_APER_HI

These are the combined net rates and the associated confidence limits based on the NUM_OBI observations where the position is inside the field-of-view.

srcflux uses the same approach taken in Version 1 of the Chandra source catalog, specifically the Basic Formalism discussed in the memo Revised Specifications fo Computing Aperture Photometry Quantities. . The hard part is mapping the f,g, and r parameters to the aprates parameters. Using the equations from Evans et al section 3.7.2, we get

\[ \begin{array}{c} F = \sum_i \alpha_i T_{s,i} \\ G = \sum_i \beta_i T_{b,i} \\ R' = \frac{\sum_i r_i b_i}{\sum_i b_i} \end{array} \]

Using these we can derive the aprates input parameter values

aprates.n = \(C = \sum_i C_i\)
aprates.m = \(B = \sum_i B_i\)
aprates.T_s = \(T_s = \sum_i T_{s,i}\)
aprates.T_b = \(T_b = \sum_i T_{b,i}\)
aprates.alpha = \(\alpha = \sum_i \alpha_i E_{s,i} / \sum_i E_{s,i}\)
aprates.beta = \(\beta = \sum_i \beta_a E_{b,i} / \sum_i E_{b,i}\)
aprates.E_s = \(E_s = \sum_i E_{s,i}\)
aprates.E_b = \(E_b = \sum_i E_{b,i}\)
aprates.A_s = 1.0
aprates.A_b = \(R' (E_s/E_b)\)

were C,B are the counts in the source and background region, T is the exposure time, E is the effective area, and alpha, beta are the fraction of the PSF in the source and background regions.

Since aprates only ever uses the ratio of \(A_s/A_b\), we choose to simplify the inputs by setting \(A_s=1.0\). To compute count rates, the effective areas, E, is set to 1.0. To compute photon fluxes, the actual effective area is used.

MERGED_RATE_AREASCAL, MERGED_PHOTFLUX_AREASCAL

These are the R' terms when computing count rates and photon fluxes.

PSF_WEIGHTED_TOTAL_EXPOSURE_TIME

This is the F term when computing count rates.

MERGED_NET_APRATES_PHOTFLUX_APER, MERGED_NET_APRATES_PHOTFLUX_APER_LO, MERGED_NET_APRATES_PHOTFLUX_APER_HI

Same as MERGED_NET_RATE_APER (above), but using the actual effective area (averaged over the region) for the E terms.

This is different from the per-obi NET_PHOTFLUX_APER which uses the

PSF_WEIGHTED_TOTAL_SRC_EXPOSURE, PSF_WEIGHTED_TOTAL_BG_EXPOSURE

These are the F and G when computing photon fluxes.

MERGED_NET_PHOTFLUX_APER, MERGED_NET_PHOTFLUX_APER_LO, MERGED_NET_PHOTFLUX_APER_HI

These are simply the exposure weighted average NET_PHOTFLUX_APER from the individual OBS_IDs. The confidence intervals are computed by scaling the MERGE_NET_RATE_APER limits.

MFLUX_CNV, UMFLUX_CNV

srcflux combines the per OBS_ID response files (ARF and RMF), and uses them to compute the absorbed model flux MFLUX, and the unabsorbed model flux, UMFLUX.

These are the modelflux conversion factors to convert from count rates to fluxes.

MERGED_NET_MFLUX_APER, MERGED_NET_MFLUX_APER_LO, MERGED_NET_MFLUX_APER_HI

The (absorbed) model fluxes computed by combining the ARFs and RMF from all the valid OBS_IDs (where the position is inside the field-of-view). The MERGED_NET_RATE is scaled by MFLUX_CNV. The confidence limits are scaled by the same way.

MERGED_NET_UMFLUX_APER, MERGED_NET_UMFLUX_APER_LO, MERGED_NET_UMFLUX_APER_HI

Same as the MERGED_NET_MFLUX_APER, but for the unabsorbed model fluxes.

TOTAL_FLUX_APER, TOTAL_BG_FLUX_APER

The sum of the eff2evt fluxes in the source and background regions.

We are not currently computing a net flux using these values.


Run srcflux II: user supplied regions

As discussed in the previous section, the per OBS_ID data products are included in the output directory, using the name obiNNN where NNN is a 3 digit number matching the order of the infile event files.

Earlier we discussed that the sources may look large compared to the on-axis PSF. We can display the default 90%ECF @ 1keV regions created by srcflux on the event files to check that the regions are an appropriate size match. These are shown in Figure 4.

Figure 4: Simple Case: Automatically Generated Regions

[Thumbnail image: merge image]

[Version: full-size]

[Print media version: merge image]

Figure 4: Simple Case: Automatically Generated Regions

Image with automatically generated regions, 90% ECF at 1keV for off-axis angle in each separate observation.

unix% ds9 -tile -log \
  13899/repro/acisf13899_repro_evt2.fits \
  -zoom to 8 -pan to 01:13:51.048 +13:16:17.84 fk5 \
  -region sf1/out_obi001_0001_srcreg.fits \
  15575/repro/acisf15575_repro_evt2.fits \
  -zoom to 8 -pan to 01:13:51.048 +13:16:17.84 fk5 \
  -region sf1/out_obi002_0001_srcreg.fits

In this case the regions do look a little too small compared to the data. This may not necessarily be surprising given that observer "propose[d] to observe AGN in mergers with multiple nuclei". Given that, it may be that what is being imaged is multiple AGN that are not fully resolved.

We can use our own source and background regions with srcflux. We must specify both source and background, and we must specify the regions in celestial coordinates.

[IMPORTANT]
Regions must use celestial coordinates!

All FITS region files are interpreted as being in physical coordinates; not celestial coordinates. This includes the wavdetect (and other detect tools) source list, the skyfov field-of-view file, the source and background region extensions in the roi outputs. Even if the file contains a WCS on the position column, CIAO tools will only use the physical coordinates.

Physical coordinates are determined based on the tangent point. The tangent point is, by default out of the archive, the same as the mean pointing of the telescope. Most observations, even of the same field, and even those which are separated by only a few days do not have the pointing sufficient close to make the physical coordinates in separate observation be the same. If the coordinates are off even by just 1 pixel, 0.492arcsec, then the regions may not enclose the correct source.

However, since the pixel size (plate scale) is constant (fixed by detector hardware), users can use either physical pixel or degrees for the radii.

With this information in hand we can then generate source and background regions for this source. Given that there are no nearby sources, we will simply select a circle with a larger radius=5 pixels (~2.5arcsec) for the source region and an annulus with inner radius=6 and outer radius=12 pixels. The center of these shapes is the same as the position. These regions will be used for both OBS_IDs.

unix% punlearn srcflux
unix% srcflux \
  infile=@evt.lis \
  out=sf2/out \
  pos="01:13:51.048,+13:16:17.84" \
  srcreg="circle(01:13:51.048,+13:16:17.84,5)" \
  bkgreg="annulus(01:13:51.048,+13:16:17.84,6,12)" \
  psfmethod=arfcorr bkgresp=yes conf=0.68 \
  mode=h clob+

The screen output is similar to the first run.

srcflux
          infile = @evt.lis
             pos = 01:13:51.048,+13:16:17.84
         outroot = sf2/out
           bands = default
          srcreg = circle(01:13:51.048,+13:16:17.84,5)
          bkgreg = annulus(01:13:51.048,+13:16:17.84,6,12)
         bkgresp = no
       psfmethod = arfcorr
         psffile = 
            conf = 0.68
         binsize = 1
         rmffile = 
         arffile = 
           model = xspowerlaw.pow1
       paramvals = pow1.PhoIndex=2.0
        absmodel = xsphabs.abs1
       absparams = abs1.nH=%GAL%
           abund = angr
         fovfile = 
        asolfile = 
         mskfile = 
        bpixfile = 
         dtffile = 
         ecffile = CALDB
        parallel = yes
           nproc = INDEF
          tmpdir = ./
     random_seed = -1
         clobber = yes
         verbose = 1
            mode = h

Processing OBI 001
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 sf2/out_obi001_0001_broad_rates.par
Running eff2evt for sf2/out_obi001_broad_0001_src.dat
Running eff2evt for sf2/out_obi001_broad_0001_bkg.dat
Making response files for sf2/out_obi001_0001
Running modeflux for region 1
Using GAL=0.0392 for source 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
Processing OBI 002
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 sf2/out_obi002_0001_broad_rates.par
Running eff2evt for sf2/out_obi002_broad_0001_src.dat
Running eff2evt for sf2/out_obi002_broad_0001_bkg.dat
Making response files for sf2/out_obi002_0001
Running modeflux for region 1
Using GAL=0.0392 for source 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
Combining count rates
Combining spectra and running model flux for each source
Running modeflux for region 1
Using GAL=0.0392 for source 1


Summary of source fluxes in OBI 001

      Position                               0.5 - 7.0 keV                           
                                             Value        68% Conf Interval          
#0001|1 13 51.04 +13 16 17.8  Rate           0.124 c/s (0.121,0.128)                 
                              Flux           2.38E-12 erg/cm2/s (2.31E-12,2.45E-12)  
                              Mod.Flux       9.01E-13 erg/cm2/s (8.74E-13,9.27E-13)  
                              Unabs Mod.Flux 9.61E-13 erg/cm2/s (9.33E-13,9.89E-13)  



Summary of source fluxes in OBI 002

      Position                               0.5 - 7.0 keV                           
                                             Value        68% Conf Interval          
#0001|1 13 51.04 +13 16 17.8  Rate           0.111 c/s (0.107,0.114)                 
                              Flux           1.98E-12 erg/cm2/s (1.91E-12,2.04E-12)  
                              Mod.Flux       8.02E-13 erg/cm2/s (7.76E-13,8.28E-13)  
                              Unabs Mod.Flux 8.56E-13 erg/cm2/s (8.28E-13,8.84E-13)  



Summary of merged source fluxes

      Position                               0.5 - 7.0 keV                           
                                             Value        68% Conf Interval          
#0001|1 13 51.04 +13 16 17.8  Rate           0.118 c/s (0.115,0.12)                  
  NumObi=2                    Mod.Flux       8.54E-13 erg/cm2/s (8.35E-13,8.72E-13)  
                              Unabs Mod.Flux 9.11E-13 erg/cm2/s (8.91E-13,9.31E-13)  

As before, we can now display as in Figure 5 the per OBS_ID regions on their event files to double check our choices.

Figure 5: Simple Case: User Supplied Regions

[Thumbnail image: merge image]

[Version: full-size]

[Print media version: merge image]

Figure 5: Simple Case: User Supplied Regions

Image with user specified regions overlaid on each observation.

unix% ds9 -tile -log \
  13899/repro/acisf13899_repro_evt2.fits \
  -zoom to 8 -pan to 01:13:51.048 +13:16:17.84 fk5 \
  -region sf2/out_obi001_0001_srcreg.fits \
  15575/repro/acisf15575_repro_evt2.fits \
  -zoom to 8 -pan to 01:13:51.048 +13:16:17.84 fk5 \
  -region sf2/out_obi002_0001_srcreg.fits

We can then compare the count rates and fluxes between the two srcflux runs using dmdiff

unix% dmdiff sf1/out_broad.flux sf2/out_broad.flux 
Infile 1:  sf1/out_broad.flux
Infile 2:  sf2/out_broad.flux

----------------------------------------------------------------------
Compare Headers
----------------------------------------------------------------------
Compare Key Lists:
Compare Keyword Details:
# dmdiff (CIAO 4.14): WARNING: keyword 'CHECKSUM' comments differ.
# dmdiff (CIAO 4.14):   comment1="HDU checksum updated 2022-02-23T13:00:31"
# dmdiff (CIAO 4.14):   comment2="HDU checksum updated 2022-02-23T14:16:37"
# dmdiff (CIAO 4.14): WARNING: keyword 'DATASUM' comments differ.
# dmdiff (CIAO 4.14):   comment1="data unit checksum updated 2022-02-23T13:00:31"
# dmdiff (CIAO 4.14):   comment2="data unit checksum updated 2022-02-23T14:16:37"
Compare Keyword Values:
Keyword: Message:                                                        Value(s):                    Diff:
-------- -------------------------------------- ---------------------------------- ------------------------
CHECKSUM Values are not equal                   UY8fVV6fUV6fUV6f  i6eji4Zii4bii4Zi
DATASUM  Values are not equal                         3224502551  1041823904      
DATE     Values are not equal                   2022-02-23T13:00:30  2022-02-23T14:16:37

----------------------------------------------------------------------
Compare Subspaces
----------------------------------------------------------------------
Compare Subspace Structure:
Compare Column Details:
Compare Subspace Ranges: component 1
Compare Subspace Regions: component 1

----------------------------------------------------------------------
Compare Tables
----------------------------------------------------------------------
Compare Table Structure:
  Block name: HISTOGRAM
Compare Column Details:
Compare Virtual Column Details:
Compare Column Data:
Column:                             Row:           Message:                                                        Value(s):                    Diff:
----------------------------------- -------------- -------------------------------------- ---------------------------------- ------------------------
TOTAL_COUNTS                               1       Values are not equal                               1887  2134                     +247 (+13.1%)
TOTAL_BG_COUNTS                            1       Values are not equal                                279  43                       -236 (-84.6%)
MERGED_NET_RATE_APER                       1       Values are not equal                           0.114038  0.117881            +0.003843 (+3.37%)
MERGED_NET_RATE_APER_LO                    1       Values are not equal                           0.111423  0.115342            +0.003919 (+3.52%)
MERGED_NET_RATE_APER_HI                    1       Values are not equal                            0.11668  0.120446            +0.003766 (+3.23%)
MERGED_RATE_AREASCAL                       1       Values are not equal                   24.3199433847478  4.31433084438745     -20.0056 (-82.3%)
PSF_WEIGHTED_TOTAL_EXPOSURE_TIME           1       Values are not equal                   16524.4939517712  18095.0599382505     +1570.57 ( +9.5%)
MERGED_NET_APRATES_PHOTFLUX_APER           1       Values are not equal                         0.00031868  0.000329207       +1.0527e-05 ( +3.3%)
MERGED_NET_APRATES_PHOTFLUX_APER_LO        1       Values are not equal                        0.000311371  0.000322115       +1.0744e-05 (+3.45%)
MERGED_NET_APRATES_PHOTFLUX_APER_HI        1       Values are not equal                        0.000326061  0.000336371        +1.031e-05 (+3.16%)
MERGED_PHOTFLUX_AREASCAL                   1       Values are not equal                   24.3606683571605  4.3195989093047      -20.0411 (-82.3%)
PSF_WEIGHTED_TOTAL_SRC_EXPOSURE            1       Values are not equal                   5913273.06357038  6479412.70664406      +566140 (+9.57%)
PSF_WEIGHTED_TOTAL_BG_EXPOSURE             1       Values are not equal                   679722.114984218  118428.705929368      -561293 (-82.6%)
MERGED_NET_PHOTFLUX_APER                   1       Values are not equal                   0.000309440956401413  0.000329604596557333 +2.01636e-05 (+6.52%)
MERGED_NET_PHOTFLUX_APER_LO                1       Values are not equal                   0.00030234518042332  0.000322505351804921 +2.01602e-05 (+6.67%)
MERGED_NET_PHOTFLUX_APER_HI                1       Values are not equal                   0.000316609996605665  0.0003367765393655 +2.01665e-05 (+6.37%)
MFLUX_CNV                                  1       Values are not equal                         7.2435e-12  7.2434e-12             -1e-16 (-0.00138%)
UMFLUX_CNV                                 1       Values are not equal                         7.2435e-12  7.2434e-12             -1e-16 (-0.00138%)
MERGED_NET_MFLUX_APER                      1       Values are not equal                     8.26034253e-13  8.538592354e-13   +2.7825e-14 (+3.37%)
MERGED_NET_MFLUX_APER_LO                   1       Values are not equal                    8.070925005e-13  8.354682428e-13  +2.83757e-14 (+3.52%)
MERGED_NET_MFLUX_APER_HI                   1       Values are not equal                      8.4517158e-13  8.724385564e-13   +2.7267e-14 (+3.23%)
MERGED_NET_UMFLUX_APER                     1       Values are not equal                    8.811830298e-13  9.10866487e-13   +2.96835e-14 (+3.37%)
MERGED_NET_UMFLUX_APER_LO                  1       Values are not equal                    8.609766633e-13  8.91247634e-13    +3.0271e-14 (+3.52%)
MERGED_NET_UMFLUX_APER_HI                  1       Values are not equal                     9.01598028e-13  9.30686242e-13   +2.90882e-14 (+3.23%)
TOTAL_FLUX_APER                            1       Values are not equal                   1.82060559548256e-12  2.06747565088482e-12  +2.4687e-13 (+13.6%)
TOTAL_BG_FLUX_APER                         1       Values are not equal                   2.77901053799044e-13  4.86962191916089e-14 -2.29205e-13 (-82.5%)

We can see that in this example that there is about a 3% change in the net rates and fluxes; which given the number of counts is statistically significant (values are outside the 68% confidence limits).

Summary

So far this thread has demonstrated how to run srcflux on a stack of input event files to obtain the combined count rates and fluxes for a point-like (or possibly slightly extended) source. We have shown how to specify user supplied regions and how to check for the need to perform fine astrometric offset corrections. In the next section we show how to perform the astrometric corrections and check region sizes before running srcflux.


Simple Case II: Applying Astrometric Offsets

In this section we are going to build on the earlier techniques and apply them to a more common situation where users need to apply an astrometirc correction to their data before extracting merged properties.

Data preparation

We start this part of the thread with a similar setup: an on-axis point-like source observed in two observations.

unix% find_chandra_obsid "TWA 32"

# obsid  sepn   inst grat   time    obsdate  piname   target
18898     0.1 ACIS-S NONE   35.4 2017-04-09 Kastner "TWA 32"
20056     0.1 ACIS-S NONE   24.2 2017-04-14 Kastner "TWA 32"

As before the observations were taken just a couple of days apart and have similar exposure times. We then download the data

Download the sample data: 18898 (TWA 32); 20056 (TWA 32)

unix% download_chandra_obsid 18898,20056 

and reprocess it to apply the latest algorithms and calibrations.

unix% chandra_repro 18898,20056 out= verb=0

The data are shown in Figure 6.

Figure 6: TWA 32

[Thumbnail image: side-by-side images of TWA 32]

[Version: full-size]

[Print media version: side-by-side images of TWA 32]

Figure 6: TWA 32

A side-by-side comparison of obsids 18898 and 20056. The event files have been filtered to energy=500:7000 eV, and the frames have been aligned on their WCS.

unix% ds9 -tile -log -zoom to 4 \
  "18898/repro/acisf18898_repro_evt2.fits[events,energy=500:7000]" \
  -pan to 12:26:51 -33:16:13 fk5 \
  "20056/repro/acisf20056_repro_evt2.fits[events,energy=500:7000]" \
  -pan to 12:26:51 -33:16:13 fk5 \
  -match frame wcs 

Users will notice that there is a slight offset between the source location in the two observations. This is more obvious if we blink the frames in ds9 as shown in Figure 7.

Figure 7: TWA 32 Blinking Frames

[blinking frames TWA 32]
[Print media version: blinking frames TWA 32]

Figure 7: TWA 32 Blinking Frames

Same data in in Figure 6 already aligned on WCS. We used the ds9 "blink" functionality to see the location of the source shift between the observations.

unix% ds9 -tile -log -zoom to 4 \
  "18898/repro/acisf18898_repro_evt2.fits[events,energy=500:7000]" \
  -pan to 12:26:51 -33:16:13 fk5 \
  "20056/repro/acisf20056_repro_evt2.fits[events,energy=500:7000]" \
  -pan to 12:26:51 -33:16:13 fk5 \
  -match frame wcs \
  -movie frame gif blink.gif

Note: users can now save animated GIFs directly from ds9.


Check for astrometric offsets

Since we can see what appears to be an astrometric shift between the two observations, we can compute the centroid for the source and determine the offset.

First we compute the centroid for the source in OBS_ID 18898

unix% dmstat "18898/repro/acisf18898_repro_evt2.fits[energy=500:7000,sky=circle(12:26:51,-33:16:13,10)][bin sky=0.5]" cen+ v=0
unix% pget dmstat out_cntrd_phys
4078.2387641,4097.9778384

unix% punlearn dmcoords
unix% dmcoords 18898/repro/acisf18898_repro_evt2.fits op=sky x=4078.2387641 y=4097.9778384 celfmt=hms v=0
unix% pget dmcoords ra dec
12:26:51.267
-33:16:12.86

and now we compute the centroid in OBS_ID 20056

unix% dmstat "20056/repro/acisf20056_repro_evt2.fits[energy=500:7000,sky=circle(12:26:51,-33:16:13,10)][bin sky=0.5]" cen+ v=0
unix% pget dmstat out_cntrd_phys
4074.0906969,4096.6382979

unix% punlearn dmcoords
unix% dmcoords 20056/repro/acisf20056_repro_evt2.fits op=sky x=4074.0906969 y=4096.6382979 celfmt=hms v=0
unix% pget dmcoords ra dec
12:26:51.288
-33:16:13.19

The offset is ~0.5arcsec in dec (which is about 1 pixel). This is large enough to need to worry about it; especially for a source close to the aimpoint.


Correct for astrometric offsets

We will now apply an astrometric correction to one of the observation to shift the data to match the other. In this example we will shift the data for OBS_ID 18898 to match OBS_ID 20056. The choice of which observation to apply an astrometric correction to is arbitrary. Users interested in absolute position may which to cross-match the source with say a 3rd catalog and apply astrometric corrections to both datasets.

Users can review the Correcting Absolute Astrometry thread for a full discussion of the steps shown here.

The idea is to use wcs_match to compute the astrometric correction needed to align OBSID 18898 to OBSID 20056, and then use wcs_update to apply the correction. The input to wcs_match is two source lists with the RA and Dec of the sources to match. Since wcs_match can use the datamodel's ASCII kernel, we can easily create a simple ASCII file with the positions we obtain from dmcoords. The only trick is that the columns need to be in decimal degrees, so we change celfmt=deg in the examples below.

unix% mkdir fine_astro
unix% echo "#ra dec" > fine_astro/18898.dat
unix% punlearn dmcoords
unix% dmcoords 18898/repro/acisf18898_repro_evt2.fits op=sky x=4078.2387641 y=4097.9778384 celfmt=deg v=0
unix% pget dmcoords ra dec | paste - - >> fine_astro/18898.dat

paste is a UNIX command that should be available on most systems. With the two dashes, "-", after it, paste will paste the input text into two columns on output. The output looke like:

unix% cat fine_astro/18898.dat 
#ra dec
186.713616315192	-33.27024113433137

which the DM can read as a simple ASCII table with 2 columns (RA and Dec) and 1 row.

We now repeat for the 2nd observation

unix% echo "#ra dec" > fine_astro/20056.dat
unix% punlearn dmcoords
unix% dmcoords 20056/repro/acisf20056_repro_evt2.fits op=sky x=4074.0906969 y=4096.6382979 celfmt=deg v=0
unix% pget dmcoords ra dec | paste - - >> fine_astro/20056.dat

We can now run wcs_match to compute the astrometric offset needed to align the two observations on the coordinates of this source. With only 1 source position we can only use the translation-only solution, method=trans. In general unless there are many sources evenly distributed across the field, users should always use method=trans.

unix% punlearn wcs_match
unix% wcs_match \
  infile=fine_astro/18898.dat \
  ref=fine_astro/20056.dat \
  wcs=18898/repro/acisf18898_repro_evt2.fits \
  method=trans\
  out=fine_astro/wav.xform \
  radius=4 \
  clob+ verbose=2 mode=h

The verbose output has some useful diagnostic information, especially when matching multiple sources.

 input (dup) src file : fine_astro/18898.dat
 input ref src file   : fine_astro/20056.dat
 input wcsfile        : 18898/repro/acisf18898_repro_evt2.fits
 debug level          : 2

Opening wcsfile:  18898/repro/acisf18898_repro_evt2.fits
asp values from 18898/repro/acisf18898_repro_evt2.fits are:   186.711   -33.270     0.000
ref WCS values are: 
 wcrpix 	 4096.500	 4096.500 
 wcrval 	  186.711	   -33.270 
 wcdlt  	 -0.00013667	  0.00013667
xfmTableFilename is:  fine_astro/wav.xform
radius in arcsec, radius in sky pixels are:     4.000     8.130
residlim in arcsec, residlim in sky pixels are:     2.000     4.065
Opened dup srcs file:  fine_astro/18898.dat

Opened ref srcs file:  fine_astro/20056.dat

1 common sources found between: 
fine_astro/20056.dat
fine_astro/18898.dat
After deleting poor matches, 1 sources remain
Transform elements are:
	delta_x(sky pix):  -0.525661
	delta_y(sky pix):  -0.667922
	rotation(deg.):    0.000000
	scale factor:      1.000000

Source Residuals
----------------
 Match Ref# Dup#    Ref RA      Ref Dec.    Prior Resid           Transfm Resid         Resid  Incl
 Index              (deg.)      (deg.)      RSS (x,y)             RSS (x,y)             Ratio
                                            (arcsec)              (arcsec)
   0    0     0    186.71370   -33.27033    0.42 ( 0.26, 0.33)    0.00 (-0.00,-0.00)    0.00    Y

Source Residuals, before/after transform (arcsec), and percentage improvement:

   Average Residuals:         0.418183   0.000000  100.00%
   Maximum Residuals:         0.418183   0.000000  100.00%
   RMS Residuals:             0.295700   0.000000  100.00%

Source Residual Ratios, before/after transform, and percentage improvement:

   Average Residual Ratios:   0.424982   0.000000  100.00%
   Maximum Residual Ratios:   0.424982   0.000000  100.00%
   RMS Ratios:                0.300508   0.000000  100.00%

# wcs_match (CIAO 4.14): WARNING: Dup src x_err or ra_err cols not found.  Assuming x_err = 1.
# wcs_match (CIAO 4.14): WARNING: Dup src y_err or dec_err cols not found.  Assuming y_err = 1.
# wcs_match (CIAO 4.14): WARNING: Ref src x_err or ra_err cols not found.  Assuming x_err = 1.
# wcs_match (CIAO 4.14): WARNING: Ref src y_err or dec_err cols not found.  Assuming y_err = 1.

Looking at the output file, the offsets, in sky pixels (0.492arcsec/pixel), are

unix% dmlist fine_astro/wav.xform"[cols t1,t2]" data,clean

#  t1                   t2
    -0.52566100938611    -0.66792243254622

Now we apply the offsets to the event file and the aspect solution

unix% mkdir 18898/fine_astro/
unix% dmcopy 18898/repro/acisf18898_repro_evt2.fits 18898/fine_astro/acisf18898_repro_fac_evt2.fits
unix% wcs_update infile=18898/fine_astro/acisf18898_repro_fac_evt2.fits  \
  outfile="" \
  transform=fine_astro/wav.xform \
  wcs=")infile" clob+
unix% wcs_update infile= 18898/repro/pcadf608158476N001_asol1.fits \
  outfile=18898/fine_astro/pcadf608158476N001_fac_asol1.fits \
  transform=fine_astro/wav.xform \
  wcs=")infile" clob+  
unix% dmhedit 18898/fine_astro/acisf18898_repro_fac_evt2.fits \
  file= op=add key=ASOLFILE value=pcadf608158476N001_fac_asol1.fits   
[IMPORTANT]
Important

Do not skip updating the ASOLFILE name in the header of the event file. Failing to do this will result incorrect exposure maps and ARF files.

Finally we can recompute the centroid in the corrected dataset and recompute the offset to be sure that everything worked

unix% dmstat "18898/fine_astro/acisf18898_repro_fac_evt2.fits[energy=500:7000,sky=circle(12:26:51,-33:16:13,10)][bin sky=0.5]" cen+ v=0
unix% pget dmstat out_cntrd_phys
4078.293919,4097.9948752

unix% punlearn dmcoords
unix% dmcoords 18898/fine_astro/acisf18898_repro_fac_evt2.fits op=sky x=4078.3049873 y=4098.015509 celfmt=hms v=0
unix% pget dmcoords ra dec
12:26:51.286
-33:16:13.18

unix% echo "#ra dec" > fine_astro/18898_check.dat
unix% punlearn dmcoords
unix% dmcoords 18898/fine_astro/acisf18898_repro_fac_evt2.fits op=sky x=4078.3049873 y=4098.015509 celfmt=deg v=0
unix% pget dmcoords ra dec | paste - - >> fine_astro/18898_check.dat

Now repeat wcsmatch

unix% punlearn wcs_match
unix% wcs_match \
  infile=fine_astro/18898_check.dat \
  ref=fine_astro/20056.dat \
  wcs=18898/fine_astro/acisf18898_repro_fac_evt2.fits \
  method=trans\
  out=fine_astro/wav_check.xform \
  radius=4 \
  clob+ verbose=0 mode=h

unix% dmlist fine_astro/wav_check.xform"[cols t1,t2]" data,clean
#  t1                   t2
    -0.05515368200395    -0.01702177559764

The offsets are now much, much less than a pixel. We can proceed with merging the data.

[NOTE]
Why aren't the offsets identically 0.0?

If we did the correction, correctly, then they why aren't the offsets exactly 0.0?

Remember that the event coordinates are stored as real (floating) point values, not integers. So, a small shift in the WCS, means there will be a small shift in the pixel grid. When we bin this into an image, some events will be located in adjacent pixels. This leads to a slight change in the morphology of the source; and thus a slight change in the centroid.


Merge datasets

We want to be sure that merge_obs uses the event file with the astrometric corrections so we need to specify it explicitly by name:

unix% /bin/ls 18898/fine_astro/*evt2.fits > fac_evt2.lis
unix% /bin/ls 20056/repro/*evt2.fits >> fac_evt2.lis
unix% cat fac_evt2.lis
18898/fine_astro/acisf18898_repro_fac_evt2.fits
20056/repro/acisf20056_repro_evt2.fits

Since the 18898/fine_astro directory is at the same directory level as the 18898/repro directory, merge_obs and later srcflux will be able to locate the ancillary files.

We can now run merge_obs

unix% merge_obs "@fac_evt2.lis" out=merge_fac/ bin=1 band=broad psfecf=0.9 clob+
[NOTE]
Reprojecting vs. Astrometric corrections

wcs_update is used to apply offsets (usually small) to the world coordinates to modify the RA,Dec of the source. As used above, the physical pixel locations (x,y) do not change.

merge_obs (via reproject_events) is used to reproject the events to a new tangent plane projection. In this case, the physical coordinates (x,y) change, but the celestial coordinates remain the same.

In this example we are applying both corrections. We are aligning the data to match WCS and we are then reprojecting the data to a common tangent plane.

The combined dataset is shown in Figure 8.

Figure 8: Merged TWA 32, broad band

[Thumbnail image: 3 frames showing indi obsids and merge.]

[Version: full-size]

[Print media version: 3 frames showing indi obsids and merge.]

Figure 8: Merged TWA 32, broad band

(Left) Broad band counts image of OBS_ID 18898 after astrometric corrections and reprojection to new tangent point. (Center) Broad band counts image of OBS_ID 20056 after being reprojected to new tangent point. (Right) Combined counts image.

unix% ds9 -tile column -log -zoom to 8 \
  merge_fac/18898_broad_thresh.img -pan to 12:26:51.287 -33:16:13.18 fk5 \
  -region command "circle(4076.225058,4097.3433875,15) # color=red" \
  merge_fac/20056_broad_thresh.img -pan to 12:26:51.287 -33:16:13.18 fk5 \
  -region command "circle(4076.225058,4097.3433875,15) # color=cyan" \
  merge_fac/broad_thresh.img -pan to 12:26:51.287 -33:16:13.18 fk5 \
  -region command "circle(4076.225058,4097.3433875,15) # color=yellow"
 

Compute centroid for merged data

We now want to compute the centroid for the source in the merged dataset. This is important in this case because we have applied fine astrometric shift to the event positions and have reprojected the events to different tangent planes. The centroid is affected by how the events are binned and these corrections can introduce pixel-to-pixel variations when binning the real-valued event locations into images.

Since we are working with a single source, the dmstat method is usually quicker and as accurate as the wavdetect results.

unix% dmstat  "merge_fac/broad_thresh.img[sky=circle(12:26:51,-33:16:13,10)]" cen+ v=0
unix% pget dmstat out_cntrd_phys
4076.225058,4097.3433875

unix% punlearn dmcoords
unix% dmcoords merge_fac/broad_thresh.img op=sky x=4076.225058 y=4097.3433875 celfmt=hms v=0
unix% pget dmcoords ra dec
12:26:51.286
-33:16:13.17

Generate user supplied regions

In the previous example we saw that the default 90% ECF source regions were a little too small compared to the data. We can actually check this before running srcflux by using the psfsize_src tool (this is the same script srcflux uses). The idea is to generate the regions before running srcflux to check if maybe user supplied regions would be a better choice.

We start with generating the region for OBS_ID 18898

unix% psfsize_srcs merge_fac/18898_broad_thresh.img pos="12:26:51.287,-33:16:13.16" out=merge_fac/18898.src \
  energy=1.0 ecf=0.9 clob+

The script is run with the same parameters srcflux uses: energy=1.0 ecf=0.9. The output table is a FITS region file with additional coordinate information (such as off-axis angles, and mean chip coordinates). We are interested in the source radius

unix% dmlist merge_fac/18898.src"[cols x,y,r]" data,clean
#  X                    Y                    R
      4076.2039350898      4097.3826648022         1.6945846652

Only a 1.7 pixel radius (0.836 arcsec). This is almost the same size as the astrometric offset between the observations; this is why making that correction can be especially important when working with sources near the aimpoint.

And now we repeat the process for OBS_ID 20056

unix% psfsize_srcs merge_fac/20056_broad_thresh.img pos="12:26:51.287,-33:16:13.16" out=merge_fac/20056.src \
    energy=1.0 ecf=0.9 clob+

Since these are region files we can display them on the reprojected images as shown in Figure 9.

Figure 9: Default 90%ECF @ 1keV Regions

[Thumbnail image: ]

[Version: full-size]

[Print media version: ]

Figure 9: Default 90%ECF @ 1keV Regions

(Left) OBS_ID 18898 broad band image with default 90% ECF @ 1 keV region and (Right) OBS_ID 20056 broad band image with default 90% ECF @ 1keV region.

unix% ds9 \
  -tile -log -zoom to 8 \
  merge_fac/18898_broad_thresh.img \
  -pan to 12:26:51.299 -33:16:13.04 fk5 \
  -region color red \
  -region merge_fac/18898.src \
  merge_fac/20056_broad_thresh.img \
  -pan to 12:26:51.299 -33:16:13.04 fk5 \
  -region color cyan \
  -region merge_fac/20056.src
 

Again, in this example the default regions look to be a little too small compared to the data. Seeing this we will use user-supplied regions when running srcflux.


Run srcflux

We can now run srcflux. We want to be sure that we use the event file with the astrometric corrections applied, so we can use the same list file we created for the merge_obs step. We also are going to use custom source and background regions since we know that the default regions will be a little too small.

unix% punlearn srcflux
unix% srcflux \
  infile=@fac_evt2.lis \
  pos="12:26:51.287,-33:16:13.16" \
  srcreg="circle(12:26:51.287,-33:16:13.16,5)" \
  bkgreg="annulus(12:26:51.287,-33:16:13.16,6,12)" \
  out=sf/out \
  bkgresp=yes psfmethod=arfcorr conf=0.68 clob+

For brevity the full output is not shown here, but we can check the final merged rates and fluxes in the out_summary.txt file.

unix% cat sf/out_summary.txt

Summary of merged source fluxes

      Position                               0.5 - 7.0 keV                           
                                             Value        68% Conf Interval          
#0001|12 26 51.28 -33 16 13.1 Rate           0.00757 c/s (0.00721,0.00794)           
  NumObi=2                    Mod.Flux       7.52E-14 erg/cm2/s (7.16E-14,7.89E-14)  
                              Unabs Mod.Flux 8.25E-14 erg/cm2/s (7.85E-14,8.65E-14)  

Summary

In this section we saw how to include astrometric corrections into the processing steps needed to compute the combine source flux for a single source. In the next section we see how to work with multiple sources.


Using region files

As an alternative to using the region strings for the source and background regions

  srcreg="circle(12:26:51.287,-33:16:13.16,5)" \
  bkgreg="annulus(12:26:51.287,-33:16:13.16,6,12)" \

We can automatically create ds9 format region files using the regphystocel tool. We can use the centroid we obtained from the merged data set, 4076.225058,4097.3433875 to create ds9 format region files for the source region

unix% regphystocel in="circle(4076.225058,4097.3433875,5)" out=src.reg wcsfile=merge_fac/broad_thresh.img

unix% cat src.reg
% cat src.reg
# Region file format: DS9 version 4.1
global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1
fk5
circle(12:26:51.2861,-33:16:13.1793,2.46") #  

and background

unix% regphystocel in="annulus(4076.225058,4097.3433875,6,12)" out=bkg.reg wcsfile=merge_fac/broad_thresh.img
unix% cat bkg.reg
# Region file format: DS9 version 4.1
global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1
fk5
annulus(12:26:51.2861,-33:16:13.1793,2.952",5.904") #  

We can then use these files for the srcflux srcreg and bkgreg parameters.

  srcreg="src.reg" \
  bkgreg="bkg.reg" \

The output is the the same as before.


Multiple Sources in Multiple Observations

So far this thread has shown a very simple case of a single source in just two observations. In this section we show the steps involved in processing multiple sources in multiple observations.

Data Preparation: NGC 1960

The data preparation steps are the same as before: find, download, reprocesss. For this part of the thread we are going to use data for NGC 1960.

unix% find_chandra_obsid "NGC1960"

# obsid  sepn   inst grat   time    obsdate piname     target
21168     0.1 ACIS-I NONE   17.8 2018-12-26 Getman "NGC 1960"
22031     0.1 ACIS-I NONE   21.8 2018-12-27 Getman "NGC 1960"
22032     0.1 ACIS-I NONE   14.9 2019-01-01 Getman "NGC 1960"
22033     0.1 ACIS-I NONE   11.9 2019-01-06 Getman "NGC 1960"

As before, these observations are all close together although the exposure times vary by a factor of 2.

Download the sample data: 21168 (NGC 1960); 22031 (NGC 1960); 22032 (NGC 1960); 22033 (NGC 1960)

unix% download_chandra_obsid 21168,22031,22032,22033 

and reprocess:

unix% chandra_repro 21168,22031,22032,22033 out= clob+

Merge the observations

In this example we will skip ahead and go straight to the merge step. Our plan is to run wavdetect to detect sources and then use the wavdetect regions as inputs to srcflux Since those regions are generally large compared to the size of typical astrometric offsets and in the interest of shortening this thread we are skipping that step here. In general users should check for the need to apply astrometric offsets before combining data.

We now run merge_obs as before

unix% merge_obs 21168,22031,22032,22033 out=merge/ bin=1 psfecf=0.9 clob+ 

The merged broad and counts image is shown in Figure 10.

Figure 10: Merged broad band counts NGC 1960

[Thumbnail image: ]

[Version: full-size]

[Print media version: ]

Figure 10: Merged broad band counts NGC 1960

The merged broad band NGC 1960 image. Note that the data looks like a single observation. In this case the Chandra Mission Planners were able to match the pointings of the 4 observations nearly identically:

OBS_ID RA_PNT DEC_PNT ROLL_PNT
21168 84.0746513036 34.1320643551 240.2088824747
22031 84.0746609689 34.1320887396 240.2088779675
22032 84.0747288269 34.1324502781 240.2088698332
22033 84.0747142515 34.1319847628 240.2088789701

This is pretty remarkable given all the constraints and uncertainties when building the schedule.

unix% ds9 merge/broad_thresh.img -block to 6 -log 
[NOTE]
zoom vs. block

We use -block rather than -zoom to preserve total number of counts. (zoom-ing sub-samples or over-samples the image whereas block-ing rebins the image.).


Run wavdetect

We can now run wavdetect on the merged dataset

unix% mkdir detect

unix% punlearn wavdetect
unix% pset wavdetect \
  infile=merge/broad_thresh.img \
  expfile=merge/broad_thresh.expmap \
  psffile=merge/broad_thresh.psfmap \
  outfile=detect/wav.src \
  scales="1.4 2 4 8 12" \
  scell=detect/wav.cell defn=detect/wav.bkg imagef=detect/wav.recon \
  interdir=`pwd`/detect/ 

unix% wavdetect mode=h clobber=yes

and display the regions as in Figure 11.

Figure 11: Wavdetect sources in NGC 1960

[Thumbnail image: ]

[Version: full-size]

[Print media version: ]

Figure 11: Wavdetect sources in NGC 1960

Same as Figure 10 with the wavdetect candiate source detections shown.

unix% ds9 merge/broad_thresh.img -region detect/wav.src -block to 6 -log 

There are 225 sources detected in merged data. For simplicity we will filter out the a few of the brightest sources to make this thread go more quickly.

unix% dmcopy detect/wav.src"[src_significance>20]" detect/bright.src clob+
unix% dmlist detect/bright.src counts
10      
[CAUTION]
Source Candidates

Users are reminded to always scrutinize the output from any source detection tool and make adjustments if necessary. This may be false sources along the edge or readout streak, sources with radii=0, detecting sub-structure in the off-angle PSF as multiple sources, etc.

Users are also reminded that the properties output from wavdetect are preliminary and have not been corrected for things like PSF fractions.


Run srcflux using standard regions

We will start by simply running srcflux using the default regions. First we generate our stack list of input event files:

unix% /bin/ls {21168,22031,22032,22033}/repro/*evt2.fits > evt2.lis
unix% cat evt2.lis
21168/repro/acisf21168_repro_evt2.fits
22031/repro/acisf22031_repro_evt2.fits
22032/repro/acisf22032_repro_evt2.fits
22033/repro/acisf22033_repro_evt2.fits

and then we run srcflux.

unix% punlearn srcflux
unix% srcflux \
  infile=@evt2.lis \
  pos=detect/bright.src \
  srcreg="" bkgreg="" \
  outroot=sf1/out \
  bkgresp=yes clobber=yes conf=0.68 psfmethod=arfcorr \
  mode=h clob+

The verbose output looks similar to above but with more sources and more observations.

punlearn srcflux

srcflux \

  infile=@evt2.lis \

  pos=detect_many/bright.src \

  srcreg="" bkgreg="" \

  outroot=sf_many/out \

  bkgresp=no clobber=yes conf=0.68 psfmethod=arfcorr \

  mode=h clob+

srcflux
          infile = @evt2.lis
             pos = detect_many/bright.src
         outroot = sf_many/out
           bands = default
          srcreg = 
          bkgreg = 
         bkgresp = no
       psfmethod = arfcorr
         psffile = 
            conf = 0.68
         binsize = 1
         rmffile = 
         arffile = 
           model = xspowerlaw.pow1
       paramvals = pow1.PhoIndex=2.0
        absmodel = xsphabs.abs1
       absparams = abs1.nH=%GAL%
           abund = angr
         fovfile = 
        asolfile = 
         mskfile = 
        bpixfile = 
         dtffile = 
         ecffile = CALDB
        parallel = yes
           nproc = INDEF
          tmpdir = ./
     random_seed = -1
         clobber = yes
         verbose = 1
            mode = h

Processing OBI 001
Extracting counts
Making PSF models 
Getting PSF fraction by running arfcorr 1
Getting PSF fraction by running arfcorr 3
Getting PSF fraction by running arfcorr 2
Getting PSF fraction by running arfcorr 4
Getting PSF fraction by running arfcorr 5
Getting PSF fraction by running arfcorr 6
Getting PSF fraction by running arfcorr 7
Getting PSF fraction by running arfcorr 8
Getting PSF fraction by running arfcorr 9
Getting PSF fraction by running arfcorr 10
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 sf_many/out_obi001_0001_broad_rates.par
Running aprates for sf_many/out_obi001_0003_broad_rates.par
Running aprates for sf_many/out_obi001_0002_broad_rates.par
Running aprates for sf_many/out_obi001_0004_broad_rates.par
Running aprates for sf_many/out_obi001_0005_broad_rates.par
Running aprates for sf_many/out_obi001_0006_broad_rates.par
Running aprates for sf_many/out_obi001_0007_broad_rates.par
Running aprates for sf_many/out_obi001_0008_broad_rates.par
Running aprates for sf_many/out_obi001_0009_broad_rates.par
Running aprates for sf_many/out_obi001_0010_broad_rates.par
Running eff2evt for sf_many/out_obi001_broad_0001_src.dat
Running eff2evt for sf_many/out_obi001_broad_0002_src.dat
Running eff2evt for sf_many/out_obi001_broad_0003_src.dat
Running eff2evt for sf_many/out_obi001_broad_0004_src.dat
Running eff2evt for sf_many/out_obi001_broad_0005_src.dat
Running eff2evt for sf_many/out_obi001_broad_0006_src.dat
Running eff2evt for sf_many/out_obi001_broad_0007_src.dat
Running eff2evt for sf_many/out_obi001_broad_0008_src.dat
Running eff2evt for sf_many/out_obi001_broad_0009_src.dat
Running eff2evt for sf_many/out_obi001_broad_0010_src.dat
Running eff2evt for sf_many/out_obi001_broad_0001_bkg.dat
Running eff2evt for sf_many/out_obi001_broad_0002_bkg.dat
Running eff2evt for sf_many/out_obi001_broad_0003_bkg.dat
Running eff2evt for sf_many/out_obi001_broad_0004_bkg.dat
Running eff2evt for sf_many/out_obi001_broad_0005_bkg.dat
Running eff2evt for sf_many/out_obi001_broad_0006_bkg.dat
Running eff2evt for sf_many/out_obi001_broad_0007_bkg.dat
Running eff2evt for sf_many/out_obi001_broad_0008_bkg.dat
Running eff2evt for sf_many/out_obi001_broad_0009_bkg.dat
Running eff2evt for sf_many/out_obi001_broad_0010_bkg.dat
Making response files for sf_many/out_obi001_0001
Making response files for sf_many/out_obi001_0002
Making response files for sf_many/out_obi001_0003
Making response files for sf_many/out_obi001_0004
Running modeflux for region 1
Using GAL=0.5765 for source 1
Running modeflux for region 3
Using GAL=0.5777 for source 3
Running modeflux for region 2
Using GAL=0.5748 for source 2
Running modeflux for region 4
Using GAL=0.5746 for source 4
Making response files for sf_many/out_obi001_0005
Making response files for sf_many/out_obi001_0006
Making response files for sf_many/out_obi001_0007
Making response files for sf_many/out_obi001_0008
Running modeflux for region 8
Using GAL=0.575 for source 8
Running modeflux for region 7
Using GAL=0.5746 for source 7
Running modeflux for region 5
Using GAL=0.5727 for source 5
Running modeflux for region 6
Using GAL=0.5742 for source 6
Making response files for sf_many/out_obi001_0009
Making response files for sf_many/out_obi001_0010
Running modeflux for region 9
Running modeflux for region 10
Using GAL=0.5739 for source 9
Using GAL=0.578 for source 10
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
Processing OBI 002
Extracting counts
Making PSF models 
Getting PSF fraction by running arfcorr 2
Getting PSF fraction by running arfcorr 1
Getting PSF fraction by running arfcorr 3
Getting PSF fraction by running arfcorr 4
Getting PSF fraction by running arfcorr 5
Getting PSF fraction by running arfcorr 6
Getting PSF fraction by running arfcorr 7
Getting PSF fraction by running arfcorr 8
Getting PSF fraction by running arfcorr 9
Getting PSF fraction by running arfcorr 10
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 sf_many/out_obi002_0001_broad_rates.par
Running aprates for sf_many/out_obi002_0002_broad_rates.par
Running aprates for sf_many/out_obi002_0003_broad_rates.par
Running aprates for sf_many/out_obi002_0004_broad_rates.par
Running aprates for sf_many/out_obi002_0005_broad_rates.par
Running aprates for sf_many/out_obi002_0006_broad_rates.par
Running aprates for sf_many/out_obi002_0007_broad_rates.par
Running aprates for sf_many/out_obi002_0008_broad_rates.par
Running aprates for sf_many/out_obi002_0009_broad_rates.par
Running aprates for sf_many/out_obi002_0010_broad_rates.par
Running eff2evt for sf_many/out_obi002_broad_0001_src.dat
Running eff2evt for sf_many/out_obi002_broad_0002_src.dat
Running eff2evt for sf_many/out_obi002_broad_0003_src.dat
Running eff2evt for sf_many/out_obi002_broad_0004_src.dat
Running eff2evt for sf_many/out_obi002_broad_0005_src.dat
Running eff2evt for sf_many/out_obi002_broad_0006_src.dat
Running eff2evt for sf_many/out_obi002_broad_0007_src.dat
Running eff2evt for sf_many/out_obi002_broad_0008_src.dat
Running eff2evt for sf_many/out_obi002_broad_0009_src.dat
Running eff2evt for sf_many/out_obi002_broad_0010_src.dat
Running eff2evt for sf_many/out_obi002_broad_0001_bkg.dat
Running eff2evt for sf_many/out_obi002_broad_0002_bkg.dat
Running eff2evt for sf_many/out_obi002_broad_0003_bkg.dat
Running eff2evt for sf_many/out_obi002_broad_0004_bkg.dat
Running eff2evt for sf_many/out_obi002_broad_0005_bkg.dat
Running eff2evt for sf_many/out_obi002_broad_0006_bkg.dat
Running eff2evt for sf_many/out_obi002_broad_0007_bkg.dat
Running eff2evt for sf_many/out_obi002_broad_0008_bkg.dat
Running eff2evt for sf_many/out_obi002_broad_0009_bkg.dat
Running eff2evt for sf_many/out_obi002_broad_0010_bkg.dat
Making response files for sf_many/out_obi002_0001
Making response files for sf_many/out_obi002_0002
Making response files for sf_many/out_obi002_0003
Making response files for sf_many/out_obi002_0004
Running modeflux for region 3
Using GAL=0.5777 for source 3
Running modeflux for region 1
Using GAL=0.5765 for source 1
Running modeflux for region 2
Using GAL=0.5748 for source 2
Making response files for sf_many/out_obi002_0005
Making response files for sf_many/out_obi002_0006
Running modeflux for region 4
Using GAL=0.5746 for source 4
Making response files for sf_many/out_obi002_0007
Making response files for sf_many/out_obi002_0008
Running modeflux for region 5
Using GAL=0.5727 for source 5
Running modeflux for region 7
Using GAL=0.5746 for source 7
Running modeflux for region 6
Using GAL=0.5742 for source 6
Running modeflux for region 8
Using GAL=0.575 for source 8
Making response files for sf_many/out_obi002_0009
Making response files for sf_many/out_obi002_0010
Running modeflux for region 10
Using GAL=0.578 for source 10
Running modeflux for region 9
Using GAL=0.5739 for source 9
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

Processing OBI 003
Extracting counts
Making PSF models 
Getting PSF fraction by running arfcorr 1
Getting PSF fraction by running arfcorr 3
Getting PSF fraction by running arfcorr 2
Getting PSF fraction by running arfcorr 4
Getting PSF fraction by running arfcorr 5
Getting PSF fraction by running arfcorr 6
Getting PSF fraction by running arfcorr 7
Getting PSF fraction by running arfcorr 8
Getting PSF fraction by running arfcorr 9
Getting PSF fraction by running arfcorr 10
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 sf_many/out_obi003_0001_broad_rates.par
Running aprates for sf_many/out_obi003_0002_broad_rates.par
Running aprates for sf_many/out_obi003_0003_broad_rates.par
Running aprates for sf_many/out_obi003_0004_broad_rates.par
Running aprates for sf_many/out_obi003_0005_broad_rates.par
Running aprates for sf_many/out_obi003_0006_broad_rates.par
Running aprates for sf_many/out_obi003_0007_broad_rates.par
Running aprates for sf_many/out_obi003_0008_broad_rates.par
Running aprates for sf_many/out_obi003_0009_broad_rates.par
Running aprates for sf_many/out_obi003_0010_broad_rates.par
Running eff2evt for sf_many/out_obi003_broad_0001_src.dat
Running eff2evt for sf_many/out_obi003_broad_0002_src.dat
Running eff2evt for sf_many/out_obi003_broad_0003_src.dat
Running eff2evt for sf_many/out_obi003_broad_0004_src.dat
Running eff2evt for sf_many/out_obi003_broad_0005_src.dat
Running eff2evt for sf_many/out_obi003_broad_0006_src.dat
Running eff2evt for sf_many/out_obi003_broad_0007_src.dat
Running eff2evt for sf_many/out_obi003_broad_0008_src.dat
Running eff2evt for sf_many/out_obi003_broad_0009_src.dat
Running eff2evt for sf_many/out_obi003_broad_0010_src.dat
Running eff2evt for sf_many/out_obi003_broad_0001_bkg.dat
Running eff2evt for sf_many/out_obi003_broad_0002_bkg.dat
Running eff2evt for sf_many/out_obi003_broad_0003_bkg.dat
Running eff2evt for sf_many/out_obi003_broad_0004_bkg.dat
Running eff2evt for sf_many/out_obi003_broad_0005_bkg.dat
Running eff2evt for sf_many/out_obi003_broad_0006_bkg.dat
Running eff2evt for sf_many/out_obi003_broad_0007_bkg.dat
Running eff2evt for sf_many/out_obi003_broad_0008_bkg.dat
Running eff2evt for sf_many/out_obi003_broad_0009_bkg.dat
Running eff2evt for sf_many/out_obi003_broad_0010_bkg.dat
Making response files for sf_many/out_obi003_0001
Making response files for sf_many/out_obi003_0002
Making response files for sf_many/out_obi003_0003
Making response files for sf_many/out_obi003_0004
Running modeflux for region 3
Using GAL=0.5777 for source 3
Running modeflux for region 1
Using GAL=0.5765 for source 1
Making response files for sf_many/out_obi003_0005
Running modeflux for region 2
Using GAL=0.5748 for source 2
Making response files for sf_many/out_obi003_0006
Running modeflux for region 4
Using GAL=0.5746 for source 4
Making response files for sf_many/out_obi003_0007
Making response files for sf_many/out_obi003_0008
Running modeflux for region 5
Using GAL=0.5727 for source 5
Running modeflux for region 6
Using GAL=0.5742 for source 6
Running modeflux for region 7
Using GAL=0.5746 for source 7
Running modeflux for region 8
Using GAL=0.575 for source 8
Making response files for sf_many/out_obi003_0009
Making response files for sf_many/out_obi003_0010
Running modeflux for region 9
Using GAL=0.5739 for source 9
Running modeflux for region 10
Using GAL=0.578 for source 10
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
Processing OBI 004
Extracting counts
Making PSF models 
Getting PSF fraction by running arfcorr 2
Getting PSF fraction by running arfcorr 1
Getting PSF fraction by running arfcorr 3
Getting PSF fraction by running arfcorr 4
Getting PSF fraction by running arfcorr 5
Getting PSF fraction by running arfcorr 6
Getting PSF fraction by running arfcorr 7
Getting PSF fraction by running arfcorr 8
Getting PSF fraction by running arfcorr 9
Getting PSF fraction by running arfcorr 10
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 sf_many/out_obi004_0001_broad_rates.par
Running aprates for sf_many/out_obi004_0003_broad_rates.par
Running aprates for sf_many/out_obi004_0002_broad_rates.par
Running aprates for sf_many/out_obi004_0004_broad_rates.par
Running aprates for sf_many/out_obi004_0005_broad_rates.par
Running aprates for sf_many/out_obi004_0006_broad_rates.par
Running aprates for sf_many/out_obi004_0007_broad_rates.par
Running aprates for sf_many/out_obi004_0008_broad_rates.par
Running aprates for sf_many/out_obi004_0009_broad_rates.par
Running aprates for sf_many/out_obi004_0010_broad_rates.par
Running eff2evt for sf_many/out_obi004_broad_0001_src.dat
Running eff2evt for sf_many/out_obi004_broad_0002_src.dat
Running eff2evt for sf_many/out_obi004_broad_0003_src.dat
Running eff2evt for sf_many/out_obi004_broad_0004_src.dat
Running eff2evt for sf_many/out_obi004_broad_0005_src.dat
Running eff2evt for sf_many/out_obi004_broad_0006_src.dat
Running eff2evt for sf_many/out_obi004_broad_0007_src.dat
Running eff2evt for sf_many/out_obi004_broad_0008_src.dat
Running eff2evt for sf_many/out_obi004_broad_0009_src.dat
Running eff2evt for sf_many/out_obi004_broad_0010_src.dat
Running eff2evt for sf_many/out_obi004_broad_0001_bkg.dat
Running eff2evt for sf_many/out_obi004_broad_0002_bkg.dat
Running eff2evt for sf_many/out_obi004_broad_0003_bkg.dat
Running eff2evt for sf_many/out_obi004_broad_0004_bkg.dat
Running eff2evt for sf_many/out_obi004_broad_0005_bkg.dat
Running eff2evt for sf_many/out_obi004_broad_0006_bkg.dat
Running eff2evt for sf_many/out_obi004_broad_0007_bkg.dat
Running eff2evt for sf_many/out_obi004_broad_0008_bkg.dat
Running eff2evt for sf_many/out_obi004_broad_0009_bkg.dat
Running eff2evt for sf_many/out_obi004_broad_0010_bkg.dat
Making response files for sf_many/out_obi004_0001
Making response files for sf_many/out_obi004_0002
Making response files for sf_many/out_obi004_0003
Making response files for sf_many/out_obi004_0004
Running modeflux for region 3
Running modeflux for region 1
Using GAL=0.5777 for source 3
Using GAL=0.5765 for source 1
Running modeflux for region 2
Using GAL=0.5748 for source 2
Making response files for sf_many/out_obi004_0005
Making response files for sf_many/out_obi004_0006
Running modeflux for region 4
Using GAL=0.5746 for source 4
Making response files for sf_many/out_obi004_0007
Making response files for sf_many/out_obi004_0008
Running modeflux for region 7
Using GAL=0.5746 for source 7
Running modeflux for region 6
Running modeflux for region 5
Using GAL=0.5742 for source 6
Using GAL=0.5727 for source 5
Running modeflux for region 8
Using GAL=0.575 for source 8
Making response files for sf_many/out_obi004_0009
Making response files for sf_many/out_obi004_0010
Running modeflux for region 10
Using GAL=0.578 for source 10
Running modeflux for region 9
Using GAL=0.5739 for source 9
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
Combining count rates
Combining spectra and running model flux for each source
Running modeflux for region 1
Using GAL=0.5765 for source 1
Running modeflux for region 2
Using GAL=0.5748 for source 2
Running modeflux for region 3
Using GAL=0.5777 for source 3
Running modeflux for region 4
Using GAL=0.5746 for source 4
Running modeflux for region 5
Using GAL=0.5727 for source 5
Running modeflux for region 6
Using GAL=0.5742 for source 6
Running modeflux for region 7
Using GAL=0.5746 for source 7
Running modeflux for region 8
Using GAL=0.575 for source 8
Running modeflux for region 9
Using GAL=0.5739 for source 9
Running modeflux for region 10
Using GAL=0.578 for source 10


Summary of source fluxes in OBI 001

      Position                               0.5 - 7.0 keV                           

                                             Value        68% Conf Interval          
#0001|5 36 2.24 +34 4 41.0    Rate           0.00183 c/s (0.0015,0.0022)             
                              Flux           1.82E-14 erg/cm2/s (1.5E-14,2.2E-14)    
                              Mod.Flux       2.77E-14 erg/cm2/s (2.27E-14,3.34E-14)  
                              Unabs Mod.Flux 4.59E-14 erg/cm2/s (3.77E-14,5.53E-14)  

#0002|5 36 13.97 +34 4 54.7   Rate           0.000294 c/s (0.000168,0.000464)        
                              Flux           9.62E-15 erg/cm2/s (5.5E-15,1.52E-14)   
                              Mod.Flux       4.95E-15 erg/cm2/s (2.83E-15,7.81E-15)  
                              Unabs Mod.Flux 8.21E-15 erg/cm2/s (4.69E-15,1.29E-14)  

#0003|5 35 57.71 +34 5 0.2    Rate           0.00224 c/s (0.00187,0.00265)           
                              Flux           4.05E-14 erg/cm2/s (3.39E-14,4.79E-14)  
                              Mod.Flux       3.35E-14 erg/cm2/s (2.8E-14,3.96E-14)   
                              Unabs Mod.Flux 5.56E-14 erg/cm2/s (4.65E-14,6.57E-14)  

#0004|5 36 17.98 +34 5 38.7   Rate           0.000995 c/s (0.000766,0.00126)         
                              Flux           1.09E-14 erg/cm2/s (8.42E-15,1.38E-14)  
                              Mod.Flux       1.54E-14 erg/cm2/s (1.18E-14,1.95E-14)  
                              Unabs Mod.Flux 2.54E-14 erg/cm2/s (1.96E-14,3.23E-14)  

#0005|5 36 33.39 +34 6 5.1    Rate           0.000573 c/s (0.000398,0.000794)        
                              Flux           5.69E-15 erg/cm2/s (3.95E-15,7.88E-15)  
                              Mod.Flux       2.61E-14 erg/cm2/s (1.81E-14,3.61E-14)  
                              Unabs Mod.Flux 4.32E-14 erg/cm2/s (3E-14,5.98E-14)     

#0006|5 36 22.80 +34 6 7.3    Rate           5.78E-05 c/s (1.05E-05,0.000154)        
                              Flux           6.73E-16 erg/cm2/s (1.22E-16,1.79E-15)  
                              Mod.Flux       8.37E-16 erg/cm2/s (1.52E-16,2.23E-15)  
                              Unabs Mod.Flux 1.39E-15 erg/cm2/s (2.52E-16,3.69E-15)  

#0007|5 36 20.05 +34 6 11.6   Rate           0.000563 c/s (0.000396,0.000773)        
                              Flux           5.62E-15 erg/cm2/s (3.96E-15,7.72E-15)  
                              Mod.Flux       8.35E-15 erg/cm2/s (5.88E-15,1.15E-14)  
                              Unabs Mod.Flux 1.38E-14 erg/cm2/s (9.73E-15,1.9E-14)   

#0008|5 36 17.87 +34 6 31.8   Rate           0.00115 c/s (0.000899,0.00144)          
                              Flux           1.12E-14 erg/cm2/s (8.76E-15,1.4E-14)   
                              Mod.Flux       1.75E-14 erg/cm2/s (1.37E-14,2.19E-14)  
                              Unabs Mod.Flux 2.89E-14 erg/cm2/s (2.27E-14,3.63E-14)  

#0009|5 36 40.84 +34 10 14.1  Rate           0.00323 c/s (0.00276,0.00369)           
                              Flux           6.73E-15 erg/cm2/s (5.77E-15,7.71E-15)  
                              Mod.Flux       5.05E-14 erg/cm2/s (4.32E-14,5.78E-14)  
                              Unabs Mod.Flux 8.35E-14 erg/cm2/s (7.15E-14,9.56E-14)  

#0010|5 36 11.47 +34 10 37.4  Rate           0.00133 c/s (0.00106,0.00164)           
                              Flux           1.84E-14 erg/cm2/s (1.47E-14,2.27E-14)  
                              Mod.Flux       2.03E-14 erg/cm2/s (1.62E-14,2.5E-14)   
                              Unabs Mod.Flux 3.37E-14 erg/cm2/s (2.69E-14,4.15E-14)  



Summary of source fluxes in OBI 002

      Position                               0.5 - 7.0 keV                           
                                             Value        68% Conf Interval          
#0001|5 36 2.24 +34 4 41.0    Rate           0.00205 c/s (0.00173,0.0024)            
                              Flux           3.58E-14 erg/cm2/s (3.03E-14,4.19E-14)  
                              Mod.Flux       3.1E-14 erg/cm2/s (2.62E-14,3.63E-14)   
                              Unabs Mod.Flux 5.14E-14 erg/cm2/s (4.34E-14,6.02E-14)  

#0002|5 36 13.97 +34 4 54.7   Rate           0.00272 c/s (0.00235,0.00311)           
                              Flux           4.18E-14 erg/cm2/s (3.6E-14,4.77E-14)   
                              Mod.Flux       4.57E-14 erg/cm2/s (3.94E-14,5.21E-14)  
                              Unabs Mod.Flux 7.58E-14 erg/cm2/s (6.53E-14,8.63E-14)  

#0003|5 35 57.71 +34 5 0.2    Rate           0.00215 c/s (0.00182,0.00251)           
                              Flux           4.86E-14 erg/cm2/s (4.12E-14,5.67E-14)  
                              Mod.Flux       3.21E-14 erg/cm2/s (2.72E-14,3.75E-14)  
                              Unabs Mod.Flux 5.33E-14 erg/cm2/s (4.52E-14,6.22E-14)  

#0004|5 36 17.98 +34 5 38.7   Rate           0.0037 c/s (0.00326,0.00414)            
                              Flux           5E-14 erg/cm2/s (4.4E-14,5.59E-14)      
                              Mod.Flux       5.73E-14 erg/cm2/s (5.05E-14,6.41E-14)  
                              Unabs Mod.Flux 9.48E-14 erg/cm2/s (8.36E-14,1.06E-13)  

#0005|5 36 33.39 +34 6 5.1    Rate           0.00137 c/s (0.00111,0.00166)           
                              Flux           1.81E-14 erg/cm2/s (1.47E-14,2.2E-14)   
                              Mod.Flux       6.46E-14 erg/cm2/s (5.25E-14,7.83E-14)  
                              Unabs Mod.Flux 1.07E-13 erg/cm2/s (8.68E-14,1.3E-13)   

#0006|5 36 22.80 +34 6 7.3    Rate           9.47E-05 c/s (3.36E-05,0.000194)        
                              Flux           1.51E-15 erg/cm2/s (5.37E-16,3.1E-15)   
                              Mod.Flux       1.38E-15 erg/cm2/s (4.89E-16,2.82E-15)  
                              Unabs Mod.Flux 2.28E-15 erg/cm2/s (8.1E-16,4.68E-15)   

#0007|5 36 20.05 +34 6 11.6   Rate           0.000575 c/s (0.000413,0.000771)        
                              Flux           9.13E-15 erg/cm2/s (6.56E-15,1.22E-14)  
                              Mod.Flux       8.66E-15 erg/cm2/s (6.22E-15,1.16E-14)  
                              Unabs Mod.Flux 1.43E-14 erg/cm2/s (1.03E-14,1.92E-14)  

#0008|5 36 17.87 +34 6 31.8   Rate           0.00371 c/s (0.00327,0.00416)           
                              Flux           4.97E-14 erg/cm2/s (4.37E-14,5.56E-14)  
                              Mod.Flux       5.67E-14 erg/cm2/s (4.99E-14,6.35E-14)  
                              Unabs Mod.Flux 9.39E-14 erg/cm2/s (8.27E-14,1.05E-13)  

#0009|5 36 40.84 +34 10 14.1  Rate           0.00364 c/s (0.00319,0.00409)           
                              Flux           5.16E-14 erg/cm2/s (4.53E-14,5.8E-14)   
                              Mod.Flux       5.69E-14 erg/cm2/s (4.99E-14,6.39E-14)  
                              Unabs Mod.Flux 9.42E-14 erg/cm2/s (8.27E-14,1.06E-13)  

#0010|5 36 11.47 +34 10 37.4  Rate           0.000891 c/s (0.000691,0.00113)         
                              Flux           8.73E-15 erg/cm2/s (6.76E-15,1.1E-14)   
                              Mod.Flux       1.36E-14 erg/cm2/s (1.05E-14,1.72E-14)  
                              Unabs Mod.Flux 2.26E-14 erg/cm2/s (1.75E-14,2.85E-14)  



Summary of source fluxes in OBI 003

      Position                               0.5 - 7.0 keV                           
                                             Value        68% Conf Interval          
#0001|5 36 2.24 +34 4 41.0    Rate           0.00291 c/s (0.00245,0.00342)           
                              Flux           3.22E-14 erg/cm2/s (2.71E-14,3.79E-14)  
                              Mod.Flux       4.46E-14 erg/cm2/s (3.76E-14,5.24E-14)  
                              Unabs Mod.Flux 7.4E-14 erg/cm2/s (6.23E-14,8.69E-14)   

#0002|5 36 13.97 +34 4 54.7   Rate           0.000836 c/s (0.0006,0.00113)           
                              Flux           9.5E-15 erg/cm2/s (6.82E-15,1.28E-14)   
                              Mod.Flux       1.45E-14 erg/cm2/s (1.04E-14,1.96E-14)  
                              Unabs Mod.Flux 2.4E-14 erg/cm2/s (1.73E-14,3.24E-14)   

#0003|5 35 57.71 +34 5 0.2    Rate           0.00283 c/s (0.00238,0.00333)           
                              Flux           3.67E-14 erg/cm2/s (3.08E-14,4.31E-14)  

                              Mod.Flux       4.28E-14 erg/cm2/s (3.59E-14,5.03E-14)  
                              Unabs Mod.Flux 7.09E-14 erg/cm2/s (5.96E-14,8.34E-14)  

#0004|5 36 17.98 +34 5 38.7   Rate           0.000772 c/s (0.000545,0.00105)         
                              Flux           2.7E-15 erg/cm2/s (1.91E-15,3.68E-15)   
                              Mod.Flux       1.19E-14 erg/cm2/s (8.39E-15,1.62E-14)  
                              Unabs Mod.Flux 1.97E-14 erg/cm2/s (1.39E-14,2.68E-14)  

#0005|5 36 33.39 +34 6 5.1    Rate           0.00122 c/s (0.000933,0.00156)          
                              Flux           1.39E-14 erg/cm2/s (1.06E-14,1.77E-14)  
                              Mod.Flux       5.88E-14 erg/cm2/s (4.49E-14,7.53E-14)  
                              Unabs Mod.Flux 9.73E-14 erg/cm2/s (7.43E-14,1.25E-13)  

#0006|5 36 22.80 +34 6 7.3    Rate           0.000227 c/s (0.000114,0.000392)        
                              Flux           1.92E-15 erg/cm2/s (9.65E-16,3.31E-15)  
                              Mod.Flux       3.29E-15 erg/cm2/s (1.65E-15,5.68E-15)  
                              Unabs Mod.Flux 5.45E-15 erg/cm2/s (2.74E-15,9.41E-15)  

#0007|5 36 20.05 +34 6 11.6   Rate           0.00866 c/s (0.00783,0.00949)           
                              Flux           1.21E-13 erg/cm2/s (1.09E-13,1.32E-13)  
                              Mod.Flux       1.27E-13 erg/cm2/s (1.15E-13,1.39E-13)  
                              Unabs Mod.Flux 2.1E-13 erg/cm2/s (1.9E-13,2.3E-13)     

#0008|5 36 17.87 +34 6 31.8   Rate           0.00075 c/s (0.000537,0.00101)          
                              Flux           1.29E-14 erg/cm2/s (9.26E-15,1.74E-14)  
                              Mod.Flux       1.14E-14 erg/cm2/s (8.16E-15,1.54E-14)  
                              Unabs Mod.Flux 1.89E-14 erg/cm2/s (1.35E-14,2.55E-14)  

#0009|5 36 40.84 +34 10 14.1  Rate           0.00373 c/s (0.00318,0.00429)           
                              Flux           4.73E-14 erg/cm2/s (4.04E-14,5.44E-14)  
                              Mod.Flux       5.84E-14 erg/cm2/s (4.98E-14,6.7E-14)   
                              Unabs Mod.Flux 9.66E-14 erg/cm2/s (8.24E-14,1.11E-13)  

#0010|5 36 11.47 +34 10 37.4  Rate           0.00107 c/s (0.00081,0.00138)           
                              Flux           1.25E-14 erg/cm2/s (9.44E-15,1.61E-14)  
                              Mod.Flux       1.63E-14 erg/cm2/s (1.24E-14,2.11E-14)  
                              Unabs Mod.Flux 2.71E-14 erg/cm2/s (2.05E-14,3.49E-14)  



Summary of source fluxes in OBI 004

      Position                               0.5 - 7.0 keV                           
                                             Value        68% Conf Interval          
#0001|5 36 2.24 +34 4 41.0    Rate           0.00102 c/s (0.000725,0.00138)          
                              Flux           NAN erg/cm2/s (NAN,NAN)                 
                              Mod.Flux       1.62E-14 erg/cm2/s (1.15E-14,2.19E-14)  
                              Unabs Mod.Flux 2.68E-14 erg/cm2/s (1.91E-14,3.63E-14)  

#0002|5 36 13.97 +34 4 54.7   Rate           0.000182 c/s (6.98E-05,0.000363)        
                              Flux           1.92E-15 erg/cm2/s (7.4E-16,3.85E-15)   
                              Mod.Flux       3.08E-15 erg/cm2/s (1.19E-15,6.16E-15)  
                              Unabs Mod.Flux 5.1E-15 erg/cm2/s (1.96E-15,1.02E-14)   

#0003|5 35 57.71 +34 5 0.2    Rate           0.00302 c/s (0.00251,0.0036)            
                              Flux           5.83E-14 erg/cm2/s (4.85E-14,6.95E-14)  
                              Mod.Flux       4.52E-14 erg/cm2/s (3.75E-14,5.38E-14)  
                              Unabs Mod.Flux 7.5E-14 erg/cm2/s (6.23E-14,8.93E-14)   

#0004|5 36 17.98 +34 5 38.7   Rate           0.000372 c/s (0.000204,0.000605)        
                              Flux           7.43E-15 erg/cm2/s (4.07E-15,1.21E-14)  
                              Mod.Flux       5.72E-15 erg/cm2/s (3.13E-15,9.3E-15)   
                              Unabs Mod.Flux 9.47E-15 erg/cm2/s (5.18E-15,1.54E-14)  

#0005|5 36 33.39 +34 6 5.1    Rate           0.00143 c/s (0.00109,0.00183)           
                              Flux           3.32E-15 erg/cm2/s (2.53E-15,4.27E-15)  
                              Mod.Flux       5.67E-14 erg/cm2/s (4.32E-14,7.28E-14)  
                              Unabs Mod.Flux 9.38E-14 erg/cm2/s (7.15E-14,1.21E-13)  

#0006|5 36 22.80 +34 6 7.3    Rate           0.00819 c/s (0.0073,0.0091)             
                              Flux           1.23E-13 erg/cm2/s (1.1E-13,1.37E-13)   
                              Mod.Flux       1.19E-13 erg/cm2/s (1.06E-13,1.32E-13)  
                              Unabs Mod.Flux 1.97E-13 erg/cm2/s (1.75E-13,2.19E-13)  

#0007|5 36 20.05 +34 6 11.6   Rate           0.000255 c/s (0.000132,0.000442)        
                              Flux           7.49E-15 erg/cm2/s (3.87E-15,1.3E-14)   
                              Mod.Flux       4.15E-15 erg/cm2/s (2.14E-15,7.18E-15)  
                              Unabs Mod.Flux 6.87E-15 erg/cm2/s (3.55E-15,1.19E-14)  

#0008|5 36 17.87 +34 6 31.8   Rate           0.00109 c/s (0.000803,0.00143)          
                              Flux           1.33E-14 erg/cm2/s (9.84E-15,1.75E-14)  
                              Mod.Flux       1.65E-14 erg/cm2/s (1.22E-14,2.17E-14)  
                              Unabs Mod.Flux 2.73E-14 erg/cm2/s (2.02E-14,3.59E-14)  

#0009|5 36 40.84 +34 10 14.1  Rate           0.00424 c/s (0.0036,0.0049)             
                              Flux           5.96E-14 erg/cm2/s (5.05E-14,6.87E-14)  
                              Mod.Flux       6.64E-14 erg/cm2/s (5.63E-14,7.66E-14)  
                              Unabs Mod.Flux 1.1E-13 erg/cm2/s (9.33E-14,1.27E-13)   

#0010|5 36 11.47 +34 10 37.4  Rate           0.00115 c/s (0.000844,0.00152)          
                              Flux           1.05E-14 erg/cm2/s (7.69E-15,1.38E-14)  
                              Mod.Flux       1.77E-14 erg/cm2/s (1.3E-14,2.34E-14)   
                              Unabs Mod.Flux 2.94E-14 erg/cm2/s (2.16E-14,3.88E-14)  



Summary of merged source fluxes

      Position                               0.5 - 7.0 keV                           
                                             Value        68% Conf Interval          
#0001|5 36 2.24 +34 4 41.0    Rate           0.002 c/s (0.00181,0.00219)             
  NumObi=4                    Mod.Flux       3.06E-14 erg/cm2/s (2.78E-14,3.35E-14)  
                              Unabs Mod.Flux 5.08E-14 erg/cm2/s (4.6E-14,5.56E-14)   

#0002|5 36 13.97 +34 4 54.7   Rate           0.0012 c/s (0.00106,0.00135)            
  NumObi=4                    Mod.Flux       2.04E-14 erg/cm2/s (1.79E-14,2.29E-14)  
                              Unabs Mod.Flux 3.37E-14 erg/cm2/s (2.97E-14,3.79E-14)  

#0003|5 35 57.71 +34 5 0.2    Rate           0.00249 c/s (0.00228,0.0027)            
  NumObi=4                    Mod.Flux       3.73E-14 erg/cm2/s (3.42E-14,4.04E-14)  
                              Unabs Mod.Flux 6.18E-14 erg/cm2/s (5.66E-14,6.71E-14)  

#0004|5 36 17.98 +34 5 38.7   Rate           0.00174 c/s (0.00157,0.00191)           
  NumObi=4                    Mod.Flux       2.68E-14 erg/cm2/s (2.41E-14,2.95E-14)  
                              Unabs Mod.Flux 4.44E-14 erg/cm2/s (4E-14,4.89E-14)     

#0005|5 36 33.39 +34 6 5.1    Rate           0.00114 c/s (0.000998,0.00128)          
  NumObi=4                    Mod.Flux       5.17E-14 erg/cm2/s (4.53E-14,5.82E-14)  
                              Unabs Mod.Flux 8.55E-14 erg/cm2/s (7.49E-14,9.63E-14)  

#0006|5 36 22.80 +34 6 7.3    Rate           0.00156 c/s (0.0014,0.00173)            
  NumObi=4                    Mod.Flux       2.27E-14 erg/cm2/s (2.03E-14,2.51E-14)  
                              Unabs Mod.Flux 3.75E-14 erg/cm2/s (3.36E-14,4.15E-14)  

#0007|5 36 20.05 +34 6 11.6   Rate           0.00231 c/s (0.00211,0.00251)           
  NumObi=4                    Mod.Flux       3.48E-14 erg/cm2/s (3.18E-14,3.79E-14)  
                              Unabs Mod.Flux 5.77E-14 erg/cm2/s (5.27E-14,6.27E-14)  


#0008|5 36 17.87 +34 6 31.8   Rate           0.00192 c/s (0.00174,0.0021)            
  NumObi=4                    Mod.Flux       2.92E-14 erg/cm2/s (2.64E-14,3.2E-14)   
                              Unabs Mod.Flux 4.84E-14 erg/cm2/s (4.38E-14,5.3E-14)   

#0009|5 36 40.84 +34 10 14.1  Rate           0.00366 c/s (0.0034,0.00392)            
  NumObi=4                    Mod.Flux       5.72E-14 erg/cm2/s (5.32E-14,6.13E-14)  
                              Unabs Mod.Flux 9.47E-14 erg/cm2/s (8.81E-14,1.01E-13)  

#0010|5 36 11.47 +34 10 37.4  Rate           0.00112 c/s (0.000976,0.00126)          
  NumObi=4                    Mod.Flux       1.71E-14 erg/cm2/s (1.49E-14,1.92E-14)  
                              Unabs Mod.Flux 2.83E-14 erg/cm2/s (2.48E-14,3.19E-14)  


Plot Fluxes

It can be hard to interpret the verbose output; and even viewing the individual output .flux files can be overwhelming. We have provided a little helper script in this thread to plot, for each source individually, the Model Flux in each of the individual OBS_IDs to compare with the merged model flux.

Users can download the script here: Download plotit.py

unix% python plotit.py

The results for two sources are shown in Figure 12 and Figure 13.

Figure 12: Constant Source in NGC 1960

[Thumbnail image: consant source]

[Version: full-size]

[Print media version: consant source]

Figure 12: Constant Source in NGC 1960

The model flux in each individual OBS_ID with the 1-sigma confidence limits. This is the source identified as "0010" in the srcflux verbose output. The solid horizontal line is the Model Flux computed for the merged data, the dashed horizontal lines are the 1-sigma confidence limits.

This source appears to have constant flux during these 4 observations.

Figure 13: Variable Source in NGC 1960

[Thumbnail image: ]

[Version: full-size]

[Print media version: ]

Figure 13: Variable Source in NGC 1960

Same as Figure 12 but for the source identified as "0006". This source shows significant change in flux during OBS_ID 22033.

In this case, the merged model flux from all 4 observations is less meaningful.

The source shown in Figure 13 looks to be variable. The model flux increases significantly during OBS_ID 22033. We can take a look at the source in each of the OBS_IDs to see if this results makes sense. The images are shown in Figure 14.

Figure 14: Variable Source in NGC 1960

[Thumbnail image: ]

[Version: full-size]

[Print media version: ]

Figure 14: Variable Source in NGC 1960

The unfiltered counts images for (left to right) obsid 21168, 22031, 22032, and 22033. The variable source shown in Figure 13 is at the center of each frame.

The right most frame is for OBSID 22033 which clearly has the most counts. From the find_chandra_obsid output above, we also know that it was the shortest observation (11.9ksec). This change in brightness is consistent with the srcflux results.

Since the source is variable the srcflux fluxes may not be as useful.

unix% ds9 -tile column -log \
  21168/repro/acisf21168_repro_evt2.fits \
  -region sf1/out_obi001_broad.flux \
  22031/repro/acisf22031_repro_evt2.fits \
  -region sf1/out_obi002_broad.flux \
  22032/repro/acisf22032_repro_evt2.fits \
  -region sf1/out_obi003_broad.flux \
  22033/repro/acisf22033_repro_evt2.fits \
  -region sf1/out_obi004_broad.flux \
  -pan to 05:36:22.809 34:06:07.2869 fk5 \
  -bin to 1 -zoom to 8 \
  -match frame wcs

Use wavdetect regions in srcflux

We can also see in Figure 14 that the default 90%ECF regions are not a great choice for this source. So far we have seen how to input a single source region into srcflux but manually creating source and background regions for each source would be tedious. Instead we can follow technique shown in the Calculate source count rates and fluxes thread. This involves running the roi tool to automatically create source and background regions from the wavdetect source list.

unix% mkdir roi
unix% punlearn roi

unix% roi \
  infile=detect/bright.src \
  outsrc=roi/bright_%02d.fits \
  group=indi target=target \
  compute_conf- clob+ mode=h

This creates a separate source region for each group=individual source with the background region located around just the target=target source. The output files have the source number in the file name, taken from the COMPONENT value in the input file. Since we filtered the source list, the output file names look like:

unix% /bin/ls roi
bright_03.fits	bright_05.fits	bright_17.fits	bright_19.fits	bright_68.fits
bright_04.fits	bright_12.fits	bright_18.fits	bright_25.fits	bright_74.fits

Luckily, COMPONENT values in the source list are in ascending order, so the srcflux region 0010 is bright_74.fits and region 0006 is bright_18.fits.

We need the regions in celestial coordinates; but FITS regions like those created by roi are in physical coordinates. The new script regphystocel is used to do the conversion.

The roi output file has 2 extensions: source and background. Both need to be converted to celestial coordinates. The easiest way to loop over the files is with the UNIX xargs command, something like this:

unix% /bin/ls roi/*fits | xargs -I@ regphystocel @ @.srcreg clob+ verb=0
unix% /bin/ls roi/*fits | xargs -I@ regphystocel @"[bkgreg]" @.bkgreg clob+ verb=0

However, for users unfamiliar with that utility, they can also use the sh|bash|zsh specific for command or the tcsh specific foreach command to loop over the files.

bash$ for r in roi/*.fits
do
  regphystocel $r ${r}.srcreg clob+ verb=0
  regphystocel "${r}[bkgreg]"" ${r}.bkgreg clob+ verb=0
done

-or- 

tcsh% foreach r ( roi/*.fits )
  regphystocel $r ${r}.srcreg clob+ verb=0
  regphystocel "${r}[bkgreg]"" ${r}.bkgreg clob+ verb=0
end

The source and background region file names are then stored in separate list files.

unix% /bin/ls roi/*srcreg > srcreg.lis
unix% /bin/ls roi/*bkgreg > bkgreg.lis

We then re-run srcflux using these stacks of region file names

unix% punlearn srcflux
unix% srcflux \
  infile=@evt2.lis \
  pos=detect/bright.src \
  outroot=sf2/out \
  srcreg=@srcreg.lis \
  bkgreg=@bkgreg.lis \
  bkgresp=yes clobber=yes conf=0.68 psfmethod=arfcorr \
  mode=h clob+

Each source will use the same source and background regions with each observation. The new regions for source #0006 are shown in Figure 15.

Figure 15: Variable Source in NGC 1960, wavdetect regions

[Thumbnail image: ]

[Version: full-size]

[Print media version: ]

Figure 15: Variable Source in NGC 1960, wavdetect regions

Same as Figure 14 but with the wavdetect regions displayed. The rotated ellipses provide a better estimate of the extent of the source.

unix% ds9 -tile column -log \
  21168/repro/acisf21168_repro_evt2.fits \
  -region sf2/out_obi001_broad.flux \
  22031/repro/acisf22031_repro_evt2.fits \
  -region sf2/out_obi002_broad.flux \
  22032/repro/acisf22032_repro_evt2.fits \
  -region sf2/out_obi003_broad.flux \
  22033/repro/acisf22033_repro_evt2.fits \
  -region sf2/out_obi004_broad.flux \
  -pan to 05:36:22.809 34:06:07.2869 fk5 \
  -bin to 1 -zoom to 8 \
  -match frame wcs

Summary

In this final example we saw how to use srcflux to compute rates and fluxes for multiple source positions together with multiple source and background regions with multiple observations. We saw how important it is to review the results since things like source variability between observations may lead to aberrant results.


Final Summary

This thread has shown how to use srcflux to compute rates and fluxes for sources which have been observed in multiple observations. We saw how to handle the simple case of a single source in two nearly identically pointed observations. We saw how to deal with situations which require applying astrometric corrections before computing fluxes. The thread wrapped up with a large example of processing a catalog of source positions in multiple observations. We demonstrated several diagnostic techniques to improve the flux and rate estimates, and showed how to use user-supplied regions throughout.

We also discussed the limitation of this tool, for example, in the presence of variable sources.


History

16 Dec 2020 New.
05 Dec 2022 Review for CIAO 4.15. Updated to set bkgresp=yes to work around a bug introduced in CIAO 4.15.