Subroutine especplot Recover parameters (Filenames, Binning mode, Device type) Read source (Src) and background (Bkg) spectrum FITS files : Get dataset and table. Check if important keywords exist and are correct. Call an error if not. Recover counts and channel columns. Get energy boundaries (Emin, Emax) using 1PI=1eV Open plot : Create view surface in specified device format. Write labels on it. Allocate six vectors with Emin&Emax size : Emed = (Emin + Emax)/2 Edelta = (Emin - Emax)/2 Net_Counts = Src_Counts - Bkg_Counts*Src_Exposure_Time/Bkg_Exposure_Time Net_Counts_Err = sqrt(Src_Counts + Bkg_Counts* ((Src_Exposure_Time/Bkg_Exposure_Time)**2)) Bkg_Counts which yet exists Bkg_Counts_Err = sqrt(Bkg_Counts) For Net_Counts and Bkg_Counts do : Rebin Emed, Edelta, Counts, Counts_Err following the specified binning scheme (auto, size). Normalize Counts and Counts_Err. In the new vectors, eliminate each value where : (Emed-Edelta<=0) or (Counts-Counts_Err<=0) Plot Y=log(Counts) as a function of X=log(Emed) Draw errors on plotted points : log(Counts_Err) for Y-axis log(Edelta) for X-axis End for Return plot on device selected. Release memory. Close plot. End subroutine especplot