next up previous contents
Next: About this document ... Up: Manual for Cora line Previous: Graph   Contents

Usage with IDL

In addition to the program written in ANSI C an IDL version is delivered. This version is the predecessor of the presented program and is still the preferred working version by the developers. Using the IDL version allows the user to interactively process the fit results (as IDL is the Interactive Data Language). Also, the graphic is more flexible in IDL than in pgplot and better plots can be obtained without much trouble using IDL.

The IDL package contains the main program, a file containing all functions and routines, an include file that defines COMMON blocks and style settings, and a short script customizing the application.

Before using the IDL routines, the include must be 'sourced' and the routines must be compiled:

IDL> .compile fit_procs
IDL> .compile fit_main

For the case that the spectrum was prepared in IDL it can be written into a file with the correct format using the procedure writefile:

IDL> writefile,wave,sp,err,bkgd,bkgderr,fname,exp=exp,eff=eff,/unix
where wave contains the wavelength vector, sp the spectrum, err the errors of the spectrum, bkgd the instrumental background, and bkgderr the errors of the background. All these vectors must have identical dimensions. In addition, the exposure time can be given (exp) and the effective areas (eff). The name of the resulting file, e.g., spectrum.dat, is indicated with the variable fname. If no full IDL version is available the keyword /unix can be used to still write the ASCII with the demo version of IDL. This takes longer than without the keyword.

A parameter file must be provided; it can be created with the GUI (cf. Sec. 5.2.1) or the command-line program cora_inp (Sect. 5.1.3). It follows the same format as the parameter file used by the C program. The parameter file can be edited by hand or one can run the GUI in parallel to the IDL session and use it just for editing the parameter file.

After compilation the program is started with

IDL> fit_main,[dtime=exposure time,]'spectrum.dat','fit.inp'[,psfile=psfile] .
Terms in [..] can be omitted, the default names 'spectrum.dat', 'fit.inp' can be replaced by any name corresponding to correct and existing names of the spectrum and the parameter file.

The last two parameters, listed in the last line of the parameter file, can be used to make IDL plot a graph of the likelihood curve in dependence of the iterated variables. This is useful in order to get an impression of the shape of each likelihood curve and thus the degree of the minimization problem. The parameter nlik represents the number of points calculated for such a graph, and with the second parameter, ispline, Spline interpolation can be activated ($ispline=1$) or deactivated ($ispline=0$). This function is also carried out by the C-program for the first line, but is not supported by the GUI.

Format parameters controlling line styles, character size etc. can be set in Default values are given in the file delivered with the program, but can be ignored. If no specification is given, the defaults are still used. Fit results and other variables and vectors used by the program are stored in COMMON blocks, listed in, so after calling the fit routine, the variables can be used for further processing. This feature was, e.g., used by Ness, J.U., Mewe, R., Schmitt, J.H.M.M. et al. 2001 (A&A, 367, 282) to disentangle first and third order of their Chandra LETGS spectrum of Capella. The third dispersion order lines were modeled in their first order, and these lines were then added to the instrumental background at the position of their third order on the detector plate. This new spectrum with the manipulated background spectrum was then used for the analysis of the remaining first order lines, recognizing the third order lines as part of the instrumental background.

A short example session is delivered with the program, where compiling and executing is done. Note that closing the plot device is necessary after running the program. This is left to the user for the case that the user wants to add plotting elements not provided by the program like labels before closing the device. The program is called with

IDL> @do

next up previous contents
Next: About this document ... Up: Manual for Cora line Previous: Graph   Contents
Jan-Uwe Ness