Commit 6236e1d83fb918e88fb2b0b2d96dfbdf0e0b64a0
1 parent
e634e79a
Use gammalib::is_fits() function
Showing
1 changed file
with
6 additions
and
5 deletions
src/support/ctool.cpp
| ... | ... | @@ -316,8 +316,9 @@ GObservations ctool::get_observations(const bool& get_response) |
| 316 | 316 | // ... otherwise we have a file name |
| 317 | 317 | else { |
| 318 | 318 | |
| 319 | - // Try first to open as FITS file | |
| 320 | - try { | |
| 319 | + // If file is a FITS file then create an empty CTA observation | |
| 320 | + // and load file into observation | |
| 321 | + if (gammalib::is_fits(filename)) { | |
| 321 | 322 | |
| 322 | 323 | // Allocate empty CTA observation |
| 323 | 324 | GCTAObservation cta_obs; |
| ... | ... | @@ -341,8 +342,8 @@ GObservations ctool::get_observations(const bool& get_response) |
| 341 | 342 | |
| 342 | 343 | } |
| 343 | 344 | |
| 344 | - // ... otherwise try to open as XML file | |
| 345 | - catch (GException::fits_open_error &e) { | |
| 345 | + // ... otherwise load file into observation container | |
| 346 | + else { | |
| 346 | 347 | |
| 347 | 348 | // Load observations from XML file |
| 348 | 349 | obs.load(filename); |
| ... | ... | @@ -362,7 +363,7 @@ GObservations ctool::get_observations(const bool& get_response) |
| 362 | 363 | // Signal that XML file should be used for storage |
| 363 | 364 | m_use_xml = true; |
| 364 | 365 | |
| 365 | - } // endcatch: file was an XML file | |
| 366 | + } // endelse: file was an XML file | |
| 366 | 367 | |
| 367 | 368 | } |
| 368 | 369 | ... | ... |