| AHELP for CIAO 4.5 | modelflux |
Context: tools |
Synopsis
Calculate model flux or count rate
Syntax
modelflux arf rmf model paramvals emin emax [absmodel] [absparams] [oemin] [oemax] [rate] [pflux] [flux] [urate] [upflux] [uflux] [opt]
Description
Convert between absorbed (observed) energy flux, photon flux and count rate for any Sherpa model, given a set of spectral response files. The method assumes the model has an overall linear normalization. The default behaviour is to return absorbed (observed) flux given an input count rate.
An additional, optional absorption model may also be supplied, in which case the corresponding unabsorbed fluxes and count rates are also calculated.
For a given set of model parameters, the base model energy spectrum F(E) is multiplied by the absorption model spectrum A(E) to give the absorbed flux spectrum F'(E) (A=1 if no absorption model is supplied). The total absorbed flux F' is then calculated as the integral over E of F'(E), and the unabsorbed flux F is the integral of F(E). F'(E) is then multiplied by the product of the supplied ARF and RMF and integrated over E (via the emin and emax parameters) and summed over channel (via the oemin and oemax parameters) to yield a predicted total observed count rate R'.
The unabsorbed photon flux spectrum P(E) = (F(E)/E) and its absorbed counterpart P'(E), with integrals P and P', are also calculated from F(E) and F'(E).
The model/params and absmodel/absparams paradigm corresponds to a scenario in which a source of flux F would have given rise to a count rate R, but because an intervening absorber reduces the flux by a factor A to F', a reduced count rate R' is seen. Typically, given an observed R', we wish to find F and A.
When opt=rate, the total rate R' is compared to the supplied count rate to scale the normalization of F and F', and P and P'. When opt=flux, F' is compared to the supplied flux to scale the normalization of the other quantities. When opt=pflux, P' is compared to the supplied pflux to scale the normalization of the other quantities. The results are written to the screen (for verbose > 0) and stored in the corresponding parameters.
Example 1
modelflux arf="arf.fits" rmf="rmf.fits" model="xsphabs.abs1*powlaw1d.p1" paramvals="abs1.nh=0.07;p1.gamma=2.26" emin="0.5" emax="7.0"
The default use is to convert from rate to flux. This example calculates the flux of the source in [0.5,7.0] keV corresponding to a count rate of 1 count/second in the same band.
Example 2
modelflux arf="arf.fits" rmf="rmf.fits" model="xsphabs.abs1*powlaw1d.p1" paramvals="abs1.nh=0.07;p1.gamma=2.26;p1.ampl=0.0003" emin="0.5" emax="7.0" rate="0.1"
Here we specify an explicit count rate of 0.1 count/s and calculate the energy flux and photon flux that would generate that count rate, given the model.
Even though we specified an amplitude parameter for the power law, it does not affect the result, since the output is linearly rescaled to match the requested count rate.
Example 3
modelflux arf="arf.fits" rmf="rmf.fits" model="xsphabs.abs1*powlaw1d.p1" paramvals="abs1.nh=0.07;p1.gamma=2.26;p1.ampl=0.0003" emin="0.1" emax="10.0" oemin="0.5" oemax="2.0" rate="0.1"
This example finds out what flux in the energy range 0.1-10 keV would produce a 0.5-2 keV count rate of 0.1 count/s. The emin and emax parameters always specify the energy range for the flux; the oemin and oemax parameters can be used to specify a different energy band for the rate.
Example 4
modelflux arf="arf.fits" rmf="rmf.fits" model="xsphabs.abs1*(powlaw1d.p1+xsgaussian.g)" paramvals="abs1.nh=0.07;p1.gamma=2.26;p1.ampl=0.0003;g.sigma=0.1;g.line= 1.0;g.norm=1.0e-5" emin="0.5" emax="2.0" flux="1.E-12" opt="flux"
This example uses "opt=flux" to tell modelflux we are giving it the flux and want to know the count rate (opt="rate" is the default). Calculates the count rate of the source in [0.5,2.0] keV where a flux of 1E-12 ergs/cm^2/s is observed in the same band. Although the overall normalization is scaled to the requested flux, the relative normalizations of the two components are set using the p1.ampl and g.norm parameters.
Example 5
modelflux arf="arf.fits" rmf="rmf.fits" model="powlaw1d.p1" paramvals="p1.gamma=2.26" absmodel="xsphabs.abs1" absparams="abs1.nh=0.8" emin="0.1" emax="10.0" oemin="0.5" oemax="2.0" rate="0.1" opt=rate
This example is like Example 3 but moves the absorption model to the absmodel parameter so that unabsorbed fluxes may also be calculated.
Example 6
modelflux arf="arf.fits" rmf="rmf.fits" model="powlaw1d.p1" paramvals="p1.gamma=2.26" absmodel="xsphabs.abs1" absparams="abs1.nh=0.8" emin="0.5" emax="7.0" flux="1.e-11" opt=flux
This example illustrates the calculation of absorbed and unabsorbed fluxes and rates given an input observed flux. (Input of unabsorbed flux is not supported).
Parameters
| name | type | ftype | def | reqd |
|---|---|---|---|---|
| arf | file | input | yes | |
| rmf | file | input | yes | |
| model | string | yes | ||
| paramvals | string | yes | ||
| emin | real | INDEF | yes | |
| emax | real | INDEF | yes | |
| absmodel | string | no | ||
| absparams | string | no | ||
| oemin | real | INDEF | no | |
| oemax | real | INDEF | no | |
| rate | real | 1.0 | no | |
| pflux | real | INDEF | no | |
| flux | real | INDEF | no | |
| urate | real | 1.0 | no | |
| upflux | real | INDEF | no | |
| uflux | real | INDEF | no | |
| opt | string | rate | no |
Detailed Parameter Descriptions
Parameter=arf (file required filetype=input)
Ancillary Response File (ARF)
Parameter=rmf (file required filetype=input)
Response File (RMF)
Parameter=model (string required default=)
Sherpa model definition string, e.g. xsphabs.abs1*xspowerlaw.p1
Parameter=paramvals (string required default=)
semicolon-delimited (';') string of (id.parameter=value) pairs, e.g. abs1.nh=0.07;p1.gamma=2.26
Parameter=emin (real required default=INDEF)
Lower bound of flux energy range in keV
Parameter=emax (real required default=INDEF)
Upper bound of flux energy range in keV
Parameter=absmodel (string not required)
Sherpa model definition string for extra absorption, e.g. xsphabs.abs1.
If this parameter is set, the program calculates the absorbed flux using the product of this model and that given in the base model in the 'model' parameter. It then also gives the unabsorbed flux derived by omitting the absmodel but keeping the base model's normalization unchanged.
Parameter=absparams (string not required)
Semicolon-delimited (';') string of (id.parameter=value) pairs, e.g. abs1.nh=0.07 that defines the parameters for the model specified in absmodel.
Parameter=oemin (real not required default=INDEF)
Lower bound of energy range for count rate in keV, default=emin
Parameter=oemax (real not required default=INDEF)
Upper bound of energy range for count rate in keV, default=emin
Parameter=rate (real not required default=1.0)
count rate in counts s^-1
Parameter=pflux (real not required default=INDEF)
photon flux in energy range in photon cm^-2 s^-1
Parameter=flux (real not required default=INDEF)
energy flux in energy range in erg cm^-2 s^-1
Parameter=urate (real not required default=1.0)
unabsorbed count rate in counts s^-1
Parameter=upflux (real not required default=INDEF)
unabsorbed photon flux in energy range in photon cm^-2 s^-1
Parameter=uflux (real not required default=INDEF)
unabsorbed energy flux in energy range in erg cm^-2 s^-1
Parameter=opt (string not required default=rate)
Input type: (rate|flux|pflux), rate->flux,pflux or flux->rate,pflux
This parameter is used to control whether modelflux calculates a rate from the flux or pflux parameters, or vice versa.
Changes in CIAO 4.5
-
A new option to calculate the unabsorbed flux has been added. If the user does choose this new option, then both absorbed and unabsorbed fluxes are calculated and reported to stdout, and written to the modelflux parameter file.
Bugs
There are no known bugs for this tool.
See Also
- tools
- aprates
- utilities
- calc_chisqr, calc_energy_flux, calc_model_sum, calc_photon_flux, calc_source_sum, calc_stat, gamma, igam, igamc, incbet, lgam

![[CIAO Logo]](../imgs/ciao_logo_navbar.gif)