Commit 412c7728de8ecd9128e431c75e8faee76e60bed5
1 parent
43b52cb3
Integrate code.
Showing
4 changed files
with
17 additions
and
45 deletions
cscripts/csspec.py
| ... | ... | @@ -157,8 +157,8 @@ class csspec(ctools.cscript): |
| 157 | 157 | |
| 158 | 158 | # Read user parameters |
| 159 | 159 | self.m_enumbins = self["enumbins"].integer() |
| 160 | - self.m_emin = self["emin"].real() - 1e-6 #rounding tolerance | |
| 161 | - self.m_emax = self["emax"].real() + 1e-6 #rounding tolerance | |
| 160 | + self.m_emin = self["emin"].real() - 1e-6 #rounding tolerance | |
| 161 | + self.m_emax = self["emax"].real() + 1e-6 #rounding tolerance | |
| 162 | 162 | |
| 163 | 163 | # Compute number of energy layers used for one spectral bin |
| 164 | 164 | n_layers = cube_ebounds.size() / self.m_enumbins |
| ... | ... | @@ -316,19 +316,19 @@ class csspec(ctools.cscript): |
| 316 | 316 | |
| 317 | 317 | # Create FITS table columns |
| 318 | 318 | energy = gammalib.GFitsTableDoubleCol("Energy", self.m_ebounds.size()) |
| 319 | - energy.unit("TeV") | |
| 320 | 319 | energy_low = gammalib.GFitsTableDoubleCol("ed_Energy", self.m_ebounds.size()) |
| 321 | - energy_low.unit("TeV") | |
| 322 | 320 | energy_high = gammalib.GFitsTableDoubleCol("eu_Energy", self.m_ebounds.size()) |
| 323 | - energy_high.unit("TeV") | |
| 324 | 321 | flux = gammalib.GFitsTableDoubleCol("Flux", self.m_ebounds.size()) |
| 325 | - flux.unit("erg/cm2/s") | |
| 326 | 322 | flux_err = gammalib.GFitsTableDoubleCol("e_Flux", self.m_ebounds.size()) |
| 327 | - flux_err.unit("erg/cm2/s") | |
| 328 | 323 | TSvalues = gammalib.GFitsTableDoubleCol("TS", self.m_ebounds.size()) |
| 329 | 324 | ulim_values = gammalib.GFitsTableDoubleCol("UpperLimit", self.m_ebounds.size()) |
| 330 | - ulim_values.unit("erg/cm2/s") | |
| 331 | 325 | Npred_values = gammalib.GFitsTableDoubleCol("Npred", self.m_ebounds.size()) |
| 326 | + energy.unit("TeV") | |
| 327 | + energy_low.unit("TeV") | |
| 328 | + energy_high.unit("TeV") | |
| 329 | + flux.unit("erg/cm2/s") | |
| 330 | + flux_err.unit("erg/cm2/s") | |
| 331 | + ulim_values.unit("erg/cm2/s") | |
| 332 | 332 | |
| 333 | 333 | |
| 334 | 334 | # Loop over energy bins |
| ... | ... | @@ -380,6 +380,7 @@ class csspec(ctools.cscript): |
| 380 | 380 | if self.logTerse(): |
| 381 | 381 | self.log.header3("Selecting events") |
| 382 | 382 | |
| 383 | + # Select layers | |
| 383 | 384 | cubemask = ctools.ctcubemask(self.obs) |
| 384 | 385 | cubemask["regfile"] = "NONE" |
| 385 | 386 | cubemask["ra"] = "UNDEFINED" | ... | ... |
doc/source/reference_manual/csspec.rst
| ... | ... | @@ -19,8 +19,6 @@ of the source detection. Optionally, it also computes an upper flux limit |
| 19 | 19 | that is particularily useful in case that the source is not significantly |
| 20 | 20 | detected within an energy bin (hidden parameter ``calc_ulim``). |
| 21 | 21 | |
| 22 | -The script works on event lists only. | |
| 23 | - | |
| 24 | 22 | On output, the script will provide a FITS file with the fitted source |
| 25 | 23 | spectrum. |
| 26 | 24 | |
| ... | ... | @@ -56,6 +54,9 @@ General parameters |
| 56 | 54 | ``irf [string]`` |
| 57 | 55 | Instrumental response function. |
| 58 | 56 | |
| 57 | +``(edisp = no) [boolean]`` | |
| 58 | + Apply energy dispersion to response computation? | |
| 59 | + | |
| 59 | 60 | ``emin [real]`` |
| 60 | 61 | Lower energy limit of events (in TeV). |
| 61 | 62 | |
| ... | ... | @@ -68,36 +69,6 @@ General parameters |
| 68 | 69 | ``(ebinalg = LOG) <FILE|LIN|LOG> [string]`` |
| 69 | 70 | Algorithm for defining energy bins. |
| 70 | 71 | |
| 71 | -``binned [boolean]`` | |
| 72 | - Specifies whether a binned computation should be used. | |
| 73 | - | |
| 74 | -``(nebins = 5) [integer]`` | |
| 75 | - Number of bins per spectral point for binned analysis. | |
| 76 | - | |
| 77 | -``coordsys <CEL|GAL> [string]`` | |
| 78 | - Coordinate system (CEL - celestial, GAL - galactic). | |
| 79 | - | |
| 80 | -``proj <AIT|AZP|CAR|MER|MOL|STG|TAN> [string]`` | |
| 81 | - Projection method. | |
| 82 | - | |
| 83 | -``xref [real]`` | |
| 84 | - Right Ascension / Galactic longitude of image centre (J2000, in degrees). | |
| 85 | - | |
| 86 | -``yref [real]`` | |
| 87 | - Declination / Galactic latitude of image centre (J2000, in degrees). | |
| 88 | - | |
| 89 | -``nxpix [integer]`` | |
| 90 | - Size of the Right Ascension / Galactic longitude axis (in pixels). | |
| 91 | - | |
| 92 | -``nypix [integer]`` | |
| 93 | - Size of the Declination / Galactic latitude axis (in pixels). | |
| 94 | - | |
| 95 | -``binsz [real]`` | |
| 96 | - Pixel size (in degrees/pixel). | |
| 97 | - | |
| 98 | -``(anumbins = 200) [integer]`` | |
| 99 | - Number of angular separation bins. | |
| 100 | - | |
| 101 | 72 | ``(calc_ts = yes) [boolean]`` |
| 102 | 73 | Compute TS for each spectral point? |
| 103 | 74 | ... | ... |
src/ctcubemask/ctcubemask.cpp
| ... | ... | @@ -363,7 +363,7 @@ void ctcubemask::get_parameters(void) |
| 363 | 363 | std::string msg = "A valid file needs to be specified for the " |
| 364 | 364 | "\"inobs\" parameter, yet \""+ |
| 365 | 365 | (*this)["inobs"].filename()+"\" was given." |
| 366 | - " Specify a vaild observation definition or " | |
| 366 | + " Specify a valid observation definition or " | |
| 367 | 367 | "event list FITS file to proceed."; |
| 368 | 368 | throw GException::invalid_value(G_GET_PARAMETERS, msg); |
| 369 | 369 | } |
| ... | ... | @@ -600,8 +600,8 @@ void ctcubemask::copy_members(const ctcubemask& app) |
| 600 | 600 | m_emax = app.m_emax; |
| 601 | 601 | |
| 602 | 602 | // Copy protected members |
| 603 | - m_obs = app.m_obs; | |
| 604 | - m_infiles = app.m_infiles; | |
| 603 | + m_obs = app.m_obs; | |
| 604 | + m_infiles = app.m_infiles; | |
| 605 | 605 | m_select_energy = app.m_select_energy; |
| 606 | 606 | m_select_roi = app.m_select_roi; |
| 607 | 607 | ... | ... |
src/ctcubemask/ctcubemask.hpp
| ... | ... | @@ -90,8 +90,8 @@ protected: |
| 90 | 90 | double m_emax; //!< Upper energy |
| 91 | 91 | |
| 92 | 92 | // Protected members |
| 93 | - GObservations m_obs; //!< Observations container | |
| 94 | - std::vector<std::string> m_infiles; //!< Input event filenames | |
| 93 | + GObservations m_obs; //!< Observations container | |
| 94 | + std::vector<std::string> m_infiles; //!< Input event filenames | |
| 95 | 95 | bool m_select_energy; //!< Perform energy selection |
| 96 | 96 | bool m_select_roi; //!< Perform ROI selection |
| 97 | 97 | }; | ... | ... |