GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GMWLSpectrum.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GMWLSpectrum.cpp - Multi-wavelength spectrum class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2010-2016 by Juergen Knoedlseder *
5  * ----------------------------------------------------------------------- *
6  * *
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 *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file GMWLSpectrum.cpp
23  * @brief Multi-wavelength spectrum class implementation
24  * @author Juergen Knoedlseder
25  */
26 
27 /* __ Includes ___________________________________________________________ */
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include "GTools.hpp"
32 #include "GFilename.hpp"
33 #include "GFits.hpp"
34 #include "GFitsTable.hpp"
35 #include "GEnergy.hpp"
36 #include "GException.hpp"
37 #include "GMWLException.hpp"
38 #include "GMWLSpectrum.hpp"
39 
40 /* __ Method name definitions ____________________________________________ */
41 #define G_OPERATOR "GMWLSpectrum::operator[](int&)"
42 #define G_READ "GMWLSpectrum::read(GFits&, int&)"
43 #define G_READ_FITS "GMWLSpectrum::read_fits(GFitsTable&)"
44 #define G_CONV_ENERGY "GMWLSpectrum::conv_energy(double&, std::string&)"
45 #define G_CONV_FLUX "GMWLSpectrum::conv_flux(GEnergy&, double&, "\
46  "std::string&)"
47 
48 /* __ Macros _____________________________________________________________ */
49 
50 /* __ Coding definitions _________________________________________________ */
51 
52 /* __ Debug definitions __________________________________________________ */
53 
54 
55 
56 /*==========================================================================
57  = =
58  = Constructors/destructors =
59  = =
60  ==========================================================================*/
61 
62 /***********************************************************************//**
63  * @brief Void constructor
64  *
65  * Creates instance of an undefined spectrum.
66  ***************************************************************************/
68 {
69  // Initialise members
70  init_members();
71 
72  // Return
73  return;
74 }
75 
76 
77 /***********************************************************************//**
78  * @brief File constructor
79  *
80  * @param[in] filename File name.
81  *
82  * Creates instance from file.
83  ***************************************************************************/
85 {
86  // Initialise members
87  init_members();
88 
89  // Load spectrum
90  load(filename);
91 
92  // Return
93  return;
94 }
95 
96 
97 /***********************************************************************//**
98  * @brief Copy constructor
99  *
100  * @param[in] spec Spectrum.
101  *
102  * Creates instance by copying an existing spectrum.
103  ***************************************************************************/
105 {
106  // Initialise class members for clean destruction
107  init_members();
108 
109  // Copy members
110  copy_members(spec);
111 
112  // Return
113  return;
114 }
115 
116 
117 /***********************************************************************//**
118  * @brief Destructor
119  *
120  * Destroy instance.
121  ***************************************************************************/
123 {
124  // Free members
125  free_members();
126 
127  // Return
128  return;
129 }
130 
131 
132 /*==========================================================================
133  = =
134  = Operators =
135  = =
136  ==========================================================================*/
137 
138 /***********************************************************************//**
139  * @brief Assignment operator
140  *
141  * @param[in] spec Spectrum.
142  * @return Spectrum.
143  ***************************************************************************/
145 {
146  // Execute only if object is not identical
147  if (this != &spec) {
148 
149  // Copy base class members
150  this->GEventCube::operator=(spec);
151 
152  // Free members
153  free_members();
154 
155  // Initialise members
156  init_members();
157 
158  // Copy members
159  copy_members(spec);
160 
161  } // endif: object was not identical
162 
163  // Return this object
164  return *this;
165 }
166 
167 
168 /***********************************************************************//**
169  * @brief Spectral point access operator
170  *
171  * @param[in] index Spectral point index [0,...,size()-1].
172  *
173  * @exception GException::out_of_range
174  * Spectral point index outside valid range.
175  ***************************************************************************/
177 {
178  // Optionally check if the index is valid
179  #if defined(G_RANGE_CHECK)
180  if (index < 0 || index >= size()) {
181  throw GException::out_of_range(G_OPERATOR, "Spectral point", index, size());
182  }
183  #endif
184 
185  // Return pointer
186  return &(m_data[index]);
187 }
188 
189 
190 /***********************************************************************//**
191  * @brief Spectral point access operator (const version)
192  *
193  * @param[in] index Spectral point index [0,...,size()-1].
194  *
195  * @exception GException::out_of_range
196  * Spectral point index outside valid range.
197  ***************************************************************************/
198 const GMWLDatum* GMWLSpectrum::operator[](const int& index) const
199 {
200  // Optionally check if the index is valid
201  #if defined(G_RANGE_CHECK)
202  if (index < 0 || index >= size()) {
203  throw GException::out_of_range(G_OPERATOR, "Spectral point", index, size());
204  }
205  #endif
206 
207  // Return pointer
208  return &(m_data[index]);
209 }
210 
211 
212 /*==========================================================================
213  = =
214  = Public methods =
215  = =
216  ==========================================================================*/
217 
218 /***********************************************************************//**
219  * @brief Clear spectrum
220  ***************************************************************************/
222 {
223  // Free class members (base and derived classes, derived class first)
224  free_members();
225  this->GEventCube::free_members();
226  this->GEvents::free_members();
227 
228  // Initialise members
229  this->GEvents::init_members();
230  this->GEventCube::init_members();
231  init_members();
232 
233  // Return
234  return;
235 }
236 
237 
238 /***********************************************************************//**
239  * @brief Clone spectrum
240  *
241  * @return Pointer to deep copy of spectrum.
242  ***************************************************************************/
244 {
245  return new GMWLSpectrum(*this);
246 }
247 
248 
249 /***********************************************************************//**
250  * @brief Load spectrum
251  *
252  * @param[in] filename File name.
253  *
254  * This method loads a spectrum from a variety of file types. The method
255  * analyses the format of the file that is presented and choses then the
256  * appropriate method to load the specific format. The following file
257  * formats are supported: FITS, TBW ...
258  *
259  * @todo So far only FITS file support is implemented.
260  ***************************************************************************/
261 void GMWLSpectrum::load(const GFilename& filename)
262 {
263  // Clear object
264  clear();
265 
266  // Open FITS file
267  GFits fits(filename);
268 
269  // Read spectrum
270  if (filename.has_extno()) {
271  read(fits, filename.extno());
272  }
273  else if (filename.has_extname()) {
274  read(fits, filename.extname());
275  }
276  else {
277  read(fits);
278  }
279 
280  // Close FITS file
281  fits.close();
282 
283  // Return
284  return;
285 }
286 
287 
288 /***********************************************************************//**
289  * @brief Save spectrum
290  *
291  * @param[in] filename File name.
292  * @param[in] clobber Overwrite existing file (default: false).
293  *
294  * @todo To be implemented.
295  ***************************************************************************/
296 void GMWLSpectrum::save(const GFilename& filename,
297  const bool& clobber) const
298 {
299  // Return
300  return;
301 }
302 
303 
304 /***********************************************************************//**
305  * @brief Read spectrum from FITS file
306  *
307  * @param[in] file FITS file.
308  *
309  * Read spectrum from first extension in FITS file.
310  ***************************************************************************/
311 void GMWLSpectrum::read(const GFits& file)
312 {
313  // Clear object
314  clear();
315 
316  // Read spectrum from first extension in FITS file
317  read(file, 0);
318 
319  // Return
320  return;
321 }
322 
323 
324 /***********************************************************************//**
325  * @brief Read spectrum from FITS file
326  *
327  * @param[in] fits FITS file.
328  * @param[in] extname FITS extension name.
329  ***************************************************************************/
330 void GMWLSpectrum::read(const GFits& fits, const std::string& extname)
331 {
332  // Clear object
333  clear();
334 
335  // Get table pointer
336  const GFitsTable& table = *fits.table(extname);
337 
338  // Read spectrum from table
339  read_fits(table);
340 
341  // Return
342  return;
343 }
344 
345 
346 /***********************************************************************//**
347  * @brief Read spectrum from FITS file
348  *
349  * @param[in] fits FITS file.
350  * @param[in] extno Extension number of spectrum.
351  *
352  * @exception GMWLException::file_open_error
353  * No table found in file.
354  *
355  * Read the spectrum from a FITS table found in the specified extension.
356  * In no extension number if specified (or if extno=0) then the spectrum
357  * is loaded from the first table extension that is found in the file.
358  ***************************************************************************/
359 void GMWLSpectrum::read(const GFits& fits, const int& extno)
360 {
361  // Clear object
362  clear();
363 
364  // Initialise extension number
365  int extension = extno;
366 
367  // If the extension number is 0 then load first FITS table in file.
368  if (extension == 0) {
369  for (int i = 0; i < fits.size(); ++i) {
370  if (fits.at(i)->exttype() == GFitsHDU::HT_ASCII_TABLE ||
371  fits.at(i)->exttype() == GFitsHDU::HT_BIN_TABLE) {
372  extension = i;
373  break;
374  }
375  }
376  }
377 
378  // If we found no table then throw an exception
379  if (extension == 0) {
381  "No table found in file.");
382  }
383 
384  // Get table pointer
385  const GFitsTable& table = *fits.table(extension);
386 
387  // Read spectrum from table
388  read_fits(table);
389 
390  // Return
391  return;
392 }
393 
394 
395 /***********************************************************************//**
396  * @brief Write spectrum into FITS file
397  *
398  * @param[in] file FITS file.
399  *
400  * @todo To be implemented.
401  ***************************************************************************/
402 void GMWLSpectrum::write(GFits& file) const
403 {
404  // Return
405  return;
406 }
407 
408 
409 /***********************************************************************//**
410  * @brief Return number of points in spectrum
411  ***************************************************************************/
412 int GMWLSpectrum::number(void) const
413 {
414  // Return
415  return (size());
416 }
417 
418 
419 /***********************************************************************//**
420  * @brief Print spectrum
421  *
422  * @param[in] chatter Chattiness (defaults to NORMAL).
423  * @return String containing spectrum
424  ***************************************************************************/
425 std::string GMWLSpectrum::print(const GChatter& chatter) const
426 {
427  // Initialise result string
428  std::string result;
429 
430  // Continue only if chatter is not silent
431  if (chatter != SILENT) {
432 
433  // Append header
434  result.append("=== GMWLSpectrum ===");
435 
436  // Append information
437  result.append("\n"+gammalib::parformat("Telescope")+m_telescope);
438  result.append("\n"+gammalib::parformat("Instrument")+m_instrument);
439  result.append("\n"+gammalib::parformat("Number of points"));
440  result.append(gammalib::str(size()));
441  result.append("\n"+gammalib::parformat("Time interval"));
442  if (m_gti.size() > 0) {
443  result.append(gammalib::str(tstart().secs())+" - ");
444  result.append(gammalib::str(tstop().secs())+" sec");
445  }
446  else {
447  result.append("not defined");
448  }
449  result.append("\n"+gammalib::parformat("Energy range"));
450  if (m_ebounds.size() > 0) {
451  result.append(emin().print()+" - "+emax().print());
452  }
453  else {
454  result.append("not defined");
455  }
456 
457  // EXPLICIT: Append spectral points
458  if (chatter >= EXPLICIT) {
459  for (int i = 0; i < size(); ++i) {
460 
461  // Build energy string
462  std::string energy = m_data[i].m_eng.print();
463  if (m_data[i].m_eng_err.MeV() > 0.0) {
464  energy += " +/- "+m_data[i].m_eng_err.print();
465  }
466 
467  // Build flux string
468  std::string flux = gammalib::str(m_data[i].m_flux);
469  if (m_data[i].m_flux_err > 0.0) {
470  flux += " +/- "+gammalib::str(m_data[i].m_flux_err);
471  }
472  flux += " ph/cm2/s/MeV";
473 
474  // Append to string
475  result.append("\n"+gammalib::parformat(energy));
476  result.append(flux);
477 
478  } // endfor: looped over spectral points
479 
480  } // endif: EXPLICIT level
481 
482  } // endif: chatter was not silent
483 
484  // Return result
485  return result;
486 }
487 
488 
489 /*==========================================================================
490  = =
491  = Private methods =
492  = =
493  ==========================================================================*/
494 
495 /***********************************************************************//**
496  * @brief Initialise class members
497  ***************************************************************************/
499 {
500  // Initialise members
501  m_telescope.clear();
502  m_instrument.clear();
503  m_data.clear();
504 
505  // Return
506  return;
507 }
508 
509 
510 /***********************************************************************//**
511  * @brief Copy class members
512  *
513  * @param[in] spec Instance to be copied.
514  ***************************************************************************/
516 {
517  // Copy members
518  m_telescope = spec.m_telescope;
519  m_instrument = spec.m_instrument;
520  m_data = spec.m_data;
521 
522  // Return
523  return;
524 }
525 
526 
527 /***********************************************************************//**
528  * @brief Delete class members
529  ***************************************************************************/
531 {
532  // Return
533  return;
534 }
535 
536 
537 /***********************************************************************//**
538  * @brief Set energy boundaries
539  ***************************************************************************/
541 {
542  // Clear energy boundaries
543  m_ebounds.clear();
544 
545  // Continue only if we have data
546  if (size() > 0) {
547 
548  // Extract energy boundaries from spectrum
549  GEnergy emin = m_data[0].energy();
550  GEnergy emax = m_data[0].energy();
551  for (int i = 0; i < m_data.size(); ++i) {
552  if (m_data[i].energy() < emin) emin = m_data[i].energy();
553  if (m_data[i].energy() > emax) emax = m_data[i].energy();
554  }
555 
556  // Set energy boundaries
557  m_ebounds.append(emin, emax);
558 
559  } // endif: we had data
560 
561  // Return
562  return;
563 }
564 
565 
566 /***********************************************************************//**
567  * @brief Read spectrum from FITS file
568  *
569  * @param[in] table FITS table.
570  *
571  * @exception GMWLException::bad_file_format
572  * Table has invalid format
573  *
574  * Read spectrum from FITS table. The table is expected to be in one of the
575  * three following formats:
576  * 2 columns: energy, flux
577  * 3 columns: energy, flux, e_flux
578  * 4 columns or more: energy, e_energy, flux, e_flux, ...
579  *
580  * @todo Investigate whether we can exploit UCDs for identifying the correct
581  * columns or for determining the units.
582  ***************************************************************************/
584 {
585  // Reset spectrum
586  m_data.clear();
587 
588  // Initialise column pointers columns
589  const GFitsTableCol* c_energy = NULL;
590  const GFitsTableCol* c_energy_err = NULL;
591  const GFitsTableCol* c_flux = NULL;
592  const GFitsTableCol* c_flux_err = NULL;
593 
594  // Extract column pointers
595  if (table.ncols() == 2) {
596  c_energy = table[0];
597  c_flux = table[1];
598  }
599  else if (table.ncols() == 3) {
600  c_energy = table[0];
601  c_flux = table[1];
602  c_flux_err = table[2];
603  }
604  else if (table.ncols() > 3) {
605  c_energy = table[0];
606  c_energy_err = table[1];
607  c_flux = table[2];
608  c_flux_err = table[3];
609  }
610  else {
612  "At least 2 columns are expected is table \""+
613  table.extname()+"\".");
614  }
615 
616  // Read spectral points and add to spectrum
617  for (int i = 0; i < table.nrows(); ++i) {
618  GMWLDatum datum;
619  if (c_energy != NULL) {
620  datum.m_eng = conv_energy(c_energy->real(i), c_energy->unit());
621  }
622  if (c_energy_err != NULL) {
623  datum.m_eng_err = conv_energy(c_energy_err->real(i), c_energy->unit());
624  }
625  if (c_flux != NULL) {
626  datum.m_flux = conv_flux(datum.m_eng, c_flux->real(i), c_flux->unit());
627  }
628  if (c_flux_err != NULL) {
629  datum.m_flux_err = conv_flux(datum.m_eng, c_flux_err->real(i), c_flux_err->unit());
630  }
631  m_data.push_back(datum);
632  }
633 
634  // Get telescope name
635  if (table.has_card("TELESCOP")) {
636  m_telescope = table.string("TELESCOP");
637  }
638  else {
639  m_telescope = "unknown";
640  }
641 
642  // Get instrument name
643  if (table.has_card("INSTRUME")) {
644  m_instrument = table.string("INSTRUME");
645  }
646  else {
647  m_instrument = "unknown";
648  }
649 
650  // Set energy boundaries
651  set_ebounds();
652 
653  // Return
654  return;
655 }
656 
657 
658 /***********************************************************************//**
659  * @brief Convert value into energy
660  *
661  * @param[in] energy Energy value.
662  * @param[in] unit Unit of value.
663  *
664  * Converts an energy value into a GEnergy object based on the specified
665  * units. The following units are supported (case insensitive):
666  * erg, keV, MeV, GeV, and TeV.
667  ***************************************************************************/
668 GEnergy GMWLSpectrum::conv_energy(const double& energy, const std::string& unit)
669 {
670  // Convert energy
671  GEnergy result(energy, unit);
672 
673  // Return energy
674  return result;
675 }
676 
677 
678 /***********************************************************************//**
679  * @brief Convert value into flux
680  *
681  * @param[in] energy Energy at which flux is given.
682  * @param[in] flux Flux value.
683  * @param[in] unit Unit of value.
684  *
685  * @exception GMWLException::invalid_unit
686  * Invalid unit string encountered
687  *
688  * Converts a flux value into units of ph/cm2/s/MeV based on the specified
689  * units. The following units are supported (case insensitive):
690  * ph/cm2/s/MeV, ph/s/cm2/MeV, erg/cm2/s and erg/s/cm2.
691  ***************************************************************************/
692 double GMWLSpectrum::conv_flux(const GEnergy& energy, const double& flux,
693  const std::string& unit)
694 {
695  // Initialise energy
696  double result;
697 
698  // Convert unit string to upper base without any leading/trailing
699  // whitespace
700  std::string str_unit = gammalib::strip_whitespace(gammalib::toupper(unit));
701 
702  // High-energy units
703  if (str_unit == "PH/CM2/S/MEV" || str_unit == "PH/S/CM2/MEV") {
704  result = flux;
705  }
706  else if (str_unit == "ERG/CM2/S" || str_unit == "ERG/S/CM2") {
707  result = (gammalib::erg2MeV*flux) / (energy.MeV()*energy.MeV());
708  }
709 
710  // ... otherwise throw exception
711  else {
713  }
714 
715  // Return energy
716  return result;
717 }
double m_flux
Flux of spectral point (ph/cm2/s/MeV)
Definition: GMWLDatum.hpp:94
const double erg2MeV
Definition: GTools.hpp:46
void unit(const std::string &unit)
Set column unit.
GFitsHDU * at(const int &extno)
Get pointer to HDU.
Definition: GFits.cpp:233
const int & ncols(void) const
Return number of columns in table.
Definition: GFitsTable.hpp:134
void init_members(void)
Initialise class members.
Definition: GEventCube.cpp:143
GFitsTable * table(const int &extno)
Get pointer to table HDU.
Definition: GFits.cpp:472
#define G_READ
bool has_card(const int &cardno) const
Check existence of header card.
Definition: GFitsHDU.hpp:233
virtual void write(GFits &file) const
Write spectrum into FITS file.
Energy value class definition.
double m_flux_err
Uncertainty in flux (ph/cm2/s/MeV)
Definition: GMWLDatum.hpp:95
bool has_extno(void) const
Signal if filename has an extension number.
Definition: GFilename.hpp:267
Multi-wavelength spectrum class interface definition.
int size(void) const
Return number of energy boundaries.
Definition: GEbounds.hpp:157
void init_members(void)
Initialise class members.
Definition: GEvents.cpp:176
void append(const GEnergy &emin, const GEnergy &emax)
Append energy interval.
Definition: GEbounds.cpp:302
virtual GMWLSpectrum & operator=(const GMWLSpectrum &spec)
Assignment operator.
void free_members(void)
Delete class members.
Definition: GEventCube.cpp:165
const GFilename & filename(void) const
Return FITS filename.
Definition: GFits.hpp:313
virtual GEventCube & operator=(const GEventCube &cube)
Assignment operator.
Definition: GEventCube.cpp:104
const GTime & tstop(void) const
Return stop time.
Definition: GEvents.hpp:158
bool has_extname(void) const
Signal if filename has an extension name.
Definition: GFilename.hpp:255
virtual HDUType exttype(void) const =0
virtual GMWLDatum * operator[](const int &index)
Spectral point access operator.
GEbounds m_ebounds
Energy boundaries covered by events.
Definition: GEvents.hpp:111
std::string extname(const std::string &defaultname="") const
Return extension name.
Definition: GFilename.cpp:385
double MeV(void) const
Return energy in MeV.
Definition: GEnergy.cpp:321
Gammalib tools definition.
FITS file class.
Definition: GFits.hpp:63
FITS file class interface definition.
std::string strip_whitespace(const std::string &arg)
Strip leading and trailing whitespace from string.
Definition: GTools.cpp:73
int size(void) const
Return number of Good Time Intervals.
Definition: GGti.hpp:153
Multi-wavelength spectrum class interface.
GEnergy m_eng_err
Uncertainty in energy.
Definition: GMWLDatum.hpp:93
void read_fits(const GFitsTable &table)
Read spectrum from FITS file.
GEnergy m_eng
Energy of spectral point.
Definition: GMWLDatum.hpp:92
virtual std::string print(const GChatter &chatter=NORMAL) const
Print spectrum.
void free_members(void)
Delete class members.
Filename class.
Definition: GFilename.hpp:62
void free_members(void)
Delete class members.
Definition: GEvents.cpp:206
Abstract interface for FITS table column.
virtual int size(void) const
Return number of spectral bins.
#define G_READ_FITS
MWL exception handler interface definition.
virtual int number(void) const
Return number of points in spectrum.
Abstract interface for FITS table.
Definition: GFitsTable.hpp:44
virtual void clear(void)
Clear spectrum.
GGti m_gti
Good time intervals covered by events.
Definition: GEvents.hpp:112
GChatter
Definition: GTypemaps.hpp:33
GEnergy conv_energy(const double &energy, const std::string &unit)
Convert value into energy.
const std::string & extname(void) const
Return extension name.
Definition: GFitsHDU.hpp:162
void clear(void)
Clear energy boundaries.
Definition: GEbounds.cpp:269
std::string m_telescope
Telescope name.
virtual GMWLSpectrum * clone(void) const
Clone spectrum.
const int & nrows(void) const
Return number of rows in table.
Definition: GFitsTable.hpp:119
void set_ebounds(void)
Set energy boundaries.
std::vector< GMWLDatum > m_data
Spectral data.
Multi-wavelength spectral point class.
Definition: GMWLDatum.hpp:45
void copy_members(const GMWLSpectrum &spec)
Copy class members.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save spectrum.
#define G_CONV_FLUX
std::string url(void) const
Return Uniform Resource Locator (URL)
Definition: GFilename.hpp:189
virtual double real(const int &row, const int &inx=0) const =0
const GEnergy & emin(void) const
Return minimum energy.
Definition: GEvents.hpp:170
GMWLSpectrum(void)
Void constructor.
int size(void) const
Return number of HDUs in FITS file.
Definition: GFits.hpp:237
int extno(const int &defaultno=-1) const
Return extension number.
Definition: GFilename.cpp:410
#define G_OPERATOR
std::string string(const std::string &keyname) const
Return card value as string.
Definition: GFitsHDU.hpp:410
Exception handler interface definition.
std::string toupper(const std::string &s)
Convert string to upper case.
Definition: GTools.cpp:820
virtual ~GMWLSpectrum(void)
Destructor.
void init_members(void)
Initialise class members.
double conv_flux(const GEnergy &energy, const double &flux, const std::string &unit)
Convert value into flux.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
Definition: GTools.cpp:1022
const GTime & tstart(void) const
Return start time.
Definition: GEvents.hpp:146
Abstract event bin container class.
Definition: GEventCube.hpp:46
void close(void)
Close FITS file.
Definition: GFits.cpp:1314
const GEnergy & emax(void) const
Return maximum energy.
Definition: GEvents.hpp:182
std::string m_instrument
Instrument name.
Filename class interface definition.
virtual void load(const GFilename &filename)
Load spectrum.
virtual void read(const GFits &file)
Read spectrum from FITS file.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
Definition: GTools.cpp:413
FITS table abstract base class interface definition.