Commit b095127733a92aac769fd3498da14aa15062270f
1 parent
261e0fb4
Remove ctools::is_valid_filename() method.
Showing
25 changed files
with
300 additions
and
322 deletions
ChangeLog
| 1 | -2018-04-10 | 1 | +2018-06-07 |
| 2 | 2 | ||
| 3 | * Version 1.6.0 released | 3 | * Version 1.6.0 released |
| 4 | ======================== | 4 | ======================== |
| 5 | 5 | ||
| 6 | + Remove ctools::is_valid_filename() method. | ||
| 6 | Fix bug when using precomputed model in csresspec (#2448) | 7 | Fix bug when using precomputed model in csresspec (#2448) |
| 7 | Keep existing library path in installation script on Mac OS X (#2420) | 8 | Keep existing library path in installation script on Mac OS X (#2420) |
| 8 | Add show_rmf.py example script | 9 | Add show_rmf.py example script |
NEWS
| 1 | New Features and Important Changes in ctools 1.6.0 | 1 | New Features and Important Changes in ctools 1.6.0 |
| 2 | 2 | ||
| 3 | -5 June 2018 | 3 | +7 June 2018 |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | Introduction | 6 | Introduction |
| @@ -26,7 +26,8 @@ None | @@ -26,7 +26,8 @@ None | ||
| 26 | 26 | ||
| 27 | Base classes | 27 | Base classes |
| 28 | ------------ | 28 | ------------ |
| 29 | -None | 29 | +The ctools::is_valid_filename() method was removed since the validity check |
| 30 | +of the filename is now done by the GApplicationPar class. | ||
| 30 | 31 | ||
| 31 | 32 | ||
| 32 | ctbin - CTA event binning | 33 | ctbin - CTA event binning |
pyext/ctool.i
| @@ -115,7 +115,6 @@ public: | @@ -115,7 +115,6 @@ public: | ||
| 115 | %rename(_get_obs_header) get_obs_header; | 115 | %rename(_get_obs_header) get_obs_header; |
| 116 | %rename(_insert_energy_boundaries) insert_energy_boundaries; | 116 | %rename(_insert_energy_boundaries) insert_energy_boundaries; |
| 117 | %rename(_cube_layer_usage) cube_layer_usage; | 117 | %rename(_cube_layer_usage) cube_layer_usage; |
| 118 | - %rename(_is_valid_filename) is_valid_filename; | ||
| 119 | %rename(_get_gtiname) get_gtiname; | 118 | %rename(_get_gtiname) get_gtiname; |
| 120 | %rename(_save_event_list) save_event_list; | 119 | %rename(_save_event_list) save_event_list; |
| 121 | %rename(_warn_too_few_energies) warn_too_few_energies; | 120 | %rename(_warn_too_few_energies) warn_too_few_energies; |
| @@ -167,7 +166,6 @@ public: | @@ -167,7 +166,6 @@ public: | ||
| 167 | const GCTAObservation& obs); | 166 | const GCTAObservation& obs); |
| 168 | std::vector<bool> cube_layer_usage(const GEbounds& cube_ebounds, | 167 | std::vector<bool> cube_layer_usage(const GEbounds& cube_ebounds, |
| 169 | const GEbounds& list_ebounds) const; | 168 | const GEbounds& list_ebounds) const; |
| 170 | - bool is_valid_filename(const GFilename& filename) const; | ||
| 171 | std::string get_gtiname(const std::string& filename, | 169 | std::string get_gtiname(const std::string& filename, |
| 172 | const std::string& evtname) const; | 170 | const std::string& evtname) const; |
| 173 | void save_event_list(const GCTAObservation* obs, | 171 | void save_event_list(const GCTAObservation* obs, |
src/ctbin/ctbin.cpp
| @@ -301,12 +301,12 @@ void ctbin::save(void) | @@ -301,12 +301,12 @@ void ctbin::save(void) | ||
| 301 | // Write header | 301 | // Write header |
| 302 | log_header1(TERSE, "Save counts cube"); | 302 | log_header1(TERSE, "Save counts cube"); |
| 303 | 303 | ||
| 304 | - // Get counts cube filename | ||
| 305 | - m_outcube = (*this)["outcube"].filename(); | ||
| 306 | - | ||
| 307 | - // Save only if filename is not empty and if there is at least one | 304 | + // Save only if filename is valid and if there is at least one |
| 308 | // observation | 305 | // observation |
| 309 | - if (!m_outcube.is_empty() && m_obs.size() > 0) { | 306 | + if ((*this)["outcube"].is_valid() && m_obs.size() > 0) { |
| 307 | + | ||
| 308 | + // Get counts cube filename | ||
| 309 | + m_outcube = (*this)["outcube"].filename(); | ||
| 310 | 310 | ||
| 311 | // Get CTA observation from observation container | 311 | // Get CTA observation from observation container |
| 312 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]); | 312 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]); |
| @@ -464,10 +464,9 @@ void ctbin::get_parameters(void) | @@ -464,10 +464,9 @@ void ctbin::get_parameters(void) | ||
| 464 | m_publish = (*this)["publish"].boolean(); | 464 | m_publish = (*this)["publish"].boolean(); |
| 465 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); | 465 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); |
| 466 | 466 | ||
| 467 | - // Optionally read ahead parameters so that they get correctly | ||
| 468 | - // dumped into the log file | 467 | + // If needed later, query output filename now |
| 469 | if (read_ahead()) { | 468 | if (read_ahead()) { |
| 470 | - m_outcube = (*this)["outcube"].filename(); | 469 | + (*this)["outcube"].query(); |
| 471 | } | 470 | } |
| 472 | 471 | ||
| 473 | // Cache sky directions in m_counts | 472 | // Cache sky directions in m_counts |
src/ctbkgcube/ctbkgcube.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctbkgcube - Background cube generation tool * | 2 | * ctbkgcube - Background cube generation tool * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2014-2017 by Chia-Chun Lu * | 4 | + * copyright (C) 2014-2018 by Chia-Chun Lu * |
| 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 * |
| @@ -351,21 +351,30 @@ void ctbkgcube::save(void) | @@ -351,21 +351,30 @@ void ctbkgcube::save(void) | ||
| 351 | // Write header | 351 | // Write header |
| 352 | log_header1(TERSE, "Save background cube"); | 352 | log_header1(TERSE, "Save background cube"); |
| 353 | 353 | ||
| 354 | - // Get background cube and model file names | ||
| 355 | - m_outcube = (*this)["outcube"].filename(); | ||
| 356 | - m_outmodel = (*this)["outmodel"].filename(); | ||
| 357 | - | ||
| 358 | // Determine whether a model definition file should be written | 354 | // Determine whether a model definition file should be written |
| 359 | - bool write_moddef = is_valid_filename(m_outmodel); | 355 | + bool write_moddef = (*this)["outmodel"].is_valid(); |
| 356 | + | ||
| 357 | + // Save background cube if filename is valid and the background cube is | ||
| 358 | + // not empty | ||
| 359 | + if ((*this)["outcube"].is_valid() && !m_background.cube().is_empty()) { | ||
| 360 | + | ||
| 361 | + // Get background cube file name | ||
| 362 | + m_outcube = (*this)["outcube"].filename(); | ||
| 360 | 363 | ||
| 361 | - // Save background cube if filename and the background cube are not empty | ||
| 362 | - if (!m_outcube.is_empty() && !m_background.cube().is_empty()) { | 364 | + // Save background cube |
| 363 | m_background.save(m_outcube, clobber()); | 365 | m_background.save(m_outcube, clobber()); |
| 366 | + | ||
| 364 | } | 367 | } |
| 365 | 368 | ||
| 366 | // Save model definition file if requested | 369 | // Save model definition file if requested |
| 367 | if (write_moddef) { | 370 | if (write_moddef) { |
| 371 | + | ||
| 372 | + // Get model file name | ||
| 373 | + m_outmodel = (*this)["outmodel"].filename(); | ||
| 374 | + | ||
| 375 | + // Save model | ||
| 368 | m_outmdl.save(m_outmodel.url()); | 376 | m_outmdl.save(m_outmodel.url()); |
| 377 | + | ||
| 369 | } | 378 | } |
| 370 | 379 | ||
| 371 | // Write into logger what has been done | 380 | // Write into logger what has been done |
| @@ -483,14 +492,12 @@ void ctbkgcube::get_parameters(void) | @@ -483,14 +492,12 @@ void ctbkgcube::get_parameters(void) | ||
| 483 | // event lists, but do not accept counts cubes. | 492 | // event lists, but do not accept counts cubes. |
| 484 | setup_observations(m_obs, true, true, false); | 493 | setup_observations(m_obs, true, true, false); |
| 485 | 494 | ||
| 486 | - // Get the incube filename | ||
| 487 | - std::string incube = (*this)["incube"].filename(); | ||
| 488 | - | ||
| 489 | // If the "incube" file name is valid then setup the background cube from | 495 | // If the "incube" file name is valid then setup the background cube from |
| 490 | // the counts cube. Otherwise create a counts cube from the user | 496 | // the counts cube. Otherwise create a counts cube from the user |
| 491 | // parameters | 497 | // parameters |
| 492 | - GCTAEventCube cube = is_valid_filename(incube) ? GCTAEventCube(incube) | ||
| 493 | - : create_cube(m_obs); | 498 | + GCTAEventCube cube = (*this)["incube"].is_valid() |
| 499 | + ? GCTAEventCube((*this)["incube"].filename()) | ||
| 500 | + : create_cube(m_obs); | ||
| 494 | 501 | ||
| 495 | // Define background cube | 502 | // Define background cube |
| 496 | m_background = GCTACubeBackground(cube); | 503 | m_background = GCTACubeBackground(cube); |
| @@ -503,10 +510,10 @@ void ctbkgcube::get_parameters(void) | @@ -503,10 +510,10 @@ void ctbkgcube::get_parameters(void) | ||
| 503 | m_publish = (*this)["publish"].boolean(); | 510 | m_publish = (*this)["publish"].boolean(); |
| 504 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); | 511 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); |
| 505 | 512 | ||
| 506 | - // Read output filenames (if needed) | 513 | + // If needed later, query output filenames now |
| 507 | if (read_ahead()) { | 514 | if (read_ahead()) { |
| 508 | - m_outcube = (*this)["outcube"].filename(); | ||
| 509 | - m_outmodel = (*this)["outmodel"].filename(); | 515 | + (*this)["outcube"].query(); |
| 516 | + (*this)["outmodel"].query(); | ||
| 510 | } | 517 | } |
| 511 | 518 | ||
| 512 | // Write parameters into logger | 519 | // Write parameters into logger |
src/ctbutterfly/ctbutterfly.cpp
| @@ -340,11 +340,11 @@ void ctbutterfly::save(void) | @@ -340,11 +340,11 @@ void ctbutterfly::save(void) | ||
| 340 | // Write header into logger | 340 | // Write header into logger |
| 341 | log_header1(TERSE, "Save Butterfly diagram"); | 341 | log_header1(TERSE, "Save Butterfly diagram"); |
| 342 | 342 | ||
| 343 | - // Get output filename | ||
| 344 | - m_outfile = (*this)["outfile"].filename(); | 343 | + // Save only if filename is valid |
| 344 | + if ((*this)["outfile"].is_valid()) { | ||
| 345 | 345 | ||
| 346 | - // Save only if filename is non-empty | ||
| 347 | - if (!m_outfile.is_empty()) { | 346 | + // Get output filename |
| 347 | + m_outfile = (*this)["outfile"].filename(); | ||
| 348 | 348 | ||
| 349 | // Log butterfly diagram file name | 349 | // Log butterfly diagram file name |
| 350 | log_value(NORMAL, "Butterfly file", m_outfile.url()); | 350 | log_value(NORMAL, "Butterfly file", m_outfile.url()); |
| @@ -465,8 +465,7 @@ void ctbutterfly::get_parameters(void) | @@ -465,8 +465,7 @@ void ctbutterfly::get_parameters(void) | ||
| 465 | m_ebounds = create_ebounds(); | 465 | m_ebounds = create_ebounds(); |
| 466 | 466 | ||
| 467 | // Get matrix file name and load if possible | 467 | // Get matrix file name and load if possible |
| 468 | - std::string matrixfilename = (*this)["matrix"].filename(); | ||
| 469 | - if (matrixfilename != "NONE") { | 468 | + if ((*this)["matrix"].is_valid()) { |
| 470 | std::string msg = "Loading of matrix from file not implemented yet. " | 469 | std::string msg = "Loading of matrix from file not implemented yet. " |
| 471 | "Use filename = \"NONE\" to induce a recomputation " | 470 | "Use filename = \"NONE\" to induce a recomputation " |
| 472 | "of the matrix internally."; | 471 | "of the matrix internally."; |
| @@ -484,10 +483,9 @@ void ctbutterfly::get_parameters(void) | @@ -484,10 +483,9 @@ void ctbutterfly::get_parameters(void) | ||
| 484 | // Check model name and type | 483 | // Check model name and type |
| 485 | check_model(); | 484 | check_model(); |
| 486 | 485 | ||
| 487 | - // Optionally read ahead parameters so that they get correctly | ||
| 488 | - // dumped into the log file | 486 | + // If needed later, query output filename now |
| 489 | if (read_ahead()) { | 487 | if (read_ahead()) { |
| 490 | - m_outfile = (*this)["outfile"].filename(); | 488 | + (*this)["outfile"].query(); |
| 491 | } | 489 | } |
| 492 | 490 | ||
| 493 | // Write parameters into logger | 491 | // Write parameters into logger |
src/ctcubemask/ctcubemask.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctcubemask - Cube filter tool * | 2 | * ctcubemask - Cube filter tool * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2014-2016 by Chia-Chun Lu * | 4 | + * copyright (C) 2014-2018 by Chia-Chun Lu * |
| 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 * |
| @@ -372,7 +372,6 @@ void ctcubemask::publish(const std::string& name) | @@ -372,7 +372,6 @@ void ctcubemask::publish(const std::string& name) | ||
| 372 | void ctcubemask::init_members(void) | 372 | void ctcubemask::init_members(void) |
| 373 | { | 373 | { |
| 374 | // Initialise parameters | 374 | // Initialise parameters |
| 375 | - m_regfile.clear(); | ||
| 376 | m_outcube.clear(); | 375 | m_outcube.clear(); |
| 377 | m_prefix.clear(); | 376 | m_prefix.clear(); |
| 378 | m_emin = 0.0; | 377 | m_emin = 0.0; |
| @@ -396,7 +395,6 @@ void ctcubemask::init_members(void) | @@ -396,7 +395,6 @@ void ctcubemask::init_members(void) | ||
| 396 | void ctcubemask::copy_members(const ctcubemask& app) | 395 | void ctcubemask::copy_members(const ctcubemask& app) |
| 397 | { | 396 | { |
| 398 | // Copy parameters | 397 | // Copy parameters |
| 399 | - m_regfile = app.m_regfile; | ||
| 400 | m_outcube = app.m_outcube; | 398 | m_outcube = app.m_outcube; |
| 401 | m_prefix = app.m_prefix; | 399 | m_prefix = app.m_prefix; |
| 402 | m_emin = app.m_emin; | 400 | m_emin = app.m_emin; |
| @@ -441,8 +439,8 @@ void ctcubemask::get_parameters(void) | @@ -441,8 +439,8 @@ void ctcubemask::get_parameters(void) | ||
| 441 | // information and do not accept event lists. | 439 | // information and do not accept event lists. |
| 442 | setup_observations(m_obs, false, false, true); | 440 | setup_observations(m_obs, false, false, true); |
| 443 | 441 | ||
| 444 | - // Get parameters | ||
| 445 | - m_regfile = (*this)["regfile"].filename(); | 442 | + // Query "regfile" parameter |
| 443 | + (*this)["regfile"].query(); | ||
| 446 | 444 | ||
| 447 | // Query the RoI | 445 | // Query the RoI |
| 448 | GCTARoi roi = get_roi(); | 446 | GCTARoi roi = get_roi(); |
| @@ -460,11 +458,10 @@ void ctcubemask::get_parameters(void) | @@ -460,11 +458,10 @@ void ctcubemask::get_parameters(void) | ||
| 460 | // Get remaining parameters | 458 | // Get remaining parameters |
| 461 | m_publish = (*this)["publish"].boolean(); | 459 | m_publish = (*this)["publish"].boolean(); |
| 462 | 460 | ||
| 463 | - // Optionally read ahead parameters so that they get correctly | ||
| 464 | - // dumped into the log file | 461 | + // If needed later, query output filename and prefix now |
| 465 | if (read_ahead()) { | 462 | if (read_ahead()) { |
| 466 | - m_outcube = (*this)["outcube"].filename(); | ||
| 467 | - m_prefix = (*this)["prefix"].string(); | 463 | + (*this)["outcube"].query(); |
| 464 | + (*this)["prefix"].query(); | ||
| 468 | } | 465 | } |
| 469 | 466 | ||
| 470 | // Write parameters into logger | 467 | // Write parameters into logger |
| @@ -576,8 +573,8 @@ void ctcubemask::apply_mask(GCTAObservation* obs) | @@ -576,8 +573,8 @@ void ctcubemask::apply_mask(GCTAObservation* obs) | ||
| 576 | 573 | ||
| 577 | // Set all pixels inside selected energy bands and inside exclusion | 574 | // Set all pixels inside selected energy bands and inside exclusion |
| 578 | // regions to -1.0 | 575 | // regions to -1.0 |
| 579 | - if (m_regfile != "NONE") { | ||
| 580 | - GSkyRegions regions = GSkyRegions(m_regfile); | 576 | + if ((*this)["regfile"].is_valid()) { |
| 577 | + GSkyRegions regions = GSkyRegions((*this)["regfile"].filename()); | ||
| 581 | for (int i = e_idx1; i <= e_idx2; ++i) { | 578 | for (int i = e_idx1; i <= e_idx2; ++i) { |
| 582 | for (int pixel = 0; pixel < npix; ++pixel) { | 579 | for (int pixel = 0; pixel < npix; ++pixel) { |
| 583 | GSkyDir dir = map.inx2dir(pixel); | 580 | GSkyDir dir = map.inx2dir(pixel); |
| @@ -679,8 +676,8 @@ std::string ctcubemask::set_outfile_name(const std::string& filename) const | @@ -679,8 +676,8 @@ std::string ctcubemask::set_outfile_name(const std::string& filename) const | ||
| 679 | ***************************************************************************/ | 676 | ***************************************************************************/ |
| 680 | void ctcubemask::save_fits(void) | 677 | void ctcubemask::save_fits(void) |
| 681 | { | 678 | { |
| 682 | - // Save only if filename is non-empty and if there are observations | ||
| 683 | - if (!m_outcube.is_empty() && m_obs.size() > 0) { | 679 | + // Save only if there are observations |
| 680 | + if (m_obs.size() > 0) { | ||
| 684 | 681 | ||
| 685 | // Get CTA observation from observation container | 682 | // Get CTA observation from observation container |
| 686 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]); | 683 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]); |
src/ctcubemask/ctcubemask.hpp
| @@ -76,7 +76,6 @@ protected: | @@ -76,7 +76,6 @@ protected: | ||
| 76 | void save_xml(void); | 76 | void save_xml(void); |
| 77 | 77 | ||
| 78 | // User parameters | 78 | // User parameters |
| 79 | - GFilename m_regfile; //!< ds9 region file | ||
| 80 | GFilename m_outcube; //!< Output event list or XML file | 79 | GFilename m_outcube; //!< Output event list or XML file |
| 81 | std::string m_prefix; //!< Prefix for multiple counts maps | 80 | std::string m_prefix; //!< Prefix for multiple counts maps |
| 82 | double m_emin; //!< Lower energy | 81 | double m_emin; //!< Lower energy |
src/ctedispcube/ctedispcube.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctedispcube - Energy dispersion cube generation tool * | 2 | * ctedispcube - Energy dispersion cube generation tool * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016 by Maria Haupt * | 4 | + * copyright (C) 2016-2018 by Maria Haupt * |
| 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 * |
| @@ -260,13 +260,16 @@ void ctedispcube::save(void) | @@ -260,13 +260,16 @@ void ctedispcube::save(void) | ||
| 260 | // Write header into logger | 260 | // Write header into logger |
| 261 | log_header1(TERSE, "Save energy dispersion cube"); | 261 | log_header1(TERSE, "Save energy dispersion cube"); |
| 262 | 262 | ||
| 263 | - // Get output filename | ||
| 264 | - m_outcube = (*this)["outcube"].filename(); | ||
| 265 | - | ||
| 266 | // Save energy dispersion cube if filename and the energy dispersion cube | 263 | // Save energy dispersion cube if filename and the energy dispersion cube |
| 267 | // are not empty | 264 | // are not empty |
| 268 | - if (!m_outcube.is_empty() && !m_edispcube.cube().is_empty()) { | 265 | + if ((*this)["outcube"].is_valid() && !m_edispcube.cube().is_empty()) { |
| 266 | + | ||
| 267 | + // Get output filename | ||
| 268 | + m_outcube = (*this)["outcube"].filename(); | ||
| 269 | + | ||
| 270 | + // Save energy dispersion cube | ||
| 269 | m_edispcube.save(m_outcube, clobber()); | 271 | m_edispcube.save(m_outcube, clobber()); |
| 272 | + | ||
| 270 | } | 273 | } |
| 271 | 274 | ||
| 272 | // Write into logger what has been done | 275 | // Write into logger what has been done |
| @@ -346,9 +349,6 @@ void ctedispcube::get_parameters(void) | @@ -346,9 +349,6 @@ void ctedispcube::get_parameters(void) | ||
| 346 | // Setup observations from "inobs" parameter. Do not accept counts cubes. | 349 | // Setup observations from "inobs" parameter. Do not accept counts cubes. |
| 347 | setup_observations(m_obs, true, true, false); | 350 | setup_observations(m_obs, true, true, false); |
| 348 | 351 | ||
| 349 | - // Get the incube filename | ||
| 350 | - std::string incube = (*this)["incube"].filename(); | ||
| 351 | - | ||
| 352 | // Get additional binning parameters | 352 | // Get additional binning parameters |
| 353 | double migramax = (*this)["migramax"].real(); | 353 | double migramax = (*this)["migramax"].real(); |
| 354 | int migrabins = (*this)["migrabins"].integer(); | 354 | int migrabins = (*this)["migrabins"].integer(); |
| @@ -356,8 +356,9 @@ void ctedispcube::get_parameters(void) | @@ -356,8 +356,9 @@ void ctedispcube::get_parameters(void) | ||
| 356 | // If the "incube" file name is valid then setup the energy dispersion | 356 | // If the "incube" file name is valid then setup the energy dispersion |
| 357 | // cube from the counts cube. Otherwise create a counts cube from the | 357 | // cube from the counts cube. Otherwise create a counts cube from the |
| 358 | // user parameters | 358 | // user parameters |
| 359 | - GCTAEventCube cube = is_valid_filename(incube) ? GCTAEventCube(incube) | ||
| 360 | - : create_cube(m_obs); | 359 | + GCTAEventCube cube = (*this)["incube"].is_valid() |
| 360 | + ? GCTAEventCube((*this)["incube"].filename()) | ||
| 361 | + : create_cube(m_obs); | ||
| 361 | 362 | ||
| 362 | // Define edisp cube | 363 | // Define edisp cube |
| 363 | m_edispcube = GCTACubeEdisp(cube, migramax, migrabins); | 364 | m_edispcube = GCTACubeEdisp(cube, migramax, migrabins); |
| @@ -366,9 +367,9 @@ void ctedispcube::get_parameters(void) | @@ -366,9 +367,9 @@ void ctedispcube::get_parameters(void) | ||
| 366 | m_addbounds = (*this)["addbounds"].boolean(); | 367 | m_addbounds = (*this)["addbounds"].boolean(); |
| 367 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); | 368 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); |
| 368 | 369 | ||
| 369 | - // Read output filename (if needed) | 370 | + // If needed later, query output filename now |
| 370 | if (read_ahead()) { | 371 | if (read_ahead()) { |
| 371 | - m_outcube = (*this)["outcube"].filename(); | 372 | + (*this)["outcube"].query(); |
| 372 | } | 373 | } |
| 373 | 374 | ||
| 374 | // Write parameters into logger | 375 | // Write parameters into logger |
src/cterror/cterror.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * cterror - Parameter error calculation tool * | 2 | * cterror - Parameter error calculation tool * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2015-2017 by Florent Forest * | 4 | + * copyright (C) 2015-2018 by Florent Forest * |
| 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 * |
| @@ -344,11 +344,11 @@ void cterror::save(void) | @@ -344,11 +344,11 @@ void cterror::save(void) | ||
| 344 | // Write header | 344 | // Write header |
| 345 | log_header1(TERSE, "Save results"); | 345 | log_header1(TERSE, "Save results"); |
| 346 | 346 | ||
| 347 | - // Get output filename | ||
| 348 | - m_outmodel = (*this)["outmodel"].filename(); | ||
| 349 | - | ||
| 350 | // Save only if filename is valid | 347 | // Save only if filename is valid |
| 351 | - if (is_valid_filename(m_outmodel)) { | 348 | + if ((*this)["outmodel"].is_valid()) { |
| 349 | + | ||
| 350 | + // Get output filename | ||
| 351 | + m_outmodel = (*this)["outmodel"].filename(); | ||
| 352 | 352 | ||
| 353 | // Log filename | 353 | // Log filename |
| 354 | log_value(NORMAL, "Model definition file", m_outmodel.url()); | 354 | log_value(NORMAL, "Model definition file", m_outmodel.url()); |
| @@ -472,10 +472,9 @@ void cterror::get_parameters(void) | @@ -472,10 +472,9 @@ void cterror::get_parameters(void) | ||
| 472 | m_max_iter = (*this)["max_iter"].integer(); | 472 | m_max_iter = (*this)["max_iter"].integer(); |
| 473 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); | 473 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); |
| 474 | 474 | ||
| 475 | - // Read ahead parameters that are only needed when the tool gets | ||
| 476 | - // executed | 475 | + // If needed later, query output filename now |
| 477 | if (read_ahead()) { | 476 | if (read_ahead()) { |
| 478 | - m_outmodel = (*this)["outmodel"].filename(); | 477 | + (*this)["outmodel"].query(); |
| 479 | } | 478 | } |
| 480 | 479 | ||
| 481 | // Write parameters into logger | 480 | // Write parameters into logger |
src/ctexpcube/ctexpcube.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctexpcube - Exposure cube generation tool * | 2 | * ctexpcube - Exposure cube generation tool * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2014-2016 by Juergen Knoedlseder * | 4 | + * copyright (C) 2014-2018 by Juergen Knoedlseder * |
| 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 * |
| @@ -256,12 +256,16 @@ void ctexpcube::save(void) | @@ -256,12 +256,16 @@ void ctexpcube::save(void) | ||
| 256 | // Write header into logger | 256 | // Write header into logger |
| 257 | log_header1(TERSE, "Save exposure cube"); | 257 | log_header1(TERSE, "Save exposure cube"); |
| 258 | 258 | ||
| 259 | - // Get exposure cube filename | ||
| 260 | - m_outcube = (*this)["outcube"].filename(); | 259 | + // Save exposure cube if filename is valid and the exposure cube is not |
| 260 | + // empty | ||
| 261 | + if ((*this)["outcube"].is_valid() && !m_expcube.cube().is_empty()) { | ||
| 261 | 262 | ||
| 262 | - // Save exposure cube if filename and the exposure cube are not empty | ||
| 263 | - if (!m_outcube.is_empty() && !m_expcube.cube().is_empty()) { | 263 | + // Get exposure cube filename |
| 264 | + m_outcube = (*this)["outcube"].filename(); | ||
| 265 | + | ||
| 266 | + // Save exposure cube | ||
| 264 | m_expcube.save(m_outcube, clobber()); | 267 | m_expcube.save(m_outcube, clobber()); |
| 268 | + | ||
| 265 | } | 269 | } |
| 266 | 270 | ||
| 267 | // Write into logger what has been done | 271 | // Write into logger what has been done |
| @@ -370,14 +374,12 @@ void ctexpcube::get_parameters(void) | @@ -370,14 +374,12 @@ void ctexpcube::get_parameters(void) | ||
| 370 | // Setup observations from "inobs" parameter. Do not accept counts cubes. | 374 | // Setup observations from "inobs" parameter. Do not accept counts cubes. |
| 371 | setup_observations(m_obs, true, true, false); | 375 | setup_observations(m_obs, true, true, false); |
| 372 | 376 | ||
| 373 | - // Get the incube filename | ||
| 374 | - std::string incube = (*this)["incube"].filename(); | ||
| 375 | - | ||
| 376 | // If the "incube" file name is valid then setup the exposure cube from | 377 | // If the "incube" file name is valid then setup the exposure cube from |
| 377 | // the counts cube. Otherwise create a counts cube from the user | 378 | // the counts cube. Otherwise create a counts cube from the user |
| 378 | // parameters | 379 | // parameters |
| 379 | - GCTAEventCube cube = is_valid_filename(incube) ? GCTAEventCube(incube) | ||
| 380 | - : create_cube(m_obs); | 380 | + GCTAEventCube cube = (*this)["incube"].is_valid() |
| 381 | + ? GCTAEventCube((*this)["incube"].filename()) | ||
| 382 | + : create_cube(m_obs); | ||
| 381 | 383 | ||
| 382 | // Define exposure cube | 384 | // Define exposure cube |
| 383 | m_expcube = GCTACubeExposure(cube); | 385 | m_expcube = GCTACubeExposure(cube); |
| @@ -387,9 +389,9 @@ void ctexpcube::get_parameters(void) | @@ -387,9 +389,9 @@ void ctexpcube::get_parameters(void) | ||
| 387 | m_publish = (*this)["publish"].boolean(); | 389 | m_publish = (*this)["publish"].boolean(); |
| 388 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); | 390 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); |
| 389 | 391 | ||
| 390 | - // Read output filename (if needed) | 392 | + // If needed later, query output filename now |
| 391 | if (read_ahead()) { | 393 | if (read_ahead()) { |
| 392 | - m_outcube = (*this)["outcube"].filename(); | 394 | + (*this)["outcube"].query(); |
| 393 | } | 395 | } |
| 394 | 396 | ||
| 395 | // Write parameters into logger | 397 | // Write parameters into logger |
src/ctlike/ctlike.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctlike - Maximum likelihood fitting tool * | 2 | * ctlike - Maximum likelihood fitting tool * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2017 by Juergen Knoedlseder * | 4 | + * copyright (C) 2010-2018 by Juergen Knoedlseder * |
| 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 * |
| @@ -334,12 +334,11 @@ void ctlike::save(void) | @@ -334,12 +334,11 @@ void ctlike::save(void) | ||
| 334 | // Write header | 334 | // Write header |
| 335 | log_header1(TERSE, "Save results"); | 335 | log_header1(TERSE, "Save results"); |
| 336 | 336 | ||
| 337 | - // Get output filenames | ||
| 338 | - m_outmodel = (*this)["outmodel"].filename(); | ||
| 339 | - m_outcovmat = (*this)["outcovmat"].filename(); | 337 | + // Save model only if filename is valid |
| 338 | + if ((*this)["outmodel"].is_valid()) { | ||
| 340 | 339 | ||
| 341 | - // Save only if filename is valid | ||
| 342 | - if (is_valid_filename(m_outmodel)) { | 340 | + // Get output filename |
| 341 | + m_outmodel = (*this)["outmodel"].filename(); | ||
| 343 | 342 | ||
| 344 | // Log filename | 343 | // Log filename |
| 345 | log_value(NORMAL, "Model definition file", m_outmodel.url()); | 344 | log_value(NORMAL, "Model definition file", m_outmodel.url()); |
| @@ -354,8 +353,11 @@ void ctlike::save(void) | @@ -354,8 +353,11 @@ void ctlike::save(void) | ||
| 354 | log_value(NORMAL, "Model definition file", "NONE"); | 353 | log_value(NORMAL, "Model definition file", "NONE"); |
| 355 | } | 354 | } |
| 356 | 355 | ||
| 357 | - // Save covariance matrix if filename is valid | ||
| 358 | - if (is_valid_filename(m_outcovmat)) { | 356 | + // Save covariance matrix only if filename is valid |
| 357 | + if ((*this)["outcovmat"].is_valid()) { | ||
| 358 | + | ||
| 359 | + // Get output filenames | ||
| 360 | + m_outcovmat = (*this)["outcovmat"].filename(); | ||
| 359 | 361 | ||
| 360 | // Log filename | 362 | // Log filename |
| 361 | log_value(NORMAL, "Covariance matrix file", m_outcovmat.url()); | 363 | log_value(NORMAL, "Covariance matrix file", m_outcovmat.url()); |
| @@ -406,11 +408,10 @@ void ctlike::get_parameters(void) | @@ -406,11 +408,10 @@ void ctlike::get_parameters(void) | ||
| 406 | m_fix_spat_for_ts = (*this)["fix_spat_for_ts"].boolean(); | 408 | m_fix_spat_for_ts = (*this)["fix_spat_for_ts"].boolean(); |
| 407 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); | 409 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); |
| 408 | 410 | ||
| 409 | - // Optionally read ahead parameters so that they get correctly | ||
| 410 | - // dumped into the log file | 411 | + // If needed later, query output filenames now |
| 411 | if (read_ahead()) { | 412 | if (read_ahead()) { |
| 412 | - m_outmodel = (*this)["outmodel"].filename(); | ||
| 413 | - m_outcovmat = (*this)["outcovmat"].filename(); | 413 | + (*this)["outmodel"].query(); |
| 414 | + (*this)["outcovmat"].query(); | ||
| 414 | } | 415 | } |
| 415 | 416 | ||
| 416 | // Set optimizer logger | 417 | // Set optimizer logger |
src/ctmapcube/ctmapcube.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctmapcube - Map cube generation tool * | 2 | * ctmapcube - Map cube generation tool * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2017 by Juergen Knoedlseder * | 4 | + * copyright (C) 2016-2018 by Juergen Knoedlseder * |
| 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 * |
| @@ -222,12 +222,15 @@ void ctmapcube::save(void) | @@ -222,12 +222,15 @@ void ctmapcube::save(void) | ||
| 222 | // Write header | 222 | // Write header |
| 223 | log_header1(TERSE, "Save map cube"); | 223 | log_header1(TERSE, "Save map cube"); |
| 224 | 224 | ||
| 225 | - // Get map cube filename | ||
| 226 | - m_outcube = (*this)["outcube"].filename(); | 225 | + // Save map cube if filename is valid and the map cube is not empty |
| 226 | + if ((*this)["outcube"].is_valid() && !m_cube.cube().is_empty()) { | ||
| 227 | 227 | ||
| 228 | - // Save map cube if filename and the map cube are not empty | ||
| 229 | - if (!m_outcube.is_empty() && !m_cube.cube().is_empty()) { | 228 | + // Get map cube filename |
| 229 | + m_outcube = (*this)["outcube"].filename(); | ||
| 230 | + | ||
| 231 | + // Save map cube | ||
| 230 | m_cube.save(m_outcube, clobber()); | 232 | m_cube.save(m_outcube, clobber()); |
| 233 | + | ||
| 231 | } | 234 | } |
| 232 | 235 | ||
| 233 | // Write into logger what has been done | 236 | // Write into logger what has been done |
| @@ -365,9 +368,9 @@ void ctmapcube::get_parameters(void) | @@ -365,9 +368,9 @@ void ctmapcube::get_parameters(void) | ||
| 365 | m_publish = (*this)["publish"].boolean(); | 368 | m_publish = (*this)["publish"].boolean(); |
| 366 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); | 369 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); |
| 367 | 370 | ||
| 368 | - // Read optionally output cube filenames | 371 | + // If needed later, query output filename now |
| 369 | if (read_ahead()) { | 372 | if (read_ahead()) { |
| 370 | - m_outcube = (*this)["outcube"].filename(); | 373 | + (*this)["outcube"].query(); |
| 371 | } | 374 | } |
| 372 | 375 | ||
| 373 | // Allocate map cube | 376 | // Allocate map cube |
src/ctmodel/ctmodel.cpp
| @@ -313,11 +313,13 @@ void ctmodel::save(void) | @@ -313,11 +313,13 @@ void ctmodel::save(void) | ||
| 313 | // Write header | 313 | // Write header |
| 314 | log_header1(TERSE, "Save model cube"); | 314 | log_header1(TERSE, "Save model cube"); |
| 315 | 315 | ||
| 316 | - // Get model cube filename | ||
| 317 | - m_outcube = (*this)["outcube"].filename(); | 316 | + // Save only if filename is valid and cube has some size |
| 317 | + if ((*this)["outcube"].is_valid() && m_cube.size() > 0) { | ||
| 318 | 318 | ||
| 319 | - // Save only if filename is non-empty and cube has some size | ||
| 320 | - if (!m_outcube.is_empty() && m_cube.size() > 0) { | 319 | + // Get model cube filename |
| 320 | + m_outcube = (*this)["outcube"].filename(); | ||
| 321 | + | ||
| 322 | + // Save cube | ||
| 321 | m_cube.save(m_outcube, clobber()); | 323 | m_cube.save(m_outcube, clobber()); |
| 322 | } | 324 | } |
| 323 | 325 | ||
| @@ -533,13 +535,13 @@ void ctmodel::get_parameters(void) | @@ -533,13 +535,13 @@ void ctmodel::get_parameters(void) | ||
| 533 | // should create it from scratch using the task parameters | 535 | // should create it from scratch using the task parameters |
| 534 | if (!m_has_cube) { | 536 | if (!m_has_cube) { |
| 535 | 537 | ||
| 536 | - // Read cube definition file | ||
| 537 | - std::string incube = (*this)["incube"].filename(); | ||
| 538 | - | ||
| 539 | // If the cube filename is valid the load the cube and set all cube | 538 | // If the cube filename is valid the load the cube and set all cube |
| 540 | // bins to zero | 539 | // bins to zero |
| 541 | if ((*this)["incube"].is_valid()) { | 540 | if ((*this)["incube"].is_valid()) { |
| 542 | 541 | ||
| 542 | + // Get cube definition filename | ||
| 543 | + std::string incube = (*this)["incube"].filename(); | ||
| 544 | + | ||
| 543 | // Load cube from given file | 545 | // Load cube from given file |
| 544 | m_cube.load(incube); | 546 | m_cube.load(incube); |
| 545 | 547 | ||
| @@ -564,9 +566,9 @@ void ctmodel::get_parameters(void) | @@ -564,9 +566,9 @@ void ctmodel::get_parameters(void) | ||
| 564 | m_publish = (*this)["publish"].boolean(); | 566 | m_publish = (*this)["publish"].boolean(); |
| 565 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); | 567 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); |
| 566 | 568 | ||
| 567 | - // Read optionally output cube filenames | 569 | + // If needed later, query output filename now |
| 568 | if (read_ahead()) { | 570 | if (read_ahead()) { |
| 569 | - m_outcube = (*this)["outcube"].filename(); | 571 | + (*this)["outcube"].query(); |
| 570 | } | 572 | } |
| 571 | 573 | ||
| 572 | // If cube should be appended to first observation then do that now. | 574 | // If cube should be appended to first observation then do that now. |
| @@ -621,29 +623,26 @@ void ctmodel::get_parameters(void) | @@ -621,29 +623,26 @@ void ctmodel::get_parameters(void) | ||
| 621 | ***************************************************************************/ | 623 | ***************************************************************************/ |
| 622 | void ctmodel::get_obs(void) | 624 | void ctmodel::get_obs(void) |
| 623 | { | 625 | { |
| 624 | - // Get the filename from the input parameters | ||
| 625 | - std::string filename = (*this)["inobs"].filename(); | ||
| 626 | - | ||
| 627 | // If no observation definition file has been specified then read all | 626 | // If no observation definition file has been specified then read all |
| 628 | // parameters that are necessary to create an observation from scratch | 627 | // parameters that are necessary to create an observation from scratch |
| 629 | if ((*this)["inobs"].is_undefined()) { | 628 | if ((*this)["inobs"].is_undefined()) { |
| 630 | 629 | ||
| 631 | - // Get response cube filenames | ||
| 632 | - GFilename edispcube; | ||
| 633 | - bool query_edisp = (*this)["edisp"].boolean(); | ||
| 634 | - std::string expcube = (*this)["expcube"].filename(); | ||
| 635 | - std::string psfcube = (*this)["psfcube"].filename(); | ||
| 636 | - if (query_edisp) { | ||
| 637 | - edispcube = (*this)["edispcube"].filename(); | ||
| 638 | - } | ||
| 639 | - std::string bkgcube = (*this)["bkgcube"].filename(); | ||
| 640 | - | ||
| 641 | // If the filenames are valid then build an observation from cube | 630 | // If the filenames are valid then build an observation from cube |
| 642 | // response information | 631 | // response information |
| 643 | if ((*this)["expcube"].is_valid() && | 632 | if ((*this)["expcube"].is_valid() && |
| 644 | (*this)["psfcube"].is_valid() && | 633 | (*this)["psfcube"].is_valid() && |
| 645 | (*this)["bkgcube"].is_valid()) { | 634 | (*this)["bkgcube"].is_valid()) { |
| 646 | 635 | ||
| 636 | + // Get response cube filenames | ||
| 637 | + GFilename edispcube; | ||
| 638 | + bool query_edisp = (*this)["edisp"].boolean(); | ||
| 639 | + GFilename expcube = (*this)["expcube"].filename(); | ||
| 640 | + GFilename psfcube = (*this)["psfcube"].filename(); | ||
| 641 | + if (query_edisp && (*this)["edispcube"].is_valid()) { | ||
| 642 | + edispcube = (*this)["edispcube"].filename(); | ||
| 643 | + } | ||
| 644 | + GFilename bkgcube = (*this)["bkgcube"].filename(); | ||
| 645 | + | ||
| 647 | // Get exposure, PSF and background cubes | 646 | // Get exposure, PSF and background cubes |
| 648 | GCTACubeExposure exposure(expcube); | 647 | GCTACubeExposure exposure(expcube); |
| 649 | GCTACubePsf psf(psfcube); | 648 | GCTACubePsf psf(psfcube); |
| @@ -721,6 +720,9 @@ void ctmodel::get_obs(void) | @@ -721,6 +720,9 @@ void ctmodel::get_obs(void) | ||
| 721 | // ... otherwise we have a file name | 720 | // ... otherwise we have a file name |
| 722 | else { | 721 | else { |
| 723 | 722 | ||
| 723 | + // Get the filename from the input parameters | ||
| 724 | + std::string filename = (*this)["inobs"].filename(); | ||
| 725 | + | ||
| 724 | // If file is a FITS file then create an empty CTA observation | 726 | // If file is a FITS file then create an empty CTA observation |
| 725 | // and load file into observation | 727 | // and load file into observation |
| 726 | if (GFilename(filename).is_fits()) { | 728 | if (GFilename(filename).is_fits()) { |
src/ctobssim/ctobssim.cpp
| @@ -643,11 +643,10 @@ void ctobssim::get_parameters(void) | @@ -643,11 +643,10 @@ void ctobssim::get_parameters(void) | ||
| 643 | m_max_rate = (*this)["maxrate"].real(); | 643 | m_max_rate = (*this)["maxrate"].real(); |
| 644 | m_startindex = (*this)["startindex"].integer(); | 644 | m_startindex = (*this)["startindex"].integer(); |
| 645 | 645 | ||
| 646 | - // Optionally read ahead parameters so that they get correctly | ||
| 647 | - // dumped into the log file | 646 | + // If needed later, query output filename and prefix now |
| 648 | if (read_ahead()) { | 647 | if (read_ahead()) { |
| 649 | - m_outevents = (*this)["outevents"].filename(); | ||
| 650 | - m_prefix = (*this)["prefix"].string(); | 648 | + (*this)["outevents"].query(); |
| 649 | + (*this)["prefix"].query(); | ||
| 651 | } | 650 | } |
| 652 | 651 | ||
| 653 | // Initialise random number generators. We initialise here one random | 652 | // Initialise random number generators. We initialise here one random |
src/ctphase/ctphase.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctphase - Append phase information to CTA events file * | 2 | * ctphase - Append phase information to CTA events file * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2017 by Joshua Cardenzana * | 4 | + * copyright (C) 2017-2018 by Joshua Cardenzana * |
| 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 * |
| @@ -409,9 +409,8 @@ void ctphase::get_parameters(void) | @@ -409,9 +409,8 @@ void ctphase::get_parameters(void) | ||
| 409 | // from a model definiton XML file specified by the "inmodel" parameter. | 409 | // from a model definiton XML file specified by the "inmodel" parameter. |
| 410 | // The model is only loaded of the file is valid. | 410 | // The model is only loaded of the file is valid. |
| 411 | if (m_obs.models().size() == 0) { | 411 | if (m_obs.models().size() == 0) { |
| 412 | - GFilename inmodel = (*this)["inmodel"].filename(); | ||
| 413 | - if (is_valid_filename(inmodel)) { | ||
| 414 | - m_obs.models(inmodel); | 412 | + if ((*this)["inmodel"].is_valid()) { |
| 413 | + m_obs.models((*this)["inmodel"].filename()); | ||
| 415 | } | 414 | } |
| 416 | } | 415 | } |
| 417 | 416 | ||
| @@ -481,11 +480,10 @@ void ctphase::get_parameters(void) | @@ -481,11 +480,10 @@ void ctphase::get_parameters(void) | ||
| 481 | 480 | ||
| 482 | } // endelse: read phase curve information from User parameters | 481 | } // endelse: read phase curve information from User parameters |
| 483 | 482 | ||
| 484 | - // Optionally read ahead parameters so that they get correctly | ||
| 485 | - // dumped into the log file | 483 | + // If needed later, query output filename and prefix now |
| 486 | if (read_ahead()) { | 484 | if (read_ahead()) { |
| 487 | - (*this)["outobs"].filename(); | ||
| 488 | - (*this)["prefix"].string(); | 485 | + (*this)["outobs"].query(); |
| 486 | + (*this)["prefix"].query(); | ||
| 489 | } | 487 | } |
| 490 | 488 | ||
| 491 | // Write parameters into logger | 489 | // Write parameters into logger |
src/ctprob/ctprob.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctprob - Computes event probability for a given model * | 2 | * ctprob - Computes event probability for a given model * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2017 by Leonardo Di Venere * | 4 | + * copyright (C) 2017-2018 by Leonardo Di Venere * |
| 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 * |
| @@ -433,11 +433,10 @@ void ctprob::get_parameters(void) | @@ -433,11 +433,10 @@ void ctprob::get_parameters(void) | ||
| 433 | m_publish = (*this)["publish"].boolean(); | 433 | m_publish = (*this)["publish"].boolean(); |
| 434 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); | 434 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); |
| 435 | 435 | ||
| 436 | - // Optionally read ahead parameters so that they get correctly | ||
| 437 | - // dumped into the log file | 436 | + // If needed later, query output filename and prefix now |
| 438 | if (read_ahead()) { | 437 | if (read_ahead()) { |
| 439 | - (*this)["outobs"].filename(); | ||
| 440 | - (*this)["prefix"].string(); | 438 | + (*this)["outobs"].query(); |
| 439 | + (*this)["prefix"].query(); | ||
| 441 | } | 440 | } |
| 442 | 441 | ||
| 443 | // Write parameters into logger | 442 | // Write parameters into logger |
src/ctpsfcube/ctpsfcube.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctpsfcube - PSF cube generation tool * | 2 | * ctpsfcube - PSF cube generation tool * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2014-2017 by Chia-Chun Lu * | 4 | + * copyright (C) 2014-2018 by Chia-Chun Lu * |
| 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 * |
| @@ -248,12 +248,15 @@ void ctpsfcube::save(void) | @@ -248,12 +248,15 @@ void ctpsfcube::save(void) | ||
| 248 | // Write header into logger | 248 | // Write header into logger |
| 249 | log_header1(TERSE, "Save PSF cube"); | 249 | log_header1(TERSE, "Save PSF cube"); |
| 250 | 250 | ||
| 251 | - // Get output filename | ||
| 252 | - m_outcube = (*this)["outcube"].filename(); | 251 | + // Save PSF cube if filename is valid and the PSF cube is not empty |
| 252 | + if ((*this)["outcube"].is_valid() && !m_psfcube.cube().is_empty()) { | ||
| 253 | 253 | ||
| 254 | - // Save PSF cube if filename and the PSF cube are not empty | ||
| 255 | - if (!m_outcube.is_empty() && !m_psfcube.cube().is_empty()) { | 254 | + // Get output filename |
| 255 | + m_outcube = (*this)["outcube"].filename(); | ||
| 256 | + | ||
| 257 | + // Save PSF cube | ||
| 256 | m_psfcube.save(m_outcube, clobber()); | 258 | m_psfcube.save(m_outcube, clobber()); |
| 259 | + | ||
| 257 | } | 260 | } |
| 258 | 261 | ||
| 259 | // Write into logger what has been done | 262 | // Write into logger what has been done |
| @@ -333,17 +336,15 @@ void ctpsfcube::get_parameters(void) | @@ -333,17 +336,15 @@ void ctpsfcube::get_parameters(void) | ||
| 333 | // Setup observations from "inobs" parameter. Do not accept counts cubes. | 336 | // Setup observations from "inobs" parameter. Do not accept counts cubes. |
| 334 | setup_observations(m_obs, true, true, false); | 337 | setup_observations(m_obs, true, true, false); |
| 335 | 338 | ||
| 336 | - // Get the incube filename | ||
| 337 | - std::string incube = (*this)["incube"].filename(); | ||
| 338 | - | ||
| 339 | // Get additional binning parameters | 339 | // Get additional binning parameters |
| 340 | double amax = (*this)["amax"].real(); | 340 | double amax = (*this)["amax"].real(); |
| 341 | int anumbins = (*this)["anumbins"].integer(); | 341 | int anumbins = (*this)["anumbins"].integer(); |
| 342 | 342 | ||
| 343 | // If the "incube" file name is valid then setup the PSF cube from the | 343 | // If the "incube" file name is valid then setup the PSF cube from the |
| 344 | // counts cube. Otherwise create a counts cube from the user parameters | 344 | // counts cube. Otherwise create a counts cube from the user parameters |
| 345 | - GCTAEventCube cube = is_valid_filename(incube) ? GCTAEventCube(incube) | ||
| 346 | - : create_cube(m_obs); | 345 | + GCTAEventCube cube = (*this)["incube"].is_valid() |
| 346 | + ? GCTAEventCube((*this)["incube"].filename()) | ||
| 347 | + : create_cube(m_obs); | ||
| 347 | 348 | ||
| 348 | // Define PSF cube | 349 | // Define PSF cube |
| 349 | m_psfcube = GCTACubePsf(cube, amax, anumbins); | 350 | m_psfcube = GCTACubePsf(cube, amax, anumbins); |
| @@ -352,9 +353,9 @@ void ctpsfcube::get_parameters(void) | @@ -352,9 +353,9 @@ void ctpsfcube::get_parameters(void) | ||
| 352 | m_addbounds = (*this)["addbounds"].boolean(); | 353 | m_addbounds = (*this)["addbounds"].boolean(); |
| 353 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); | 354 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); |
| 354 | 355 | ||
| 355 | - // Read output filename (if needed) | 356 | + // If needed later, query output filename now |
| 356 | if (read_ahead()) { | 357 | if (read_ahead()) { |
| 357 | - m_outcube = (*this)["outcube"].filename(); | 358 | + (*this)["outcube"].query(); |
| 358 | } | 359 | } |
| 359 | 360 | ||
| 360 | // Write parameters into logger | 361 | // Write parameters into logger |
src/ctselect/ctselect.cpp
| @@ -647,11 +647,10 @@ void ctselect::get_parameters(void) | @@ -647,11 +647,10 @@ void ctselect::get_parameters(void) | ||
| 647 | m_usethres = (*this)["usethres"].string(); | 647 | m_usethres = (*this)["usethres"].string(); |
| 648 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); | 648 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); |
| 649 | 649 | ||
| 650 | - // Optionally read ahead parameters so that they get correctly | ||
| 651 | - // dumped into the log file | 650 | + // If needed later, query output filename and prefix now |
| 652 | if (read_ahead()) { | 651 | if (read_ahead()) { |
| 653 | - m_outobs = (*this)["outobs"].filename(); | ||
| 654 | - (*this)["prefix"].string(); | 652 | + (*this)["outobs"].query(); |
| 653 | + (*this)["prefix"].query(); | ||
| 655 | } | 654 | } |
| 656 | 655 | ||
| 657 | // Set time interval with input times given in CTA reference | 656 | // Set time interval with input times given in CTA reference |
src/ctskymap/ctskymap.cpp
| @@ -255,11 +255,11 @@ void ctskymap::save(void) | @@ -255,11 +255,11 @@ void ctskymap::save(void) | ||
| 255 | // Write header | 255 | // Write header |
| 256 | log_header1(TERSE, "Save sky map"); | 256 | log_header1(TERSE, "Save sky map"); |
| 257 | 257 | ||
| 258 | - // Get sky map filename | ||
| 259 | - m_outmap = (*this)["outmap"].filename(); | 258 | + // Save sky map if filename is valid and sky map is not empty |
| 259 | + if ((*this)["outmap"].is_valid() && !m_skymap.is_empty()) { | ||
| 260 | 260 | ||
| 261 | - // Save sky map if filename and the map are not empty | ||
| 262 | - if (!m_outmap.is_empty() && !m_skymap.is_empty()) { | 261 | + // Get sky map filename |
| 262 | + m_outmap = (*this)["outmap"].filename(); | ||
| 263 | 263 | ||
| 264 | // Create empty FITS file | 264 | // Create empty FITS file |
| 265 | GFits fits; | 265 | GFits fits; |
| @@ -453,9 +453,15 @@ void ctskymap::get_parameters(void) | @@ -453,9 +453,15 @@ void ctskymap::get_parameters(void) | ||
| 453 | 453 | ||
| 454 | // If an input map was specified then extract try loading the COUNTS | 454 | // If an input map was specified then extract try loading the COUNTS |
| 455 | // and ACCEPTANCE extensions from that file | 455 | // and ACCEPTANCE extensions from that file |
| 456 | - GFilename inmap = (*this)["inmap"].filename(); | ||
| 457 | - if (inmap != "NONE") { | 456 | + if ((*this)["inmap"].is_valid()) { |
| 457 | + | ||
| 458 | + // Read inmap filename | ||
| 459 | + GFilename inmap = (*this)["inmap"].filename(); | ||
| 460 | + | ||
| 461 | + // Open file | ||
| 458 | GFits fits(inmap); | 462 | GFits fits(inmap); |
| 463 | + | ||
| 464 | + // Continue only if required extensions exist | ||
| 459 | if (fits.contains("COUNTS") && fits.contains("ACCEPTANCE")) { | 465 | if (fits.contains("COUNTS") && fits.contains("ACCEPTANCE")) { |
| 460 | 466 | ||
| 461 | // Get HDUs | 467 | // Get HDUs |
| @@ -508,7 +514,7 @@ void ctskymap::get_parameters(void) | @@ -508,7 +514,7 @@ void ctskymap::get_parameters(void) | ||
| 508 | // Get RING background parameters | 514 | // Get RING background parameters |
| 509 | if (m_bkgsubtract == "RING") { | 515 | if (m_bkgsubtract == "RING") { |
| 510 | 516 | ||
| 511 | - // Get parameters | 517 | + // Get (or query) parameters |
| 512 | m_roiradius = (*this)["roiradius"].real(); | 518 | m_roiradius = (*this)["roiradius"].real(); |
| 513 | m_inradius = (*this)["inradius"].real(); | 519 | m_inradius = (*this)["inradius"].real(); |
| 514 | m_outradius = (*this)["outradius"].real(); | 520 | m_outradius = (*this)["outradius"].real(); |
| @@ -516,7 +522,7 @@ void ctskymap::get_parameters(void) | @@ -516,7 +522,7 @@ void ctskymap::get_parameters(void) | ||
| 516 | if (m_iterations > 0) { | 522 | if (m_iterations > 0) { |
| 517 | m_threshold = (*this)["threshold"].real(); | 523 | m_threshold = (*this)["threshold"].real(); |
| 518 | } | 524 | } |
| 519 | - m_inexclusion = (*this)["inexclusion"].filename(); | 525 | + (*this)["inexclusion"].query(); |
| 520 | m_usefft = (*this)["usefft"].boolean(); | 526 | m_usefft = (*this)["usefft"].boolean(); |
| 521 | 527 | ||
| 522 | // Make sure that (roiradius < inradius < outradius) | 528 | // Make sure that (roiradius < inradius < outradius) |
| @@ -541,9 +547,9 @@ void ctskymap::get_parameters(void) | @@ -541,9 +547,9 @@ void ctskymap::get_parameters(void) | ||
| 541 | m_publish = (*this)["publish"].boolean(); | 547 | m_publish = (*this)["publish"].boolean(); |
| 542 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); | 548 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); |
| 543 | 549 | ||
| 544 | - // Read ahead parameters | 550 | + // If needed later, query output filename now |
| 545 | if (read_ahead()) { | 551 | if (read_ahead()) { |
| 546 | - m_outmap = (*this)["outmap"].filename(); | 552 | + (*this)["outmap"].query(); |
| 547 | } | 553 | } |
| 548 | 554 | ||
| 549 | // Write parameters into logger | 555 | // Write parameters into logger |
| @@ -570,7 +576,7 @@ void ctskymap::setup_maps(void) | @@ -570,7 +576,7 @@ void ctskymap::setup_maps(void) | ||
| 570 | if (m_bkgsubtract != "NONE") { | 576 | if (m_bkgsubtract != "NONE") { |
| 571 | 577 | ||
| 572 | // Setup the exclusions map | 578 | // Setup the exclusions map |
| 573 | - setup_exclusion_map(m_inexclusion); | 579 | + setup_exclusion_map(); |
| 574 | 580 | ||
| 575 | // Cache the pixel solid angles and sky directions | 581 | // Cache the pixel solid angles and sky directions |
| 576 | m_solidangle.reserve(m_counts.npix()); | 582 | m_solidangle.reserve(m_counts.npix()); |
| @@ -603,7 +609,7 @@ void ctskymap::setup_maps(void) | @@ -603,7 +609,7 @@ void ctskymap::setup_maps(void) | ||
| 603 | * background estimation. Pixels with values different from 0 will be | 609 | * background estimation. Pixels with values different from 0 will be |
| 604 | * excluded. | 610 | * excluded. |
| 605 | ***************************************************************************/ | 611 | ***************************************************************************/ |
| 606 | -void ctskymap::setup_exclusion_map(const GFilename& filename) | 612 | +void ctskymap::setup_exclusion_map(void) |
| 607 | { | 613 | { |
| 608 | // Create exlusion map | 614 | // Create exlusion map |
| 609 | m_exclmap = m_counts; | 615 | m_exclmap = m_counts; |
| @@ -611,15 +617,18 @@ void ctskymap::setup_exclusion_map(const GFilename& filename) | @@ -611,15 +617,18 @@ void ctskymap::setup_exclusion_map(const GFilename& filename) | ||
| 611 | // Set all pixels to 0 (no pixel excluded) | 617 | // Set all pixels to 0 (no pixel excluded) |
| 612 | m_exclmap = 0.0; | 618 | m_exclmap = 0.0; |
| 613 | 619 | ||
| 614 | - // Make sure the exclusions filename is valid | ||
| 615 | - if (is_valid_filename(filename)) { | 620 | + // Generate map only if exclusion map filename is valid |
| 621 | + if ((*this)["inexclusion"].is_valid()) { | ||
| 622 | + | ||
| 623 | + // Get exclusion map filename | ||
| 624 | + m_inexclusion = (*this)["inexclusion"].filename(); | ||
| 616 | 625 | ||
| 617 | // Fill the exclusions based on the regions supplied | 626 | // Fill the exclusions based on the regions supplied |
| 618 | - if (filename.is_fits()) { | ||
| 619 | - setup_exclusion_map_fits(filename); | 627 | + if (m_inexclusion.is_fits()) { |
| 628 | + setup_exclusion_map_fits(m_inexclusion); | ||
| 620 | } | 629 | } |
| 621 | else { | 630 | else { |
| 622 | - setup_exclusion_map_region(filename); | 631 | + setup_exclusion_map_region(m_inexclusion); |
| 623 | } | 632 | } |
| 624 | 633 | ||
| 625 | } // endif: filename was valid | 634 | } // endif: filename was valid |
src/ctskymap/ctskymap.hpp
| @@ -69,7 +69,7 @@ protected: | @@ -69,7 +69,7 @@ protected: | ||
| 69 | void free_members(void); | 69 | void free_members(void); |
| 70 | void get_parameters(void); | 70 | void get_parameters(void); |
| 71 | void setup_maps(void); | 71 | void setup_maps(void); |
| 72 | - void setup_exclusion_map(const GFilename& filename); | 72 | + void setup_exclusion_map(void); |
| 73 | void setup_exclusion_map_fits(const GFilename& filename); | 73 | void setup_exclusion_map_fits(const GFilename& filename); |
| 74 | void setup_exclusion_map_region(const GFilename& filename); | 74 | void setup_exclusion_map_region(const GFilename& filename); |
| 75 | void fill_maps(void); | 75 | void fill_maps(void); |
src/cttsmap/cttsmap.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * cttsmap - TS map calculation tool * | 2 | * cttsmap - TS map calculation tool * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2014-2017 by Michael Mayer * | 4 | + * copyright (C) 2014-2018 by Michael Mayer * |
| 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 * |
| @@ -370,12 +370,12 @@ void cttsmap::save(void) | @@ -370,12 +370,12 @@ void cttsmap::save(void) | ||
| 370 | // Write header | 370 | // Write header |
| 371 | log_header1(TERSE, "Save TS map"); | 371 | log_header1(TERSE, "Save TS map"); |
| 372 | 372 | ||
| 373 | - // Get TS map filename | ||
| 374 | - m_outmap = (*this)["outmap"].filename(); | ||
| 375 | - | ||
| 376 | - // Save only if filename is non-empty | ||
| 377 | - if (!m_outmap.is_empty() && !m_tsmap.is_empty()) { | 373 | + // Save only if filename is valid and TS map is not empty |
| 374 | + if ((*this)["outmap"].is_valid() && !m_tsmap.is_empty()) { | ||
| 378 | 375 | ||
| 376 | + // Get TS map filename | ||
| 377 | + m_outmap = (*this)["outmap"].filename(); | ||
| 378 | + | ||
| 379 | // Create fits file | 379 | // Create fits file |
| 380 | GFits fits; | 380 | GFits fits; |
| 381 | 381 | ||
| @@ -578,10 +578,9 @@ void cttsmap::get_parameters(void) | @@ -578,10 +578,9 @@ void cttsmap::get_parameters(void) | ||
| 578 | m_logL0 = (*this)["logL0"].real(); | 578 | m_logL0 = (*this)["logL0"].real(); |
| 579 | m_publish = (*this)["publish"].boolean(); | 579 | m_publish = (*this)["publish"].boolean(); |
| 580 | 580 | ||
| 581 | - // Optionally read ahead parameters so that they get correctly | ||
| 582 | - // dumped into the log file | 581 | + // If needed later, query output filename now |
| 583 | if (read_ahead()) { | 582 | if (read_ahead()) { |
| 584 | - m_outmap = (*this)["outmap"].filename(); | 583 | + (*this)["outmap"].query(); |
| 585 | } | 584 | } |
| 586 | 585 | ||
| 587 | // Write parameters into logger | 586 | // Write parameters into logger |
src/support/ctool.cpp
| @@ -86,8 +86,8 @@ | @@ -86,8 +86,8 @@ | ||
| 86 | * | 86 | * |
| 87 | * This constructor should be used for using a ctool from Python. | 87 | * This constructor should be used for using a ctool from Python. |
| 88 | ***************************************************************************/ | 88 | ***************************************************************************/ |
| 89 | -ctool::ctool(const std::string& name, const std::string& version) : | ||
| 90 | - GApplication(name, version) | 89 | +ctool::ctool(const std::string& name, |
| 90 | + const std::string& version) : GApplication(name, version) | ||
| 91 | { | 91 | { |
| 92 | // Initialise members | 92 | // Initialise members |
| 93 | init_members(); | 93 | init_members(); |
| @@ -115,9 +115,10 @@ ctool::ctool(const std::string& name, const std::string& version) : | @@ -115,9 +115,10 @@ ctool::ctool(const std::string& name, const std::string& version) : | ||
| 115 | * about the usage of the ctool will be shown in the console and the ctool | 115 | * about the usage of the ctool will be shown in the console and the ctool |
| 116 | * will exit. No log file will be opened in that case. | 116 | * will exit. No log file will be opened in that case. |
| 117 | ***************************************************************************/ | 117 | ***************************************************************************/ |
| 118 | -ctool::ctool(const std::string& name, const std::string& version, | ||
| 119 | - int argc, char *argv[]) : | ||
| 120 | - GApplication(name, version, argc, argv) | 118 | +ctool::ctool(const std::string& name, |
| 119 | + const std::string& version, | ||
| 120 | + int argc, | ||
| 121 | + char* argv[]) : GApplication(name, version, argc, argv) | ||
| 121 | { | 122 | { |
| 122 | // Catch --help option before doing anything else | 123 | // Catch --help option before doing anything else |
| 123 | if (need_help()) { | 124 | if (need_help()) { |
| @@ -179,8 +180,9 @@ ctool::~ctool(void) | @@ -179,8 +180,9 @@ ctool::~ctool(void) | ||
| 179 | * @brief Assignment operator | 180 | * @brief Assignment operator |
| 180 | * | 181 | * |
| 181 | * @param[in] app Application. | 182 | * @param[in] app Application. |
| 183 | + * @return Application. | ||
| 182 | * | 184 | * |
| 183 | - * Assigns one ctool to another. | 185 | + * Assigns one ctool application to another. |
| 184 | ***************************************************************************/ | 186 | ***************************************************************************/ |
| 185 | ctool& ctool::operator=(const ctool& app) | 187 | ctool& ctool::operator=(const ctool& app) |
| 186 | { | 188 | { |
| @@ -250,11 +252,6 @@ void ctool::init_members(void) | @@ -250,11 +252,6 @@ void ctool::init_members(void) | ||
| 250 | m_read_ahead = false; | 252 | m_read_ahead = false; |
| 251 | m_use_xml = false; | 253 | m_use_xml = false; |
| 252 | 254 | ||
| 253 | - // Set CTA time reference. G_CTA_MJDREF is the CTA reference MJD, | ||
| 254 | - // which is defined in GCTALib.hpp. This is somehow a kluge. We need | ||
| 255 | - // a better mechanism to implement the CTA reference MJD. | ||
| 256 | - //m_cta_ref.set(G_CTA_MJDREF, "s", "TT", "LOCAL"); | ||
| 257 | - | ||
| 258 | // Set logger properties | 255 | // Set logger properties |
| 259 | log.date(true); | 256 | log.date(true); |
| 260 | 257 | ||
| @@ -276,7 +273,6 @@ void ctool::copy_members(const ctool& app) | @@ -276,7 +273,6 @@ void ctool::copy_members(const ctool& app) | ||
| 276 | // Copy members | 273 | // Copy members |
| 277 | m_read_ahead = app.m_read_ahead; | 274 | m_read_ahead = app.m_read_ahead; |
| 278 | m_use_xml = app.m_use_xml; | 275 | m_use_xml = app.m_use_xml; |
| 279 | - //m_cta_ref = app.m_cta_ref; | ||
| 280 | 276 | ||
| 281 | // Return | 277 | // Return |
| 282 | return; | 278 | return; |
| @@ -346,19 +342,20 @@ void ctool::setup_observations(GObservations& obs, | @@ -346,19 +342,20 @@ void ctool::setup_observations(GObservations& obs, | ||
| 346 | // Load observations if there are none in the container | 342 | // Load observations if there are none in the container |
| 347 | if (obs.size() == 0) { | 343 | if (obs.size() == 0) { |
| 348 | 344 | ||
| 349 | - // Get the filename from the "inobs" parameter | ||
| 350 | - GFilename filename = (*this)["inobs"].filename(); | ||
| 351 | - | ||
| 352 | // Throw an exception if the "inobs" parameter is not a valid | 345 | // Throw an exception if the "inobs" parameter is not a valid |
| 353 | // filename | 346 | // filename |
| 354 | - if (!is_valid_filename(filename)) { | ||
| 355 | - std::string msg = "The \"inobs\" parameter \""+filename.url()+ | 347 | + if ((*this)["inobs"].is_undefined()) { |
| 348 | + std::string msg = "The \"inobs\" parameter \""+ | ||
| 349 | + (*this)["inobs"].current_value()+ | ||
| 356 | "\" is not a valid filename. Please specify " | 350 | "\" is not a valid filename. Please specify " |
| 357 | "a valid event list, counts cube or " | 351 | "a valid event list, counts cube or " |
| 358 | "observation definition XML file."; | 352 | "observation definition XML file."; |
| 359 | throw GException::invalid_value(G_SETUP_OBSERVATION, msg); | 353 | throw GException::invalid_value(G_SETUP_OBSERVATION, msg); |
| 360 | } | 354 | } |
| 361 | 355 | ||
| 356 | + // Get the filename from the "inobs" parameter | ||
| 357 | + GFilename filename = (*this)["inobs"].filename(); | ||
| 358 | + | ||
| 362 | // If file does not exist then throw an exceptions | 359 | // If file does not exist then throw an exceptions |
| 363 | if (!filename.exists()) { | 360 | if (!filename.exists()) { |
| 364 | std::string msg = "The \"inobs\" parameter \""+filename.url()+ | 361 | std::string msg = "The \"inobs\" parameter \""+filename.url()+ |
| @@ -462,18 +459,19 @@ void ctool::setup_models(GObservations& obs, | @@ -462,18 +459,19 @@ void ctool::setup_models(GObservations& obs, | ||
| 462 | // observation container | 459 | // observation container |
| 463 | if (obs.models().size() == 0) { | 460 | if (obs.models().size() == 0) { |
| 464 | 461 | ||
| 465 | - // Get models XML filename | ||
| 466 | - GFilename filename = (*this)["inmodel"].filename(); | ||
| 467 | - | ||
| 468 | // Throw an exception if the "inmodel" parameter is not a valid | 462 | // Throw an exception if the "inmodel" parameter is not a valid |
| 469 | // filename | 463 | // filename |
| 470 | - if (!is_valid_filename(filename)) { | ||
| 471 | - std::string msg = "The \"inmodel\" parameter \""+filename.url()+ | 464 | + if ((*this)["inmodel"].is_undefined()) { |
| 465 | + std::string msg = "The \"inmodel\" parameter \""+ | ||
| 466 | + (*this)["inmodel"].current_value()+ | ||
| 472 | "\" is not a valid filename. Please specify " | 467 | "\" is not a valid filename. Please specify " |
| 473 | "a valid model definition XML file."; | 468 | "a valid model definition XML file."; |
| 474 | throw GException::invalid_value(G_SETUP_MODELS, msg); | 469 | throw GException::invalid_value(G_SETUP_MODELS, msg); |
| 475 | } | 470 | } |
| 476 | 471 | ||
| 472 | + // Get models XML filename | ||
| 473 | + GFilename filename = (*this)["inmodel"].filename(); | ||
| 474 | + | ||
| 477 | // Load model container and assign it to observations container | 475 | // Load model container and assign it to observations container |
| 478 | obs.models(GModels(filename.url())); | 476 | obs.models(GModels(filename.url())); |
| 479 | 477 | ||
| @@ -816,19 +814,20 @@ GCTAObservation ctool::create_cta_obs(void) | @@ -816,19 +814,20 @@ GCTAObservation ctool::create_cta_obs(void) | ||
| 816 | ***************************************************************************/ | 814 | ***************************************************************************/ |
| 817 | void ctool::require_inobs(const std::string& method) | 815 | void ctool::require_inobs(const std::string& method) |
| 818 | { | 816 | { |
| 819 | - // Get inobs filename | ||
| 820 | - GFilename filename = (*this)["inobs"].filename(); | ||
| 821 | - | ||
| 822 | // Throw exception if no infile is given | 817 | // Throw exception if no infile is given |
| 823 | - if (!is_valid_filename(filename)) { | 818 | + if ((*this)["inobs"].is_undefined()) { |
| 824 | std::string msg = "A valid file needs to be specified for the " | 819 | std::string msg = "A valid file needs to be specified for the " |
| 825 | - "\"inobs\" parameter, yet \""+filename.url()+ | 820 | + "\"inobs\" parameter, yet \""+ |
| 821 | + (*this)["inobs"].current_value()+ | ||
| 826 | "\" was given." | 822 | "\" was given." |
| 827 | " Specify a valid observation definition or " | 823 | " Specify a valid observation definition or " |
| 828 | "FITS file to proceed."; | 824 | "FITS file to proceed."; |
| 829 | throw GException::invalid_value(method, msg); | 825 | throw GException::invalid_value(method, msg); |
| 830 | } | 826 | } |
| 831 | 827 | ||
| 828 | + // Get inobs filename | ||
| 829 | + GFilename filename = (*this)["inobs"].filename(); | ||
| 830 | + | ||
| 832 | // Return | 831 | // Return |
| 833 | return; | 832 | return; |
| 834 | } | 833 | } |
| @@ -845,43 +844,48 @@ void ctool::require_inobs(const std::string& method) | @@ -845,43 +844,48 @@ void ctool::require_inobs(const std::string& method) | ||
| 845 | ***************************************************************************/ | 844 | ***************************************************************************/ |
| 846 | void ctool::require_inobs_nocube(const std::string& method) | 845 | void ctool::require_inobs_nocube(const std::string& method) |
| 847 | { | 846 | { |
| 848 | - // Get inobs filename | ||
| 849 | - GFilename filename = (*this)["inobs"].filename(); | 847 | + // Continues only if we have a valid filename |
| 848 | + if ((*this)["inobs"].is_valid()) { | ||
| 850 | 849 | ||
| 851 | - // Continue only if we have a FITS file | ||
| 852 | - if (filename.is_fits()) { | 850 | + // Get inobs filename |
| 851 | + GFilename filename = (*this)["inobs"].filename(); | ||
| 853 | 852 | ||
| 854 | - // Signal no cube | ||
| 855 | - bool is_cube = false; | 853 | + // Continue only if we have a FITS file |
| 854 | + if (filename.is_fits()) { | ||
| 856 | 855 | ||
| 857 | - // Try loading file as counts cube. If this is successful then | ||
| 858 | - // throw an exception | ||
| 859 | - try { | 856 | + // Signal no cube |
| 857 | + bool is_cube = false; | ||
| 860 | 858 | ||
| 861 | - // Load cube from file | ||
| 862 | - GCTAEventCube cube(filename); | 859 | + // Try loading file as counts cube. If this is successful then |
| 860 | + // throw an exception | ||
| 861 | + try { | ||
| 863 | 862 | ||
| 864 | - // If we're still alive then signal that we have a cube | ||
| 865 | - is_cube = true; | 863 | + // Load cube from file |
| 864 | + GCTAEventCube cube(filename); | ||
| 866 | 865 | ||
| 867 | - } | 866 | + // If we're still alive then signal that we have a cube |
| 867 | + is_cube = true; | ||
| 868 | 868 | ||
| 869 | - // Catch any exceptions | ||
| 870 | - catch (...) { | ||
| 871 | - ; | ||
| 872 | - } | 869 | + } |
| 873 | 870 | ||
| 874 | - // If we have a counts cube then throw an exception | ||
| 875 | - if (is_cube) { | ||
| 876 | - std::string msg = "A counts cube has been specified for the " | ||
| 877 | - "\"inobs\" parameter, yet no counts cube " | ||
| 878 | - "can be specified as input observation." | ||
| 879 | - " Instead, specify an event list or an " | ||
| 880 | - "observation definition file."; | ||
| 881 | - throw GException::invalid_value(method, msg); | ||
| 882 | - } | 871 | + // Catch any exceptions |
| 872 | + catch (...) { | ||
| 873 | + ; | ||
| 874 | + } | ||
| 875 | + | ||
| 876 | + // If we have a counts cube then throw an exception | ||
| 877 | + if (is_cube) { | ||
| 878 | + std::string msg = "A counts cube has been specified for the " | ||
| 879 | + "\"inobs\" parameter, yet no counts cube " | ||
| 880 | + "can be specified as input observation." | ||
| 881 | + " Instead, specify an event list or an " | ||
| 882 | + "observation definition file."; | ||
| 883 | + throw GException::invalid_value(method, msg); | ||
| 884 | + } | ||
| 883 | 885 | ||
| 884 | - } // endif: we had a FITS file | 886 | + } // endif: we had a FITS file |
| 887 | + | ||
| 888 | + } // endif: filename was valid | ||
| 885 | 889 | ||
| 886 | // Return | 890 | // Return |
| 887 | return; | 891 | return; |
| @@ -1178,8 +1182,8 @@ std::string ctool::set_outfile_name(const std::string& filename) | @@ -1178,8 +1182,8 @@ std::string ctool::set_outfile_name(const std::string& filename) | ||
| 1178 | bool ctool::is_stacked(void) | 1182 | bool ctool::is_stacked(void) |
| 1179 | { | 1183 | { |
| 1180 | // First query the minimum and maximum energies | 1184 | // First query the minimum and maximum energies |
| 1181 | - (*this)["emin"].real(); | ||
| 1182 | - (*this)["emax"].real(); | 1185 | + (*this)["emin"].query(); |
| 1186 | + (*this)["emax"].query(); | ||
| 1183 | 1187 | ||
| 1184 | // Now query the number of energy bins and set the stacked flag | 1188 | // Now query the number of energy bins and set the stacked flag |
| 1185 | bool stacked = ((*this)["enumbins"].integer() > 0) ? true : false; | 1189 | bool stacked = ((*this)["enumbins"].integer() > 0) ? true : false; |
| @@ -1187,13 +1191,13 @@ bool ctool::is_stacked(void) | @@ -1187,13 +1191,13 @@ bool ctool::is_stacked(void) | ||
| 1187 | // If a stacked analysis is requested then query the spatial definition | 1191 | // If a stacked analysis is requested then query the spatial definition |
| 1188 | // of the cube | 1192 | // of the cube |
| 1189 | if (stacked) { | 1193 | if (stacked) { |
| 1190 | - (*this)["coordsys"].string(); | ||
| 1191 | - (*this)["proj"].string(); | ||
| 1192 | - (*this)["xref"].real(); | ||
| 1193 | - (*this)["yref"].real(); | ||
| 1194 | - (*this)["nxpix"].integer(); | ||
| 1195 | - (*this)["nypix"].integer(); | ||
| 1196 | - (*this)["binsz"].real(); | 1194 | + (*this)["coordsys"].query(); |
| 1195 | + (*this)["proj"].query(); | ||
| 1196 | + (*this)["xref"].query(); | ||
| 1197 | + (*this)["yref"].query(); | ||
| 1198 | + (*this)["nxpix"].query(); | ||
| 1199 | + (*this)["nypix"].query(); | ||
| 1200 | + (*this)["binsz"].query(); | ||
| 1197 | } | 1201 | } |
| 1198 | 1202 | ||
| 1199 | // Return stacked flag | 1203 | // Return stacked flag |
| @@ -1224,23 +1228,23 @@ bool ctool::is_onoff(void) | @@ -1224,23 +1228,23 @@ bool ctool::is_onoff(void) | ||
| 1224 | if (onoff) { | 1228 | if (onoff) { |
| 1225 | 1229 | ||
| 1226 | // Query csphagen parameters | 1230 | // Query csphagen parameters |
| 1227 | - (*this)["inexclusion"].filename(); | ||
| 1228 | - (*this)["emin"].real(); | ||
| 1229 | - (*this)["emax"].real(); | ||
| 1230 | - (*this)["enumbins"].integer(); | ||
| 1231 | - (*this)["coordsys"].string(); | ||
| 1232 | - (*this)["xref"].real(); | ||
| 1233 | - (*this)["yref"].real(); | 1231 | + (*this)["inexclusion"].query(); |
| 1232 | + (*this)["emin"].query(); | ||
| 1233 | + (*this)["emax"].query(); | ||
| 1234 | + (*this)["enumbins"].query(); | ||
| 1235 | + (*this)["coordsys"].query(); | ||
| 1236 | + (*this)["xref"].query(); | ||
| 1237 | + (*this)["yref"].query(); | ||
| 1234 | if ((*this)["srcshape"].string() == "CIRCLE"){ | 1238 | if ((*this)["srcshape"].string() == "CIRCLE"){ |
| 1235 | - (*this)["rad"].real(); | 1239 | + (*this)["rad"].query(); |
| 1236 | } | 1240 | } |
| 1237 | if ((*this)["bkgmethod"].string() == "REFLECTED"){ | 1241 | if ((*this)["bkgmethod"].string() == "REFLECTED"){ |
| 1238 | - (*this)["bkgregmin"].integer(); | 1242 | + (*this)["bkgregmin"].query(); |
| 1239 | } | 1243 | } |
| 1240 | - (*this)["maxoffset"].real(); | ||
| 1241 | - (*this)["etruemin"].real(); | ||
| 1242 | - (*this)["etruemax"].real(); | ||
| 1243 | - (*this)["etruebins"].integer(); | 1244 | + (*this)["maxoffset"].query(); |
| 1245 | + (*this)["etruemin"].query(); | ||
| 1246 | + (*this)["etruemax"].query(); | ||
| 1247 | + (*this)["etruebins"].query(); | ||
| 1244 | 1248 | ||
| 1245 | } // endif: method was ONOFF | 1249 | } // endif: method was ONOFF |
| 1246 | 1250 | ||
| @@ -1419,38 +1423,28 @@ void ctool::set_obs_response(GCTAObservation* obs) | @@ -1419,38 +1423,28 @@ void ctool::set_obs_response(GCTAObservation* obs) | ||
| 1419 | query_edisp = (*this)["edisp"].boolean(); | 1423 | query_edisp = (*this)["edisp"].boolean(); |
| 1420 | } | 1424 | } |
| 1421 | 1425 | ||
| 1422 | - // Get filenames | ||
| 1423 | - GFilename expcube((*this)["expcube"].filename()); | ||
| 1424 | - GFilename psfcube((*this)["psfcube"].filename()); | ||
| 1425 | - GFilename edispcube; | ||
| 1426 | - if (query_edisp) { | ||
| 1427 | - edispcube = (*this)["edispcube"].filename(); | ||
| 1428 | - } | ||
| 1429 | - GFilename bkgcube((*this)["bkgcube"].filename()); | ||
| 1430 | - | ||
| 1431 | // Extract stacked response information if available | 1426 | // Extract stacked response information if available |
| 1432 | - if (is_valid_filename(expcube) && is_valid_filename(psfcube) && | ||
| 1433 | - is_valid_filename(bkgcube)) { | ||
| 1434 | - | ||
| 1435 | - // Load exposure, PSF and background cubes | ||
| 1436 | - GCTACubeExposure exposure(expcube); | ||
| 1437 | - GCTACubePsf psf(psfcube); | ||
| 1438 | - GCTACubeBackground background(bkgcube); | 1427 | + if ((*this)["expcube"].is_valid() && |
| 1428 | + (*this)["psfcube"].is_valid() && | ||
| 1429 | + (*this)["bkgcube"].is_valid()) { | ||
| 1430 | + | ||
| 1431 | + // Load exposure, PSF and background cubes and query energy | ||
| 1432 | + // dispersion cube | ||
| 1433 | + GCTACubeExposure exposure((*this)["expcube"].filename()); | ||
| 1434 | + GCTACubePsf psf((*this)["psfcube"].filename()); | ||
| 1435 | + if (query_edisp && (*this)["edispcube"].is_valid()) { | ||
| 1436 | + (*this)["edispcube"].filename(); | ||
| 1437 | + } | ||
| 1438 | + GCTACubeBackground background((*this)["bkgcube"].filename()); | ||
| 1439 | 1439 | ||
| 1440 | - // If querying of energy dispersion cube is requested then | ||
| 1441 | - // query it now | 1440 | + // Set response |
| 1442 | if (query_edisp) { | 1441 | if (query_edisp) { |
| 1443 | 1442 | ||
| 1444 | - // If filename is valid then use energy dispersion ... | ||
| 1445 | - if (is_valid_filename(edispcube)) { | ||
| 1446 | - | ||
| 1447 | - // Load energy dispersion cube | ||
| 1448 | - GCTACubeEdisp edisp(edispcube); | ||
| 1449 | - | ||
| 1450 | - // Set response with all four cubes | 1443 | + // If energy dispersion cube was provided then use it |
| 1444 | + if ((*this)["edispcube"].is_valid()) { | ||
| 1445 | + GCTACubeEdisp edisp((*this)["edispcube"].filename()); | ||
| 1451 | obs->response(exposure, psf, edisp, background); | 1446 | obs->response(exposure, psf, edisp, background); |
| 1452 | - | ||
| 1453 | - } // endif: energy dispersion cube was provided | 1447 | + } |
| 1454 | 1448 | ||
| 1455 | // ... otherwise work without energy dispersion | 1449 | // ... otherwise work without energy dispersion |
| 1456 | else { | 1450 | else { |
| @@ -1606,12 +1600,9 @@ GObservations ctool::get_observations(const bool& get_response) | @@ -1606,12 +1600,9 @@ GObservations ctool::get_observations(const bool& get_response) | ||
| 1606 | // Initialise empty observation container | 1600 | // Initialise empty observation container |
| 1607 | GObservations obs; | 1601 | GObservations obs; |
| 1608 | 1602 | ||
| 1609 | - // Get the filename from the input parameters | ||
| 1610 | - std::string filename = (*this)["inobs"].filename(); | ||
| 1611 | - | ||
| 1612 | // If no observation definition file has been specified then read all | 1603 | // If no observation definition file has been specified then read all |
| 1613 | // parameters that are necessary to create an observation from scratch | 1604 | // parameters that are necessary to create an observation from scratch |
| 1614 | - if (!is_valid_filename(filename)) { | 1605 | + if ((*this)["inobs"].is_undefined()) { |
| 1615 | 1606 | ||
| 1616 | // Setup a new CTA observation | 1607 | // Setup a new CTA observation |
| 1617 | GCTAObservation cta_obs = create_cta_obs(); | 1608 | GCTAObservation cta_obs = create_cta_obs(); |
| @@ -1632,6 +1623,9 @@ GObservations ctool::get_observations(const bool& get_response) | @@ -1632,6 +1623,9 @@ GObservations ctool::get_observations(const bool& get_response) | ||
| 1632 | // ... otherwise we have a file name | 1623 | // ... otherwise we have a file name |
| 1633 | else { | 1624 | else { |
| 1634 | 1625 | ||
| 1626 | + // Get the filename from the input parameters | ||
| 1627 | + std::string filename = (*this)["inobs"].filename(); | ||
| 1628 | + | ||
| 1635 | // If file is a FITS file then create an empty CTA observation | 1629 | // If file is a FITS file then create an empty CTA observation |
| 1636 | // and load file into observation | 1630 | // and load file into observation |
| 1637 | if (GFilename(filename).is_fits()) { | 1631 | if (GFilename(filename).is_fits()) { |
src/support/ctool.hpp
| @@ -134,7 +134,6 @@ protected: | @@ -134,7 +134,6 @@ protected: | ||
| 134 | const GCTAObservation& obs); | 134 | const GCTAObservation& obs); |
| 135 | std::vector<bool> cube_layer_usage(const GEbounds& cube_ebounds, | 135 | std::vector<bool> cube_layer_usage(const GEbounds& cube_ebounds, |
| 136 | const GEbounds& list_ebounds) const; | 136 | const GEbounds& list_ebounds) const; |
| 137 | - bool is_valid_filename(const GFilename& filename) const; | ||
| 138 | std::string get_gtiname(const std::string& filename, | 137 | std::string get_gtiname(const std::string& filename, |
| 139 | const std::string& evtname) const; | 138 | const std::string& evtname) const; |
| 140 | void save_event_list(const GCTAObservation* obs, | 139 | void save_event_list(const GCTAObservation* obs, |
| @@ -175,19 +174,4 @@ const bool& ctool::read_ahead(void) const | @@ -175,19 +174,4 @@ const bool& ctool::read_ahead(void) const | ||
| 175 | return (m_read_ahead); | 174 | return (m_read_ahead); |
| 176 | } | 175 | } |
| 177 | 176 | ||
| 178 | - | ||
| 179 | -/***********************************************************************//** | ||
| 180 | - * @brief Check of a filename is valid | ||
| 181 | - * | ||
| 182 | - * @return True if filename is valid | ||
| 183 | - * | ||
| 184 | - * Checks whether a filename is not empty and not "NONE". | ||
| 185 | - ***************************************************************************/ | ||
| 186 | -inline | ||
| 187 | -bool ctool::is_valid_filename(const GFilename& filename) const | ||
| 188 | -{ | ||
| 189 | - return (!filename.is_empty() && | ||
| 190 | - (gammalib::tolower(filename.url()) != "none")); | ||
| 191 | -} | ||
| 192 | - | ||
| 193 | #endif /* CTOOL_HPP */ | 177 | #endif /* CTOOL_HPP */ |
test/test_cscript.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the cspull script. | 3 | # This scripts performs unit tests for the cspull script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 Juergen Knoedlseder |
| 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 |
| 8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
| @@ -115,10 +115,6 @@ class cscript_test(ctools.cscript): | @@ -115,10 +115,6 @@ class cscript_test(ctools.cscript): | ||
| 115 | def check_get_current_rss(self): | 115 | def check_get_current_rss(self): |
| 116 | return self._get_current_rss() | 116 | return self._get_current_rss() |
| 117 | 117 | ||
| 118 | - # Check is_valid_filename() method | ||
| 119 | - def check_is_valid_filename(self, filename): | ||
| 120 | - return self._is_valid_filename(gammalib.GFilename(filename)) | ||
| 121 | - | ||
| 122 | # Check save_event_list() method | 118 | # Check save_event_list() method |
| 123 | def check_save_event_list(self, infile, evtname, gtiname, outfile): | 119 | def check_save_event_list(self, infile, evtname, gtiname, outfile): |
| 124 | obs = gammalib.GCTAObservation() | 120 | obs = gammalib.GCTAObservation() |
| @@ -524,14 +520,6 @@ class Test(test): | @@ -524,14 +520,6 @@ class Test(test): | ||
| 524 | # Test cube_layer_usage() method | 520 | # Test cube_layer_usage() method |
| 525 | # TODO: implement | 521 | # TODO: implement |
| 526 | 522 | ||
| 527 | - # Test is_valid_filename() method | ||
| 528 | - self.test_assert(empty.check_is_valid_filename(self._model), | ||
| 529 | - 'Check model definiton XML file') | ||
| 530 | - self.test_assert(not empty.check_is_valid_filename(''), | ||
| 531 | - 'Check empty filename') | ||
| 532 | - self.test_assert(not empty.check_is_valid_filename('NONE'), | ||
| 533 | - 'Check "NONE" filename') | ||
| 534 | - | ||
| 535 | # Test get_gtiname() method | 523 | # Test get_gtiname() method |
| 536 | # TODO: implement | 524 | # TODO: implement |
| 537 | 525 |