Commit 207a2fed2386fd5d8e42dd63bcc80b70cb6b047d
1 parent
a370b5f6
print to screen if debug=yes
Showing
8 changed files
with
56 additions
and
14 deletions
src/ctbin/ctbin.cpp
| @@ -101,6 +101,10 @@ ctbin::~ctbin(void) | @@ -101,6 +101,10 @@ ctbin::~ctbin(void) | ||
| 101 | ***************************************************************************/ | 101 | ***************************************************************************/ |
| 102 | void ctbin::run(void) | 102 | void ctbin::run(void) |
| 103 | { | 103 | { |
| 104 | + // Switch screen logging on in debug mode | ||
| 105 | + if (logDebug()) | ||
| 106 | + log.cout(true); | ||
| 107 | + | ||
| 104 | // Get parameters | 108 | // Get parameters |
| 105 | get_parameters(); | 109 | get_parameters(); |
| 106 | 110 |
src/ctbin/ctbin.hpp
| @@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
| 25 | 25 | ||
| 26 | /* __Definitions _________________________________________________________ */ | 26 | /* __Definitions _________________________________________________________ */ |
| 27 | #define CTBIN_NAME "ctbin" | 27 | #define CTBIN_NAME "ctbin" |
| 28 | -#define CTBIN_VERSION "v1r0p0" | 28 | +#define CTBIN_VERSION "00-01-00" |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | /***********************************************************************//** | 31 | /***********************************************************************//** |
src/ctlike/ctlike.cpp
| @@ -104,7 +104,10 @@ ctlike::~ctlike(void) | @@ -104,7 +104,10 @@ ctlike::~ctlike(void) | ||
| 104 | ***************************************************************************/ | 104 | ***************************************************************************/ |
| 105 | void ctlike::run(void) | 105 | void ctlike::run(void) |
| 106 | { | 106 | { |
| 107 | - log.cout(true); | 107 | + // Switch screen logging on in debug mode |
| 108 | + if (logDebug()) | ||
| 109 | + log.cout(true); | ||
| 110 | + | ||
| 108 | // Get parameters | 111 | // Get parameters |
| 109 | get_parameters(); | 112 | get_parameters(); |
| 110 | 113 | ||
| @@ -304,7 +307,7 @@ void ctlike::init_members(void) | @@ -304,7 +307,7 @@ void ctlike::init_members(void) | ||
| 304 | m_outmdl.clear(); | 307 | m_outmdl.clear(); |
| 305 | m_models.clear(); | 308 | m_models.clear(); |
| 306 | m_obs.clear(); | 309 | m_obs.clear(); |
| 307 | - m_max_iter = 1000; | 310 | + m_max_iter = 100; |
| 308 | m_logL = 0.0; | 311 | m_logL = 0.0; |
| 309 | m_opt = NULL; | 312 | m_opt = NULL; |
| 310 | 313 |
src/ctlike/ctlike.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctlike - CTA maximum likelihood tool * | 2 | * ctlike - CTA maximum likelihood tool * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010 by Jurgen Knodlseder * | 4 | + * copyright (C) 2010-2011 by Jurgen Knodlseder * |
| 5 | * ----------------------------------------------------------------------- * | 5 | * ----------------------------------------------------------------------- * |
| 6 | * * | 6 | * * |
| 7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
| @@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
| 26 | 26 | ||
| 27 | /* __Definitions _________________________________________________________ */ | 27 | /* __Definitions _________________________________________________________ */ |
| 28 | #define CTLIKE_NAME "ctlike" | 28 | #define CTLIKE_NAME "ctlike" |
| 29 | -#define CTLIKE_VERSION "v1r0p0" | 29 | +#define CTLIKE_VERSION "00-01-00" |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | /***********************************************************************//** | 32 | /***********************************************************************//** |
src/ctobssim/ctobssim.cpp
| @@ -101,6 +101,10 @@ ctobssim::~ctobssim(void) | @@ -101,6 +101,10 @@ ctobssim::~ctobssim(void) | ||
| 101 | ***************************************************************************/ | 101 | ***************************************************************************/ |
| 102 | void ctobssim::run(void) | 102 | void ctobssim::run(void) |
| 103 | { | 103 | { |
| 104 | + // Switch screen logging on in debug mode | ||
| 105 | + if (logDebug()) | ||
| 106 | + log.cout(true); | ||
| 107 | + | ||
| 104 | // Get parameters | 108 | // Get parameters |
| 105 | get_parameters(); | 109 | get_parameters(); |
| 106 | 110 |
src/ctobssim/ctobssim.hpp
| @@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
| 25 | 25 | ||
| 26 | /* __Definitions _________________________________________________________ */ | 26 | /* __Definitions _________________________________________________________ */ |
| 27 | #define CTOBSSIM_NAME "ctobssim" | 27 | #define CTOBSSIM_NAME "ctobssim" |
| 28 | -#define CTOBSSIM_VERSION "v1r0p0" | 28 | +#define CTOBSSIM_VERSION "00-01-00" |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | /***********************************************************************//** | 31 | /***********************************************************************//** |
src/ctselect/ctselect.cpp
| @@ -109,6 +109,10 @@ ctselect::~ctselect(void) | @@ -109,6 +109,10 @@ ctselect::~ctselect(void) | ||
| 109 | ***************************************************************************/ | 109 | ***************************************************************************/ |
| 110 | void ctselect::run(void) | 110 | void ctselect::run(void) |
| 111 | { | 111 | { |
| 112 | + // Switch screen logging on in debug mode | ||
| 113 | + if (logDebug()) | ||
| 114 | + log.cout(true); | ||
| 115 | + | ||
| 112 | // Get parameters | 116 | // Get parameters |
| 113 | get_parameters(); | 117 | get_parameters(); |
| 114 | 118 | ||
| @@ -237,21 +241,48 @@ void ctselect::select(void) | @@ -237,21 +241,48 @@ void ctselect::select(void) | ||
| 237 | 241 | ||
| 238 | /***********************************************************************//** | 242 | /***********************************************************************//** |
| 239 | * @brief Append GTI to FITS file | 243 | * @brief Append GTI to FITS file |
| 244 | + * | ||
| 245 | + * @todo We implement here a dummy method that overwrites an existing GTI | ||
| 246 | + * entry but that only works if a single time interval exists. This | ||
| 247 | + * is not clean, but since we have no method so far that allows | ||
| 248 | + * deleting a HDU from a FITS file we have no other choice. Ideally, | ||
| 249 | + * we would like to first delete an existing HDU and then append | ||
| 250 | + * a new one. If this is not possible, we would like to delete the | ||
| 251 | + * rows from an existing GTI and then fill it up anew. But in any | ||
| 252 | + * case, the actual data selection method does not check the | ||
| 253 | + * existing GTI, which we have to do to merge any subselection | ||
| 254 | + * information in. In fact, we need a GTI merge method as well ... | ||
| 240 | ***************************************************************************/ | 255 | ***************************************************************************/ |
| 241 | void ctselect::append_gti(void) | 256 | void ctselect::append_gti(void) |
| 242 | { | 257 | { |
| 243 | - // Allocate Gti | ||
| 244 | - GGti gti; | ||
| 245 | - | ||
| 246 | - // Setup single GTI covering the selected time range | 258 | + // Setup selected time range |
| 247 | GTime tstart; | 259 | GTime tstart; |
| 248 | GTime tstop; | 260 | GTime tstop; |
| 249 | tstart.met(m_tmin); | 261 | tstart.met(m_tmin); |
| 250 | tstop.met(m_tmax); | 262 | tstop.met(m_tmax); |
| 251 | - gti.add(tstart, tstop); | ||
| 252 | 263 | ||
| 253 | - // Write GTI | ||
| 254 | - gti.write(&m_file); | 264 | + // Initialise empty GTI table HDU |
| 265 | + GFitsTable* hdu = NULL; | ||
| 266 | + | ||
| 267 | + // Write selected time interval, either in an existing GTI or in a new | ||
| 268 | + // GTI that is appended to the FITS file | ||
| 269 | + try { | ||
| 270 | + hdu = m_file.table("GTI"); | ||
| 271 | + GFitsTableDoubleCol* start = (GFitsTableDoubleCol*)hdu->column("START"); | ||
| 272 | + GFitsTableDoubleCol* stop = (GFitsTableDoubleCol*)hdu->column("STOP"); | ||
| 273 | + (*start)(0) = tstart.met(); | ||
| 274 | + (*stop)(0) = tstop.met(); | ||
| 275 | + } | ||
| 276 | + catch (GException::fits_hdu_not_found) { | ||
| 277 | + // Allocate Gti | ||
| 278 | + GGti gti; | ||
| 279 | + | ||
| 280 | + // Setup single GTI covering the selected time range | ||
| 281 | + gti.add(tstart, tstop); | ||
| 282 | + | ||
| 283 | + // Write GTI | ||
| 284 | + gti.write(&m_file); | ||
| 285 | + } | ||
| 255 | 286 | ||
| 256 | // Log final FITS file | 287 | // Log final FITS file |
| 257 | if (logExplicit()) { | 288 | if (logExplicit()) { |
src/ctselect/ctselect.hpp
| @@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
| 24 | 24 | ||
| 25 | /* __Definitions _________________________________________________________ */ | 25 | /* __Definitions _________________________________________________________ */ |
| 26 | #define CTSELECT_NAME "ctselect" | 26 | #define CTSELECT_NAME "ctselect" |
| 27 | -#define CTSELECT_VERSION "v1r0p0" | 27 | +#define CTSELECT_VERSION "00-01-00" |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | /***********************************************************************//** | 30 | /***********************************************************************//** |