Last modified: 16 December 2020

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

Calculate source count rates and fluxes for combined datasets

CIAO 4.13 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: 16 Dec 2020 - New.


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' 
Values are not equal                     MJD_OBS  56228.505003229  56233.862319055      +5.35732
Values are not equal                    DATE-OBS 2012-10-28T12:07:12  2012-11-02T20:41:44
Values are not equal                       SIM_Z -190.14006604987  -190.14258036517  -0.00251432
Values are not equal                      RA_PNT  18.465356356702  18.465368760055  +1.24034e-05
Values are not equal                     DEC_PNT  13.270513718548  13.270494541896  -1.91767e-05
Values are not equal                    ROLL_PNT  278.15594337661  278.1559595872   +1.62106e-05
Values are not equal                      RA_NOM  18.465356356702  18.465368760055  +1.24034e-05
Values are not equal                     DEC_NOM  13.270513718548  13.270494541896  -1.91767e-05
Values are not equal                    ROLL_NOM  278.15594337661  278.1559595872   +1.62106e-05
Values are not equal                      OBS_ID            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.9064012,4082.5038859
unix% punlearn dmcoords
unix% dmcoords 13899/repro/acisf13899_repro_evt2.fits op=sky x=4077.9064012 y=4082.5038859 celfmt=hms v=0
unix% pget dmcoords ra dec
01:13:51.043
+13:16:17.85

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.5575744,4086.5765411
unix% punlearn dmcoords
unix% dmcoords 15575/repro/acisf15575_repro_evt2.fits op=sky x=4080.5575744 y=4086.5765411 celfmt=hms v=0
unix% pget dmcoords ra dec
01:13:51.053
+13:16:17.79

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.2470365102      4084.6116642959        18.4627009968        13.2716285502
      
