From 412c7728de8ecd9128e431c75e8faee76e60bed5 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Fri, 6 Nov 2015 15:52:39 +0100 Subject: [PATCH] Integrate code. --- cscripts/csspec.py | 17 +++++++++-------- doc/source/reference_manual/csspec.rst | 35 +++-------------------------------- src/ctcubemask/ctcubemask.cpp | 6 +++--- src/ctcubemask/ctcubemask.hpp | 4 ++-- 4 files changed, 17 insertions(+), 45 deletions(-) diff --git a/cscripts/csspec.py b/cscripts/csspec.py index 2e037a7..a45c2ed 100755 --- a/cscripts/csspec.py +++ b/cscripts/csspec.py @@ -157,8 +157,8 @@ class csspec(ctools.cscript): # Read user parameters self.m_enumbins = self["enumbins"].integer() - self.m_emin = self["emin"].real() - 1e-6 #rounding tolerance - self.m_emax = self["emax"].real() + 1e-6 #rounding tolerance + self.m_emin = self["emin"].real() - 1e-6 #rounding tolerance + self.m_emax = self["emax"].real() + 1e-6 #rounding tolerance # Compute number of energy layers used for one spectral bin n_layers = cube_ebounds.size() / self.m_enumbins @@ -316,19 +316,19 @@ class csspec(ctools.cscript): # Create FITS table columns energy = gammalib.GFitsTableDoubleCol("Energy", self.m_ebounds.size()) - energy.unit("TeV") energy_low = gammalib.GFitsTableDoubleCol("ed_Energy", self.m_ebounds.size()) - energy_low.unit("TeV") energy_high = gammalib.GFitsTableDoubleCol("eu_Energy", self.m_ebounds.size()) - energy_high.unit("TeV") flux = gammalib.GFitsTableDoubleCol("Flux", self.m_ebounds.size()) - flux.unit("erg/cm2/s") flux_err = gammalib.GFitsTableDoubleCol("e_Flux", self.m_ebounds.size()) - flux_err.unit("erg/cm2/s") TSvalues = gammalib.GFitsTableDoubleCol("TS", self.m_ebounds.size()) ulim_values = gammalib.GFitsTableDoubleCol("UpperLimit", self.m_ebounds.size()) - ulim_values.unit("erg/cm2/s") Npred_values = gammalib.GFitsTableDoubleCol("Npred", self.m_ebounds.size()) + energy.unit("TeV") + energy_low.unit("TeV") + energy_high.unit("TeV") + flux.unit("erg/cm2/s") + flux_err.unit("erg/cm2/s") + ulim_values.unit("erg/cm2/s") # Loop over energy bins @@ -380,6 +380,7 @@ class csspec(ctools.cscript): if self.logTerse(): self.log.header3("Selecting events") + # Select layers cubemask = ctools.ctcubemask(self.obs) cubemask["regfile"] = "NONE" cubemask["ra"] = "UNDEFINED" diff --git a/doc/source/reference_manual/csspec.rst b/doc/source/reference_manual/csspec.rst index ed22caf..8a64c5c 100644 --- a/doc/source/reference_manual/csspec.rst +++ b/doc/source/reference_manual/csspec.rst @@ -19,8 +19,6 @@ of the source detection. Optionally, it also computes an upper flux limit that is particularily useful in case that the source is not significantly detected within an energy bin (hidden parameter ``calc_ulim``). -The script works on event lists only. - On output, the script will provide a FITS file with the fitted source spectrum. @@ -56,6 +54,9 @@ General parameters ``irf [string]`` Instrumental response function. +``(edisp = no) [boolean]`` + Apply energy dispersion to response computation? + ``emin [real]`` Lower energy limit of events (in TeV). @@ -68,36 +69,6 @@ General parameters ``(ebinalg = LOG) [string]`` Algorithm for defining energy bins. -``binned [boolean]`` - Specifies whether a binned computation should be used. - -``(nebins = 5) [integer]`` - Number of bins per spectral point for binned analysis. - -``coordsys [string]`` - Coordinate system (CEL - celestial, GAL - galactic). - -``proj [string]`` - Projection method. - -``xref [real]`` - Right Ascension / Galactic longitude of image centre (J2000, in degrees). - -``yref [real]`` - Declination / Galactic latitude of image centre (J2000, in degrees). - -``nxpix [integer]`` - Size of the Right Ascension / Galactic longitude axis (in pixels). - -``nypix [integer]`` - Size of the Declination / Galactic latitude axis (in pixels). - -``binsz [real]`` - Pixel size (in degrees/pixel). - -``(anumbins = 200) [integer]`` - Number of angular separation bins. - ``(calc_ts = yes) [boolean]`` Compute TS for each spectral point? diff --git a/src/ctcubemask/ctcubemask.cpp b/src/ctcubemask/ctcubemask.cpp index 3cd4c13..78cde3a 100644 --- a/src/ctcubemask/ctcubemask.cpp +++ b/src/ctcubemask/ctcubemask.cpp @@ -363,7 +363,7 @@ void ctcubemask::get_parameters(void) std::string msg = "A valid file needs to be specified for the " "\"inobs\" parameter, yet \""+ (*this)["inobs"].filename()+"\" was given." - " Specify a vaild observation definition or " + " Specify a valid observation definition or " "event list FITS file to proceed."; throw GException::invalid_value(G_GET_PARAMETERS, msg); } @@ -600,8 +600,8 @@ void ctcubemask::copy_members(const ctcubemask& app) m_emax = app.m_emax; // Copy protected members - m_obs = app.m_obs; - m_infiles = app.m_infiles; + m_obs = app.m_obs; + m_infiles = app.m_infiles; m_select_energy = app.m_select_energy; m_select_roi = app.m_select_roi; diff --git a/src/ctcubemask/ctcubemask.hpp b/src/ctcubemask/ctcubemask.hpp index 06c8812..d967532 100644 --- a/src/ctcubemask/ctcubemask.hpp +++ b/src/ctcubemask/ctcubemask.hpp @@ -90,8 +90,8 @@ protected: double m_emax; //!< Upper energy // Protected members - GObservations m_obs; //!< Observations container - std::vector m_infiles; //!< Input event filenames + GObservations m_obs; //!< Observations container + std::vector m_infiles; //!< Input event filenames bool m_select_energy; //!< Perform energy selection bool m_select_roi; //!< Perform ROI selection }; -- libgit2 0.21.4