Calculate the Flux for a Position
![[CXC Logo]](../../imgs/cxc-logo.gif)
CIAO 4.2 Science Threads
Overview
Last Update: 9 Mar 2010 - added a link to the Chandra Source Catalog, which contains reference fluxes for many sources
Synopsis:
The tool eff2evt calculates the energy flux in ergs/cm**2/sec for each input event, taking the quantum efficiency (QE) and effective area (EA) into account. The QE, EA, and flux values are recorded in new columns in the output file.
Read this thread if:
you wish to calculate the energy flux for an ACIS or HRC imaging observation.
eff2evt is not appropriate for grating data, not even zeroth orders. There are two primary reasons: it does not include grating efficiencies, and the off-axis position for diffracted events does not correspond the the event position but to the zeroth order position, so the vignetting correction will be wrong.
Related Links:
-
The Chandra Source Catalog (CSC) - reference fluxes for most sources are available from the CSC with no analysis required. Note that the fluxes in the CSC are calculated for specific models (absorbed power law and blackbody) and with certain assumptions about conversion from counts to flux.
Contents
- Get Started
- About the Energy Flux Calculation
- ACIS Data
- HRC Data
- Examining the Output
- History
- Images
Get Started
Sample ObsIDs used: 315 (ACIS-S, NGC 4038/39); 990 (HRC-S, VEGA)
File types needed: evt2; pbk0 (ACIS only
About the Energy Flux Calculation
The energy flux is calculated as:
FLUX_E = (ENERGY / (QE*EA*LIVETIME)) * (eV/erg)
where ENERGY is either a column in the input file (ACIS only) or the supplied monochromatic energy (ACIS or HRC). Remember that the ENERGY column is the scaled, gain-adjusted pulse height channel and represents an estimate of the mean energy of photons in that channel. The conversion factor from eV to erg is 1.60217646e-12.
ACIS Data
Filter the events (optional)
Apply any desired filters to the file before running eff2evt. For this example, only ccd_id=7 (ACIS-S3) is used and an energy range filter is applied:
unix% dmcopy "acisf00315N004_evt2.fits[energy=300:7000][ccd_id=7]" acis_315_filt7.fits
Run eff2evt to calculate the energy flux
For ACIS data, the input event file is required to run eff2evt. The parameter block file (pbk0.fits) is also necessary in order to apply the ACIS dead area correction.
The value of the energy parameter controls at what energy the QE and EA are determined. This may be set to a monochromatic value. Most users, however, will want to leave it at the default of "INDEF", which tells eff2evt to use the ENERGY column in the input file to do the lookup for each event.
unix% punlearn eff2evt unix% eff2evt acis_315_filt7.fits acis_315_flux7.fits
The output file, acis_315_flux7.fits, is a copy of the input file with three additional columns: QE, EA, and FLUX.
unix% dmlist acis_315_flux7.fits cols -------------------------------------------------------------------------------- Columns for Table Block EVENTS -------------------------------------------------------------------------------- ColNo Name Unit Type Range 1 time s Real8 60413209.3138310015: 60489714.2915970013 S/C TT corresponding to mid-exposure 2 ccd_id Int2 0:9 CCD reporting event 3 node_id Int2 0:3 CCD serial readout amplifier node 4 expno Int4 0:2147483647 Exposure number of CCD frame containing event 5 chip(chipx,chipy) pixel Int2 1:1024 Chip coords 6 tdet(tdetx,tdety) pixel Int2 1:8192 ACIS tiled detector coordinates 7 det(detx,dety) pixel Real4 0.50: 8192.50 ACIS detector coordinates 8 sky(x,y) pixel Real4 0.50: 8192.50 sky coordinates 9 pha adu Int4 0:36855 total pulse height of event 10 energy eV Real4 0: 1000000.0 nominal energy of event (eV) 11 pi chan Int4 1:1024 pulse invariant energy of event 12 fltgrade Int2 0:255 event grade, flight system 13 grade Int2 0:7 binned event grade 14 status[4] Bit(4) event status bits 15 QE Real4 -Inf:+Inf Detector QE/U 16 EA cm**2 Real4 -Inf:+Inf Mirror Effective Area 17 FLUX ergs/cm**2/s Real4 -Inf:+Inf Photon flux ...
Calculate the photon flux
Since the QE and EA values are recorded in the output file, is it easy to calculate the photon flux, 1/(QE*EA), as well. The photon flux is defined as:
FLUX_P = 1 / (QE*EA*LIVETIME)
Note that this is not the same as calculating a monchromatic energy flux at 1keV, because each QE and EA value was initially determined by the energy of the corresponding event in the input file.
The tool dmtcalc is used to perform the calculation; the resulting values are stored in the column PFLUX in the output file:
unix% punlearn dmtcalc unix% dmtcalc acis_315_flux7.fits acis_315_pflux7.fits \ expression="pflux=1/(QE*EA*LIVETIME)" unix% dmlist "acis_315_pflux7.fits[cols pflux]" data -------------------------------------------------------------------------------- Data for Table Block EVENTS -------------------------------------------------------------------------------- ROW PFLUX 1 3.737815282E-08 2 2.225658432E-08 3 3.078288008E-08 4 2.272293015E-08 5 1.198178595E-07 6 5.069504739E-08 7 2.019754315E-08 8 1.103981368E-07 ...
HRC Data
Run eff2evt to calculate the energy flux
When running eff2evt on HRC data, it is necessary to set the value of the energy parameter. This parameter controls at what energy the QE and EA are determined. Since energy is not explicitly resolved in HRC observations, the energy is determined at the discretion of the observer; this thread uses a value of 1.1 keV.
unix% punlearn eff2evt unix% eff2evt hrcf00990N004_evt2.fits hrc_990_flux.fits energy=1.1
The output file, hrc_990_flux.fits, is a copy of the input file with three additional columns: QE, EA, and FLUX.
unix% dmlist hrc_990_flux.fits cols -------------------------------------------------------------------------------- Columns for Table Block EVENTS -------------------------------------------------------------------------------- ColNo Name Unit Type Range 1 time s Real8 97387353.0922120064: 97390363.0048280060 Time tag (TT) 2 chip(chipx,chipy) pixel Int2 1:4096 Chip coords 3 tdet(tdetx,tdety) pixel Int4 1:4096 Tdet coords 4 det(detx,dety) pixel Real4 0.50: 65536.50 Det coords 5 sky(x,y) pixel Real4 0.50: 65536.50 Sky coords 6 pha chan Int2 0:255 Pulse height 7 pi chan Int2 0:255 Pulse Invariant 8 chip_id Int2 1:3 Chip ID 9 status[4] Bit(4) Event status bits 10 QE Real4 -Inf:+Inf Detector QE/U 11 EA cm**2 Real4 -Inf:+Inf Mirror Effective Area 12 FLUX ergs/cm**2/s Real4 -Inf:+Inf Photon flux ...
Calculate the photon flux
Since the QE and EA values are recorded in the output file, is it easy to calculate the photon flux, 1/(QE*EA), as well. The photon flux is defined as:
FLUX_P = 1 / (QE*EA*LIVETIME)
The tool dmtcalc is used to perform the calculation; the resulting values are stored in the column PFLUX in the output file:
unix% punlearn dmtcalc unix% dmtcalc hrc_990_flux.fits hrc_990_pflux.fits \ expression="pflux=1/(QE*EA*LIVETIME)" unix% dmlist "hrc_990_pflux.fits[cols pflux]" data -------------------------------------------------------------------------------- Data for Table Block EVENTS -------------------------------------------------------------------------------- ROW PFLUX 1 3.737815282E-08 2 2.225658432E-08 3 3.078288008E-08 4 2.272293015E-08 5 1.198178595E-07 6 5.069504739E-08 7 2.019754315E-08 8 1.103981368E-07 ...
Examining the Output
These methods of examining the output are independent of the instrument used (ACIS or HRC).
Sum the flux in a region
Adding the flux values withing a source or background region results in the total flux for that region. This is easy to do with dmstat since the flux is stored as a column in the event file.
Here the region circle(4191.5,3857.5,158.74268) is used; it is displayed on the data in Figure 1.
![[Thumbnail image: The ACIS data displayed in ds9 with a circular region defined]](acisregion.thumb.jpg)
[Version: full-size]
![[Print media version: The ACIS data displayed in ds9 with a circular region defined]](acisregion.jpg)
Figure 1: Region for summing flux
The region circle(4191.5,3857.5,158.74268) is displayed on the data. The flux values calculated by eff2evt within this circle will be summed.
unix% dmstat "acis_315_flux7.fits[sky=circle(4191.5,3857.5,158.74268)][cols flux]" FLUX[ergs/cm**2/s] min: 3.0252797489e-17 @: 458 max: 1.6356456086e-15 @: 8219 mean: 8.4070953456e-17 sigma: 1.5016215301e-16 sum: 2.5676950605e-12 good: 30542 null: 0
The total flux within the region - "sum" - is 2.568e-12 ergs/cm**2/s.
All the output values are stored in the dmstat parameter file, dmstat.par. The tool can be run with verbose=0 and any value obtained with pget, e.g. as part of a script:
unix% dmstat "acis_315_flux7.fits[sky=circle(4191.5,3857.5,158.74268)][cols flux]" \ verbose=0 unix% pget dmstat out_sum 2.5676950605e-12 unix% pget dmstat out_max 1.6356456086e-15
Create an image of the flux
The Data Model has the ability to weight the binning of a file by any column. Weighting by the flux column creates an image where the pixel values are the energy flux per pixel.
The region from the previous example, circle(4191.5,3857.5,158.74268), is used in binning the image.
unix% dmcopy "acis_315_flux7.fits[sky=circle(4191.5,3857.5,158.74268)][bin x,y;flux]" acis_315_flux7.img
The output image, acis_315_flux7.img, is displayed in Figure 2.
![[An image of the ACIS data filtered by a circular region where the values are the energy flux per pixel]](acisflux.png)
![[Print media version: An image of the ACIS data filtered by a circular region where the values are the energy flux per pixel]](acisflux.png)
Figure 2: Image of the data weighted by flux
A region-filtered image of the ACIS data, weighted by the flux column. The pixel values are the energy flux per pixel.
The tool dmstat may be used to calculate statistics of the image:
unix% dmstat acis_315_flux7.img cen- EVENTS_IMAGE min: 0 @: ( 4179.25732 3699.25732 ) max: 4.5951489955e-14 @: ( 4228.25732 3959.25732 ) mean: 3.2411136857e-17 sigma: 3.5663864319e-16 sum: 2.5655035379e-12 good: 79155 null: 21969
All the output values are stored in the dmstat parameter file, dmstat.par. The tool can be run with verbose=0 and any value obtained with pget, e.g. as part of a script:
unix% dmstat acis_315_flux7.img cen- verbose=0 unix% pget dmstat out_sum 2.5655035379e-12 unix% pget dmstat out_max 4.5951489955e-14
History
15 Dec 2008 | New for CIAO 4.1 |
30 Mar 2009 | added "Read this thread if" section to Synopsis: eff2evt is not appropriate for grating data, not even zeroth orders |
05 Feb 2010 | updated for CIAO 4.2: ObsID 315 file version; included the parameter block filename in the ACIS eff2evt run to apply the ACIS dead area correction; corresponding changes to output |
09 Mar 2010 | added a link to the Chandra Source Catalog, which contains reference fluxes for many sources |