
    % 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:

group_data(1,8);    
     
    % Import the XSPEC module, and 
    % initialize the model

require("xspec");
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");

ylog;
xrange(0.5,7.0);
errorbars(1);
rplot_counts (1);

plot_close (pid);