unix% prop_precess from j/deg to j/hms p0 eval 18.4627009968 13.2716285502
01 13 51.05 +13 16 17.86

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.2468793,4084.5829866
unix% punlearn dmcoords 
unix% dmcoords merge/broad_thresh.img op=sky x=4079.2468793 y=4084.5829866 celfmt=hms verb=0
unix% pget dmcoords ra dec
01:13:51.048
+13:16:17.84
[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=no 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 = /tmp
     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_src.dat
Running eff2evt for sf1/out_obi001_broad_0001_bkg.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.121 c/s (0.118,0.125)                 
                              Flux           2.29E-12 erg/cm2/s (2.22E-12,2.36E-12)  
                              Mod.Flux       8.77E-13 erg/cm2/s (8.5E-13,9.04E-13)   
                              Unabs Mod.Flux 9.35E-13 erg/cm2/s (9.06E-13,9.64E-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.107 c/s (0.104,0.111)                 
                              Flux           1.89E-12 erg/cm2/s (1.82E-12,1.95E-12)  
                              Mod.Flux       7.78E-13 erg/cm2/s (7.51E-13,8.05E-13)  
                              Unabs Mod.Flux 8.3E-13 erg/cm2/s (8.01E-13,8.58E-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.115 c/s (0.112,0.117)                 
  NumObi=2                    Mod.Flux       8.3E-13 erg/cm2/s (8.11E-13,8.49E-13)   
                              Unabs Mod.Flux 8.85E-13 erg/cm2/s (8.65E-13,9.05E-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=no 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 = /tmp
     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
Making response files for sf2/out_obi002_0001
Running eff2evt for sf2/out_obi002_broad_0001_bkg.dat
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.125 c/s (0.121,0.128)                 
                              Flux           2.38E-12 erg/cm2/s (2.31E-12,2.45E-12)  
                              Mod.Flux       8.99E-13 erg/cm2/s (8.73E-13,9.26E-13)  
                              Unabs Mod.Flux 9.6E-13 erg/cm2/s (9.32E-13,9.88E-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.01E-13 erg/cm2/s (7.75E-13,8.27E-13)  
                              Unabs Mod.Flux 8.54E-13 erg/cm2/s (8.27E-13,8.82E-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.121)                 
  NumObi=2                    Mod.Flux       8.53E-13 erg/cm2/s (8.34E-13,8.71E-13)  
                              Unabs Mod.Flux 9.1E-13 erg/cm2/s (8.9E-13,9.29E-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

-----------------------
HEADER VALUE DIFFERENCES
-----------------------


Message:                                Keyword:              Value(s):                    Diff:
--------                                 -------              ---------                    -----
Values are not equal                    CHECKSUM JUanKTRmJTXmJTXm  o9bAp6b9o6bAo6b9
# dmdiff (CIAO 4.12): WARNING: CHECKSUM comments are different.
# dmdiff (CIAO 4.12):   comment1= "HDU checksum updated 2020-08-03T12:51:52"
# dmdiff (CIAO 4.12):   comment2= "HDU checksum updated 2020-08-03T12:52:56"
Values are not equal                     DATASUM       2910047035  232363624       
# dmdiff (CIAO 4.12): WARNING: DATASUM comments are different.
# dmdiff (CIAO 4.12):   comment1= "data unit checksum updated 2020-08-03T12:51:52"
# dmdiff (CIAO 4.12):   comment2= "data unit checksum updated 2020-08-03T12:52:56"
Values are not equal                        DATE 2020-08-03T12:51:52  2020-08-03T12:52:56

--------------------------
SUBSPACE VALUE DIFFERENCES
--------------------------

Message:                         Column:       Row              Value(s):                    Diff:
--------                         -------       ---              ---------                    -----



TABLE NAME: HISTOGRAM

-----------------------
TABLE VALUE DIFFERENCES
-----------------------

Message:                             Row:        Column:              Value(s):                    Diff:
--------                             ----        -------              ---------                    -----
Values are not equal                   1        TOTAL_COUNTS             1888  2136                     +248 (+13.1 %)
Values are not equal                   1        TOTAL_BG_COUNTS              276  41                       -235 (-85.1 %)
Values are not equal                   1        MERGED_NET_RATE_APER          0.11356  0.119043            +0.005483 (+4.83 %)
Values are not equal                   1        MERGED_NET_RATE_APER_LO         0.110957  0.116481            +0.005524 (+4.98 %)
Values are not equal                   1        MERGED_NET_RATE_APER_HI         0.116189  0.121632            +0.005443 (+4.68 %)
Values are not equal                   1        MERGED_RATE_AREASCAL 24.3169014084507  4.31503579952267     -20.0019 (-82.3 %)
Values are not equal                   1        PSF_WEIGHTED_TOTAL_EXPOSURE_TIME 16603.4297095689  17941.3038399038     +1337.87 (+8.06 %)
Values are not equal                   1        MERGED_NET_APRATES_PHOTFLUX_APER       0.00031749  0.000332571       +1.5081e-05 (+4.75 %)
Values are not equal                   1        MERGED_NET_APRATES_PHOTFLUX_APER_LO      0.000310212  0.000325412         +1.52e-05 ( +4.9 %)
Values are not equal                   1        MERGED_NET_APRATES_PHOTFLUX_APER_HI      0.000324842  0.000339803       +1.4961e-05 (+4.61 %)
Values are not equal                   1        MERGED_PHOTFLUX_AREASCAL  24.346453694791  4.33035468181381     -20.0161 (-82.2 %)
Values are not equal                   1        PSF_WEIGHTED_TOTAL_SRC_EXPOSURE 5938746.36996694  6422086.63254042      +483340 (+8.14 %)
Values are not equal                   1        PSF_WEIGHTED_TOTAL_BG_EXPOSURE 677169.301187338  120679.678469323      -556490 (-82.2 %)
Values are not equal                   1        MERGED_NET_PHOTFLUX_APER 0.000312928981936387  0.000333002209856406 +2.00732e-05 (+6.41 %)
Values are not equal                   1        MERGED_NET_PHOTFLUX_APER_LO 0.000305756085318032  0.00032583545782855 +2.00794e-05 (+6.57 %)
Values are not equal                   1        MERGED_NET_PHOTFLUX_APER_HI 0.000320173524852121  0.000340244489715938  +2.0071e-05 (+6.27 %)
Values are not equal                   1        MFLUX_CNV        7.221e-12  7.2209e-12             -1e-16 (-0.00138 %)
Values are not equal                   1        UMFLUX_CNV        7.221e-12  7.2209e-12             -1e-16 (-0.00138 %)
Values are not equal                   1        MERGED_NET_MFLUX_APER    8.2001676e-13  8.595975987e-13  +3.95808e-14 (+4.83 %)
Values are not equal                   1        MERGED_NET_MFLUX_APER_LO   8.01220497e-13  8.410976529e-13  +3.98772e-14 (+4.98 %)
Values are not equal                   1        MERGED_NET_MFLUX_APER_HI   8.39000769e-13  8.782925088e-13  +3.92917e-14 (+4.68 %)
Values are not equal                   1        MERGED_NET_UMFLUX_APER   8.74775392e-13  9.170001333e-13  +4.22247e-14 (+4.83 %)
Values are not equal                   1        MERGED_NET_UMFLUX_APER_LO  8.547239624e-13  8.972647911e-13  +4.25408e-14 (+4.98 %)
Values are not equal                   1        MERGED_NET_UMFLUX_APER_HI  8.950271048e-13  9.369434592e-13  +4.19164e-14 (+4.68 %)
Values are not equal                   1        TOTAL_FLUX_APER 1.80370665960967e-12  2.06677659918337e-12  +2.6307e-13 (+14.6 %)
Values are not equal                   1        TOTAL_BG_FLUX_APER 2.89125195918762e-13  4.20619216295676e-14 -2.47063e-13 (-85.5 %)

We can see that in this example that there is about a 5% 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.2740023,4097.9848871

unix% punlearn dmcoords
unix% dmcoords 18898/repro/acisf18898_repro_evt2.fits op=sky x=4078.2740023 y=4097.9848871 celfmt=hms v=0
unix% pget dmcoords ra dec
12:26:51.281
-33:16:12.57

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.2740023 y=4097.9848871 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.7136714512405	-33.27015972502366

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.188336
	delta_y(sky pix):  -1.263590
	rotation(deg.):    0.000000
	scale factor:      1.000000

Source Residuals
----------------
 Src  Ref#  Dup#    Ref RA      Ref Dec.    Prior Resid           Transfm Resid         Resid  Incl
 Indx               (deg.)      (deg.)      RSS (x,y)             RSS (x,y)             Ratio
                                            (arcsec)              (arcsec)
   0    0     0    186.71370   -33.27033    0.63 ( 0.09, 0.62)    0.00 (-0.00,-0.00)    0.00    Y

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

   Average Residuals:         0.628554   0.000000  100.00%
   Maximum Residuals:         0.628554   0.000000  100.00%
   RMS Residuals:             0.444455   0.000000  100.00%

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

   Average Residual Ratios:   0.638774   0.000000  100.00%
   Maximum Residual Ratios:   0.638774   0.000000  100.00%
   RMS Ratios:                0.451682   0.000000  100.00%

# wcs_match (CIAO 4.13): WARNING: Dup src x_err or ra_err cols not found.  Assuming x_err = 1.
# wcs_match (CIAO 4.13): WARNING: Dup src y_err or dec_err cols not found.  Assuming y_err = 1.
# wcs_match (CIAO 4.13): WARNING: Ref src x_err or ra_err cols not found.  Assuming x_err = 1.
# wcs_match (CIAO 4.13): 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.18833588411599        -1.2635904550

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.3049873,4098.015509

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.287
-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.03098457793430    -0.03061652572524

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.2,4097.4,15) # color=red" \
  merge_fac/20056_broad_thresh.img -pan to 12:26:51.287 -33:16:13.18 fk5 \
  -region command "circle(4076.2,4097.4,15) # color=cyan" \
  merge_fac/broad_thresh.img -pan to 12:26:51.287 -33:16:13.18 fk5 \
  -region command "circle(4076.2,4097.4,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.2134571,4097.3712297

unix% punlearn dmcoords
unix% dmcoords merge_fac/broad_thresh.img op=sky x=4076.2134571 y=4097.3712297 celfmt=hms v=0
unix% pget dmcoords ra dec
12:26:51.287
-33:16:13.16

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.2215537631      4097.3861844420         1.6945724626

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=no 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.0072,0.00794)            
  NumObi=2                    Mod.Flux       7.51E-14 erg/cm2/s (7.15E-14,7.88E-14)  
                              Unabs Mod.Flux 8.24E-14 erg/cm2/s (7.84E-14,8.64E-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 [New]regphystocel tool. We can use the centroid we obtained from the merged data set, 4076.2215537631,4097.3861844420 to create ds9 format region files for the source region

unix% regphystocel in="circle(4076.2215537631,4097.3861844420,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.2870,-33:16:13.1599,2.46") #  

and background

unix% regphystocel in="annulus(4076.2215537631,4097.3861844420,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.2870,-33:16:13.1599,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=no clobber=yes conf=0.68 psfmethod=arfcorr \
  mode=h clob+

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

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 = /tmp
     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_0002_broad_rates.par
Running aprates for sf_many/out_obi001_0003_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
Making response files for sf_many/out_obi001_0005
Running modeflux for region 3
Running modeflux for region 4
Using GAL=0.5777 for source 3
Using GAL=0.5746 for source 4
Running modeflux for region 2
Using GAL=0.5748 for source 2
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 7
Using GAL=0.5746 for source 7
Running modeflux for region 8
Using GAL=0.575 for source 8
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 5
Using GAL=0.5727 for source 5
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 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 1
Using GAL=0.5765 for source 1
Running modeflux for region 3
Using GAL=0.5777 for source 3
Making response files for sf_many/out_obi002_0005
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_obi002_0006
Making response files for sf_many/out_obi002_0007
Making response files for sf_many/out_obi002_0008
Running modeflux for region 6
Using GAL=0.5742 for source 6
Running modeflux for region 8
Using GAL=0.575 for source 8
Running modeflux for region 7
Using GAL=0.5746 for source 7
Making response files for sf_many/out_obi002_0009
Making response files for sf_many/out_obi002_0010
Running modeflux for region 5
Using GAL=0.5727 for source 5
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 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
Making response files for sf_many/out_obi003_0005
Running modeflux for region 4
Using GAL=0.5746 for source 4
Making response files for sf_many/out_obi003_0006
Making response files for sf_many/out_obi003_0007
Making response files for sf_many/out_obi003_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 6
Using GAL=0.5742 for source 6
Making response files for sf_many/out_obi003_0009
Making response files for sf_many/out_obi003_0010
Running modeflux for region 5
Using GAL=0.5727 for source 5
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 004
Extracting counts
Making PSF models 
Getting PSF fraction by running arfcorr 1
Getting PSF fraction by running arfcorr 2
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_0002_broad_rates.par
Running aprates for sf_many/out_obi004_0003_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 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_obi004_0005
Making response files for sf_many/out_obi004_0006
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
Using GAL=0.5742 for source 6
Making response files for sf_many/out_obi004_0009
Making response files for sf_many/out_obi004_0010
Running modeflux for region 5
Using GAL=0.5727 for source 5
Running modeflux for region 8
Using GAL=0.575 for source 8
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.81E-14 erg/cm2/s (1.48E-14,2.18E-14)  
                              Mod.Flux       2.75E-14 erg/cm2/s (2.25E-14,3.31E-14)  
                              Unabs Mod.Flux 4.56E-14 erg/cm2/s (3.74E-14,5.49E-14)  

#0002|5 36 13.97 +34 4 54.7   Rate           0.000294 c/s (0.000168,0.000464)        
                              Flux           9.2E-15 erg/cm2/s (5.26E-15,1.45E-14)   
                              Mod.Flux       4.92E-15 erg/cm2/s (2.81E-15,7.75E-15)  
                              Unabs Mod.Flux 8.14E-15 erg/cm2/s (4.65E-15,1.28E-14)  

#0003|5 35 57.71 +34 5 0.2    Rate           0.00224 c/s (0.00187,0.00265)           
                              Flux           3.91E-14 erg/cm2/s (3.27E-14,4.62E-14)  
                              Mod.Flux       3.33E-14 erg/cm2/s (2.78E-14,3.93E-14)  
                              Unabs Mod.Flux 5.52E-14 erg/cm2/s (4.62E-14,6.52E-14)  

#0004|5 36 17.98 +34 5 38.7   Rate           0.000995 c/s (0.000766,0.00126)         
                              Flux           1.07E-14 erg/cm2/s (8.26E-15,1.36E-14)  
                              Mod.Flux       1.52E-14 erg/cm2/s (1.17E-14,1.93E-14)  
                              Unabs Mod.Flux 2.53E-14 erg/cm2/s (1.95E-14,3.2E-14)   

#0005|5 36 33.39 +34 6 5.1    Rate           0.000573 c/s (0.000398,0.000794)        
                              Flux           5.6E-15 erg/cm2/s (3.89E-15,7.76E-15)   
                              Mod.Flux       2.59E-14 erg/cm2/s (1.8E-14,3.59E-14)   
                              Unabs Mod.Flux 4.29E-14 erg/cm2/s (2.98E-14,5.94E-14)  

#0006|5 36 22.80 +34 6 7.3    Rate           5.78E-05 c/s (1.05E-05,0.000154)        
                              Flux           6.69E-16 erg/cm2/s (1.22E-16,1.78E-15)  
                              Mod.Flux       8.31E-16 erg/cm2/s (1.51E-16,2.21E-15)  
                              Unabs Mod.Flux 1.38E-15 erg/cm2/s (2.5E-16,3.66E-15)   

#0007|5 36 20.05 +34 6 11.6   Rate           0.000563 c/s (0.000396,0.000773)        
                              Flux           5.6E-15 erg/cm2/s (3.94E-15,7.69E-15)   
                              Mod.Flux       8.29E-15 erg/cm2/s (5.83E-15,1.14E-14)  
                              Unabs Mod.Flux 1.37E-14 erg/cm2/s (9.66E-15,1.88E-14)  

#0008|5 36 17.87 +34 6 31.8   Rate           0.00115 c/s (0.000899,0.00144)          
                              Flux           1.1E-14 erg/cm2/s (8.63E-15,1.38E-14)   
                              Mod.Flux       1.73E-14 erg/cm2/s (1.36E-14,2.17E-14)  
                              Unabs Mod.Flux 2.87E-14 erg/cm2/s (2.25E-14,3.6E-14)   

#0009|5 36 40.84 +34 10 14.1  Rate           0.00323 c/s (0.00276,0.00369)           
                              Flux           6.74E-15 erg/cm2/s (5.77E-15,7.71E-15)  
                              Mod.Flux       5.01E-14 erg/cm2/s (4.29E-14,5.74E-14)  
                              Unabs Mod.Flux 8.3E-14 erg/cm2/s (7.11E-14,9.5E-14)    

#0010|5 36 11.47 +34 10 37.4  Rate           0.00133 c/s (0.00106,0.00164)           
                              Flux           1.78E-14 erg/cm2/s (1.43E-14,2.2E-14)   
                              Mod.Flux       2.01E-14 erg/cm2/s (1.61E-14,2.48E-14)  
                              Unabs Mod.Flux 3.34E-14 erg/cm2/s (2.67E-14,4.12E-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.53E-14 erg/cm2/s (2.98E-14,4.13E-14)  
                              Mod.Flux       3.08E-14 erg/cm2/s (2.6E-14,3.6E-14)    
                              Unabs Mod.Flux 5.1E-14 erg/cm2/s (4.31E-14,5.97E-14)   

#0002|5 36 13.97 +34 4 54.7   Rate           0.00272 c/s (0.00235,0.00311)           
                              Flux           4.14E-14 erg/cm2/s (3.57E-14,4.72E-14)  
                              Mod.Flux       4.54E-14 erg/cm2/s (3.91E-14,5.17E-14)  
                              Unabs Mod.Flux 7.52E-14 erg/cm2/s (6.48E-14,8.57E-14)  

#0003|5 35 57.71 +34 5 0.2    Rate           0.00215 c/s (0.00182,0.00251)           
                              Flux           4.73E-14 erg/cm2/s (4.02E-14,5.53E-14)  
                              Mod.Flux       3.19E-14 erg/cm2/s (2.71E-14,3.72E-14)  
                              Unabs Mod.Flux 5.29E-14 erg/cm2/s (4.49E-14,6.18E-14)  

#0004|5 36 17.98 +34 5 38.7   Rate           0.0037 c/s (0.00326,0.00414)            
                              Flux           4.91E-14 erg/cm2/s (4.33E-14,5.5E-14)   
                              Mod.Flux       5.68E-14 erg/cm2/s (5.01E-14,6.36E-14)  
                              Unabs Mod.Flux 9.41E-14 erg/cm2/s (8.3E-14,1.05E-13)   

#0005|5 36 33.39 +34 6 5.1    Rate           0.00137 c/s (0.00111,0.00166)           
                              Flux           1.77E-14 erg/cm2/s (1.44E-14,2.15E-14)  
                              Mod.Flux       6.41E-14 erg/cm2/s (5.21E-14,7.77E-14)  
                              Unabs Mod.Flux 1.06E-13 erg/cm2/s (8.62E-14,1.29E-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.37E-15 erg/cm2/s (4.86E-16,2.8E-15)   
                              Unabs Mod.Flux 2.27E-15 erg/cm2/s (8.04E-16,4.64E-15)  

#0007|5 36 20.05 +34 6 11.6   Rate           0.000575 c/s (0.000413,0.000771)        
                              Flux           8.78E-15 erg/cm2/s (6.31E-15,1.18E-14)  
                              Mod.Flux       8.59E-15 erg/cm2/s (6.17E-15,1.15E-14)  
                              Unabs Mod.Flux 1.42E-14 erg/cm2/s (1.02E-14,1.91E-14)  

#0008|5 36 17.87 +34 6 31.8   Rate           0.00371 c/s (0.00327,0.00416)           
                              Flux           4.89E-14 erg/cm2/s (4.31E-14,5.48E-14)  
                              Mod.Flux       5.63E-14 erg/cm2/s (4.96E-14,6.3E-14)   
                              Unabs Mod.Flux 9.32E-14 erg/cm2/s (8.21E-14,1.04E-13)  

#0009|5 36 40.84 +34 10 14.1  Rate           0.00364 c/s (0.00319,0.00409)           
                              Flux           5.18E-14 erg/cm2/s (4.55E-14,5.82E-14)  
                              Mod.Flux       5.65E-14 erg/cm2/s (4.96E-14,6.35E-14)  
                              Unabs Mod.Flux 9.35E-14 erg/cm2/s (8.21E-14,1.05E-13)  

#0010|5 36 11.47 +34 10 37.4  Rate           0.000891 c/s (0.000691,0.00113)         
                              Flux           8.6E-15 erg/cm2/s (6.66E-15,1.09E-14)   
                              Mod.Flux       1.35E-14 erg/cm2/s (1.05E-14,1.71E-14)  
                              Unabs Mod.Flux 2.24E-14 erg/cm2/s (1.73E-14,2.83E-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.19E-14 erg/cm2/s (2.69E-14,3.75E-14)  
                              Mod.Flux       4.43E-14 erg/cm2/s (3.73E-14,5.2E-14)   
                              Unabs Mod.Flux 7.34E-14 erg/cm2/s (6.18E-14,8.62E-14)  

#0002|5 36 13.97 +34 4 54.7   Rate           0.000836 c/s (0.0006,0.00113)           
                              Flux           9.24E-15 erg/cm2/s (6.63E-15,1.25E-14)  
                              Mod.Flux       1.44E-14 erg/cm2/s (1.03E-14,1.94E-14)  
                              Unabs Mod.Flux 2.39E-14 erg/cm2/s (1.71E-14,3.22E-14)  

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

                              Mod.Flux       4.24E-14 erg/cm2/s (3.57E-14,4.99E-14)  
                              Unabs Mod.Flux 7.04E-14 erg/cm2/s (5.92E-14,8.28E-14)  

#0004|5 36 17.98 +34 5 38.7   Rate           0.000772 c/s (0.000545,0.00105)         
                              Flux           2.98E-15 erg/cm2/s (2.1E-15,4.05E-15)   
                              Mod.Flux       1.18E-14 erg/cm2/s (8.32E-15,1.6E-14)   
                              Unabs Mod.Flux 1.95E-14 erg/cm2/s (1.38E-14,2.66E-14)  

#0005|5 36 33.39 +34 6 5.1    Rate           0.00122 c/s (0.000933,0.00156)          
                              Flux           1.36E-14 erg/cm2/s (1.04E-14,1.74E-14)  
                              Mod.Flux       5.84E-14 erg/cm2/s (4.46E-14,7.47E-14)  
                              Unabs Mod.Flux 9.66E-14 erg/cm2/s (7.37E-14,1.24E-13)  

#0006|5 36 22.80 +34 6 7.3    Rate           0.000227 c/s (0.000114,0.000392)        
                              Flux           1.94E-15 erg/cm2/s (9.74E-16,3.35E-15)  
                              Mod.Flux       3.26E-15 erg/cm2/s (1.64E-15,5.64E-15)  
                              Unabs Mod.Flux 5.4E-15 erg/cm2/s (2.72E-15,9.33E-15)   

#0007|5 36 20.05 +34 6 11.6   Rate           0.00866 c/s (0.00783,0.00949)           
                              Flux           1.19E-13 erg/cm2/s (1.08E-13,1.31E-13)  
                              Mod.Flux       1.26E-13 erg/cm2/s (1.14E-13,1.38E-13)  
                              Unabs Mod.Flux 2.08E-13 erg/cm2/s (1.88E-13,2.28E-13)  

#0008|5 36 17.87 +34 6 31.8   Rate           0.00075 c/s (0.000537,0.00101)          
                              Flux           1.27E-14 erg/cm2/s (9.08E-15,1.71E-14)  
                              Mod.Flux       1.13E-14 erg/cm2/s (8.09E-15,1.53E-14)  
                              Unabs Mod.Flux 1.87E-14 erg/cm2/s (1.34E-14,2.53E-14)  

#0009|5 36 40.84 +34 10 14.1  Rate           0.00373 c/s (0.00318,0.00429)           
                              Flux           4.72E-14 erg/cm2/s (4.03E-14,5.42E-14)  
                              Mod.Flux       5.8E-14 erg/cm2/s (4.94E-14,6.66E-14)   
                              Unabs Mod.Flux 9.6E-14 erg/cm2/s (8.19E-14,1.1E-13)    

#0010|5 36 11.47 +34 10 37.4  Rate           0.00107 c/s (0.00081,0.00138)           
                              Flux           1.2E-14 erg/cm2/s (9.12E-15,1.55E-14)   
                              Mod.Flux       1.62E-14 erg/cm2/s (1.23E-14,2.09E-14)  
                              Unabs Mod.Flux 2.69E-14 erg/cm2/s (2.04E-14,3.47E-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.61E-14 erg/cm2/s (1.15E-14,2.17E-14)  
                              Unabs Mod.Flux 2.66E-14 erg/cm2/s (1.9E-14,3.6E-14)    

#0002|5 36 13.97 +34 4 54.7   Rate           0.000182 c/s (6.98E-05,0.000363)        
                              Flux           1.86E-15 erg/cm2/s (7.16E-16,3.72E-15)  
                              Mod.Flux       3.06E-15 erg/cm2/s (1.18E-15,6.11E-15)  
                              Unabs Mod.Flux 5.06E-15 erg/cm2/s (1.95E-15,1.01E-14)  

#0003|5 35 57.71 +34 5 0.2    Rate           0.00302 c/s (0.00251,0.0036)            
                              Flux           5.61E-14 erg/cm2/s (4.66E-14,6.68E-14)  
                              Mod.Flux       4.49E-14 erg/cm2/s (3.73E-14,5.34E-14)  
                              Unabs Mod.Flux 7.44E-14 erg/cm2/s (6.18E-14,8.86E-14)  

#0004|5 36 17.98 +34 5 38.7   Rate           0.000372 c/s (0.000204,0.000605)        
                              Flux           7.14E-15 erg/cm2/s (3.91E-15,1.16E-14)  
                              Mod.Flux       5.67E-15 erg/cm2/s (3.1E-15,9.22E-15)   
                              Unabs Mod.Flux 9.39E-15 erg/cm2/s (5.14E-15,1.53E-14)  

#0005|5 36 33.39 +34 6 5.1    Rate           0.00143 c/s (0.00109,0.00183)           
                              Flux           3.16E-15 erg/cm2/s (2.41E-15,4.06E-15)  
                              Mod.Flux       5.63E-14 erg/cm2/s (4.29E-14,7.23E-14)  
                              Unabs Mod.Flux 9.31E-14 erg/cm2/s (7.1E-14,1.2E-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.09E-13,1.36E-13)  
                              Mod.Flux       1.18E-13 erg/cm2/s (1.05E-13,1.31E-13)  
                              Unabs Mod.Flux 1.95E-13 erg/cm2/s (1.74E-13,2.17E-13)  

#0007|5 36 20.05 +34 6 11.6   Rate           0.000255 c/s (0.000132,0.000442)        
                              Flux           7.46E-15 erg/cm2/s (3.85E-15,1.29E-14)  
                              Mod.Flux       4.11E-15 erg/cm2/s (2.12E-15,7.13E-15)  
                              Unabs Mod.Flux 6.81E-15 erg/cm2/s (3.52E-15,1.18E-14)  

#0008|5 36 17.87 +34 6 31.8   Rate           0.00109 c/s (0.000803,0.00143)          
                              Flux           1.3E-14 erg/cm2/s (9.6E-15,1.71E-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           6.03E-14 erg/cm2/s (5.11E-14,6.95E-14)  
                              Mod.Flux       6.59E-14 erg/cm2/s (5.59E-14,7.61E-14)  
                              Unabs Mod.Flux 1.09E-13 erg/cm2/s (9.26E-14,1.26E-13)  

#0010|5 36 11.47 +34 10 37.4  Rate           0.00115 c/s (0.000844,0.00152)          
                              Flux           1.03E-14 erg/cm2/s (7.56E-15,1.36E-14)  
                              Mod.Flux       1.76E-14 erg/cm2/s (1.29E-14,2.32E-14)  
                              Unabs Mod.Flux 2.92E-14 erg/cm2/s (2.14E-14,3.85E-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.04E-14 erg/cm2/s (2.76E-14,3.33E-14)  
                              Unabs Mod.Flux 5.04E-14 erg/cm2/s (4.57E-14,5.52E-14)  

#0002|5 36 13.97 +34 4 54.7   Rate           0.0012 c/s (0.00106,0.00135)            
  NumObi=4                    Mod.Flux       2.02E-14 erg/cm2/s (1.78E-14,2.27E-14)  
                              Unabs Mod.Flux 3.35E-14 erg/cm2/s (2.94E-14,3.76E-14)  

#0003|5 35 57.71 +34 5 0.2    Rate           0.00249 c/s (0.00228,0.0027)            
  NumObi=4                    Mod.Flux       3.7E-14 erg/cm2/s (3.39E-14,4.01E-14)   
                              Unabs Mod.Flux 6.14E-14 erg/cm2/s (5.62E-14,6.66E-14)  

#0004|5 36 17.98 +34 5 38.7   Rate           0.00174 c/s (0.00157,0.00191)           
  NumObi=4                    Mod.Flux       2.66E-14 erg/cm2/s (2.4E-14,2.93E-14)   
                              Unabs Mod.Flux 4.41E-14 erg/cm2/s (3.97E-14,4.85E-14)  

#0005|5 36 33.39 +34 6 5.1    Rate           0.00114 c/s (0.000998,0.00128)          
  NumObi=4                    Mod.Flux       5.13E-14 erg/cm2/s (4.49E-14,5.77E-14)  
                              Unabs Mod.Flux 8.49E-14 erg/cm2/s (7.43E-14,9.55E-14)  

#0006|5 36 22.80 +34 6 7.3    Rate           0.00156 c/s (0.0014,0.00173)            
  NumObi=4                    Mod.Flux       2.25E-14 erg/cm2/s (2.01E-14,2.49E-14)  
                              Unabs Mod.Flux 3.72E-14 erg/cm2/s (3.33E-14,4.12E-14)  

#0007|5 36 20.05 +34 6 11.6   Rate           0.00231 c/s (0.00211,0.00251)           
  NumObi=4                    Mod.Flux       3.46E-14 erg/cm2/s (3.16E-14,3.76E-14)  
                              Unabs Mod.Flux 5.72E-14 erg/cm2/s (5.23E-14,6.22E-14)  


#0008|5 36 17.87 +34 6 31.8   Rate           0.00192 c/s (0.00174,0.0021)            
  NumObi=4                    Mod.Flux       2.9E-14 erg/cm2/s (2.63E-14,3.18E-14)   
                              Unabs Mod.Flux 4.81E-14 erg/cm2/s (4.35E-14,5.27E-14)  

#0009|5 36 40.84 +34 10 14.1  Rate           0.00366 c/s (0.0034,0.00392)            
  NumObi=4                    Mod.Flux       5.68E-14 erg/cm2/s (5.29E-14,6.08E-14)  
                              Unabs Mod.Flux 9.41E-14 erg/cm2/s (8.75E-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.69E-14 erg/cm2/s (1.48E-14,1.91E-14)  
                              Unabs Mod.Flux 2.81E-14 erg/cm2/s (2.46E-14,3.16E-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.

[New] 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=no 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.