Next: Creating an RMF Up: Determining a Line Previous: Region of Interest

## Profile Fitting

A more sophisticated method of determining the line flux is to fit a functional form to the line and the continuum. This has the advantage of simultaneously determining the line and continuum flux, being able to fit blended lines and being able to determine errors for the fitted parameters.

After loading the spectrum as shown above then to fit the function first ignore all the other spectra.

`isis>ignore([1:9]);`

`isis>ignore([11:12]);`

and then ignore the data outside our selected window.

`isis>xnotice(10,14.99,15.07);`

now we can fit that one line.

We will fit a function that represents the measured line spread function and an estimator for the continuum. The LSF may be represented my a Gaussian for the core and a Lorentzian for the wings and the background will be modeled with a polynomial. We will use the `ifit_fun` of ISIS which allows us to determine the initial parameters using a plot and the mouse.

`isis> ifit_fun("lorentz(1) + gauss(2) + poly(1)");`

now to check that the initial guess is reasonable

`plot_data(10);` `eval_fun;` `oplot_model;`

which will overplot the inital guess on the plotted data. If this does not seem reasonable then we can re-initialize the parameters with the `ifit_fun` or use `edit_par` to change the parameters. Once the inital values are O.K. then we can fit the function

`isis>fit;`

and again check the fit

`plot_data(10);` `oplot_model;`

to check the fit. This results in a model fit to the line seen in figure 3, where the white line is the data and the red line is the fit.

To find the flux in the model,

    isis> (lo, hi, dat, dat_err) = get_data(10);
    isis> (lo, hi, model) = get_model(10);
    isis> limits;
    isis> xrange(14.99,15.07);
    isis> hplot (lo, hi,model);
    isis>print,sum(model);
    0.000113267

Where the units are the units of the model (photons s cm).

To find the flux in the line,

`isis> p = region_sum (10, 14.99, 15.05);`

`isis> p.sum;`

0.000126637

Where again the units are photons s cm.

Next: Creating an RMF Up: Determining a Line Previous: Region of Interest