Fake an Observation with ISIS

From Remeis-Wiki
Jump to navigation Jump to search

This little FAQ is taken from an eMail written by Jörn an 2013-02-10:

when faking spectra you will pretty much always have to do two things: a) simulate the spectrum based on a spectral model and including the appropriate background and b) simulate a background only. This is necessary because in most cases in an imaging instrument you will be measuring the background from a region in the observation itself. Usually the background will be taken from a previous longer observation that is available in a PHA file. If you're doing simulations with such a background you need to make sure that the extraction region for the background and the source (BACKSCAL) are identical,. By default, for faked data sets isis assumes BACKSCAL=1, i.e. you need to do a set_back_backscale(bla,1.) to ensure that the proper background countrate is faked (if you do not do this you will underestimate the background by A LOT - factors of 100000 are common...).


variable f_rmf = "src_sd.rmf";
variable f_arf = "src_sd.arf";
variable f_bkg = "back_sd.pha";

% exposure time in seconds
variable expos=100000.;

%%%%% define your spectral model here!!!!!! (fit_fun ...)

% Fake source and background
variable iDat=1;

variable rmf = load_rmf(f_rmf;strict=0);
variable arf = load_arf(f_arf;strict=0);

% assign arf and rms

% set the exposure (in sec)
set_arf_exposure (arf,expos);
set_data_exposure (iDat,expos);
set_fake(iDat,0); % mark as a normal data set

% fake background only
variable iBkg=2;

%%%% set all norms of your spectral model to zero here!!!!

% assing arf and rms

% set the exposure (in sec)
set_arf_exposure (arf,expos);

()=define_back(iBkg, f_bkg);

% assign faked background to the spectrum and ignore it
variable bkgdata=get_data_counts(iBkg);


%%% write your spectrum to file, fit it, or whatever here...