Jump to Content
Version 1.6.2-40  

Fitting CCD Data


Here's a simple example of fitting a single CCD spectrum with an XSPEC model:

        % First, load the data, responses
        % and a background spectrum.

    load_dataset ("data.pi", "rmf.fits", "arf.fits");
    () = define_back (1, "bgd.pi");

        % ISIS supports several alternatives
        % for rebinning data.
        % Here we group by an integer factor:


        % Import the XSPEC module, and
        % initialize the model

    fit_fun ("phabs(1) * mekal(1)");

        % There are several ways to specify the parameters
        % This way is clear and human-readable:

    set_par ("phabs(1).nH", 0.05);
    set_par ("mekal(1).kT", 10.0);
    set_par ("mekal(1).Abundanc", 0.2);
    set_par ("mekal(1).Redshift", 0.2256);

        % Notice the energy range 0.5-7.0 keV in dataset 1,
        % and ignore the rest of the spectrum:

    xnotice_en (1, 0.5, 7.0);

        % Do the fit....

    () = renorm_counts;
    () = fit_counts();

        % .. and generate a plot.

    variable pid = plot_open ("ex_ccd.ps/cps");

    rplot_counts (1);

    plot_close (pid);
Note that, rather than subtracting the background from the data, the model includes the background. This presentation is different from the standard XSPEC treatment.

Made with JED  |  Best Viewed with a Browser  |  Valid HTML 4.01  |  Valid CSS ]
This page is maintained by John C. Houck.   Last updated: Aug 9, 2017