Thursday, August 21, 2008

calculating fluxes and errors

Prompted by a question from Jeremy Sanders I have developed a new way of calculating fluxes and errors for models and parts of models. The trick is to provide a new convolution model called cflux whose first two parameters are the minimum and maximum energy over which the flux is calculated. The final parameter is the flux. The component is placed in front of the model component(s) whose flux is being calculated and one of the additive components has its normalization frozen. The standard fit and error command on the flux parameter will then provide the best fit flux and confidence region. This model is available through the extra models web page.


vzabalza said...

Dear Keith,

I have tried the new model but couldn't get it to work. I placed both files (cflux.cxx and cflux_lmodel.dat) in the LOCAL_MODEL_DIRECTORY and from Xspec v12 I issued the commands:

> initpackage cflux cflux.cxx
> lmod cflux

However, the cflux convolution model is not recognised by the model command. During the initpackage phase, aside from all the compilation messages, I could see:

Gathering information from model initialization file: /home/gamma/folre/vzabalza/bin/HEADAS/LMOD/cflux.cxx...

... done
0 Additive models
0 Multiplicative models
0 Convolution models
0 Mixing models
0 Pile-up models found altogether.

Am I doing something wrong??



vzabalza said...

I believe I have solved the problem by myself. the initpakage command should have been "initpackage cflux cflux_lmodel.dat". However, when using that I had the error:

"Error: package name cannot be identical to the name of a model function (cflux)... exiting"

And using a different package name resulted in a compilation error (I can send the log if necessary). To resolve the problem I had to change the name of the function called to something other than "cflux" on both files (cflux_lmodel.dat and cflux.cxx). Now everything works as explected.

By the way, this is a *very* useful model component! Thanks

maurizioplll said...

Hi, I'm new to intalling custom models in Xspec, and I'm trying to run cflux. Could you be more specific on what part of the code you had to change to make this work?

Keith Arnaud said...


If you have a recent version of xspec, cflux is included as a standard model.