|
GammaLib 2.2.0.dev
|
COSI space craft class. More...
#include <GCOSSpaceCraft.hpp>
Public Member Functions | |
| GCOSSpaceCraft (void) | |
| Void constructor. | |
| GCOSSpaceCraft (const GFilename &filename) | |
| Filename constructor. | |
| GCOSSpaceCraft (const GCOSSpaceCraft &spacecraft) | |
| Copy constructor. | |
| virtual | ~GCOSSpaceCraft (void) |
| Destructor. | |
| GCOSSpaceCraft & | operator= (const GCOSSpaceCraft &spacecraft) |
| Assignment operator. | |
| GCOSPointing & | operator[] (const int &index) |
| Return reference to COSI pointing. | |
| const GCOSPointing & | operator[] (const int &index) const |
| Return reference to COSI pointing (const version) | |
| void | clear (void) |
| Clear space craft. | |
| GCOSSpaceCraft * | clone (void) const |
| Clone space craft. | |
| std::string | classname (void) const |
| Return class name. | |
| bool | is_empty (void) const |
| Signals whether there are no pointing entries. | |
| int | size (void) const |
| Return number of pointing entries. | |
| const GGti & | gti (void) const |
| Return Good Time Intervals. | |
| const std::vector< double > & | livetimes (void) const |
| Return vector of livetimes. | |
| const double & | ontime (void) const |
| Return ontime in seconds. | |
| const double & | livetime (void) const |
| Return livetime in seconds. | |
| double | livetime (const GSkyDir &dir) const |
| Compute livetime for a given sky direction. | |
| GSkyMap | livetime (const GSkyMap &map) const |
| Compute livetime for a sky map. | |
| const double & | deadc (void) const |
| Return deadtime correction factor. | |
| void | load (const GFilename &filename) |
| Load COSI space craft file. | |
| void | save (const GFilename &filename, const bool &clobber=false) const |
| Save COSI space craft FITS file. | |
| void | read (const GFits &fits) |
| Read COSI space craft FITS file. | |
| void | write (GFits &fits) const |
| Write COSI space craft into FITS file. | |
| std::string | print (const GChatter &chatter=NORMAL) const |
| Print space craft information. | |
Public Member Functions inherited from GBase | |
| virtual | ~GBase (void) |
| Destructor. | |
Protected Member Functions | |
| void | init_members (void) |
| Initialise class members. | |
| void | copy_members (const GCOSSpaceCraft &spacecraft) |
| Copy class members. | |
| void | free_members (void) |
| Delete class members. | |
| void | load_ori (const GFilename &filename) |
| Load COSI space craft file from ORI file. | |
| void | load_fits (const GFilename &filename) |
| Load COSI space craft file from FITS file. | |
| void | read_pointings (const GFits &fits) |
| Read pointings from FITS file. | |
| void | read_livetimes (const GFits &fits) |
| Read livetimes from FITS file. | |
| void | write_pointings (GFits &fits) const |
| Write pointings into FITS file. | |
| void | write_livetimes (GFits &fits) const |
| Write livetimes into FITS file. | |
Protected Attributes | |
| GGti | m_gti |
| Good Time Intervals. | |
| std::vector< double > | m_livetimes |
| Livetimes for each Good Time Interval (sec) | |
| std::vector< GCOSPointing > | m_pointings |
| Pointings. | |
| double | m_ontime |
| Ontime (sec) | |
| double | m_livetime |
| Livetime (sec) | |
| double | m_deadc |
| Deadtime correction. | |
COSI space craft class.
The COSI space craft class provides spacecraft attitude and detector livetime information as function of time.
Definition at line 54 of file GCOSSpaceCraft.hpp.
| GCOSSpaceCraft::GCOSSpaceCraft | ( | void | ) |
Void constructor.
Definition at line 66 of file GCOSSpaceCraft.cpp.
References init_members().
Referenced by clone().
|
explicit |
Filename constructor.
| [in] | filename | Space craft file name. |
Definition at line 81 of file GCOSSpaceCraft.cpp.
References init_members(), and load().
| GCOSSpaceCraft::GCOSSpaceCraft | ( | const GCOSSpaceCraft & | spacecraft | ) |
Copy constructor.
| [in] | spacecraft | COSI space craft. |
Definition at line 99 of file GCOSSpaceCraft.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 116 of file GCOSSpaceCraft.hpp.
|
virtual |
Clear space craft.
Implements GBase.
Definition at line 217 of file GCOSSpaceCraft.cpp.
References free_members(), and init_members().
Referenced by GCOSObservation::init_members(), load_fits(), load_ori(), and read().
|
virtual |
Clone space craft.
Implements GBase.
Definition at line 235 of file GCOSSpaceCraft.cpp.
References GCOSSpaceCraft().
|
protected |
Copy class members.
| [in] | spacecraft | COSI space craft. |
Definition at line 512 of file GCOSSpaceCraft.cpp.
References m_deadc, m_gti, m_livetime, m_livetimes, m_ontime, and m_pointings.
Referenced by GCOSSpaceCraft(), and operator=().
|
inline |
Return deadtime correction factor.
Definition at line 200 of file GCOSSpaceCraft.hpp.
References m_deadc.
Referenced by GCOSObservation::load().
|
protected |
Delete class members.
Definition at line 530 of file GCOSSpaceCraft.cpp.
Referenced by clear(), operator=(), and ~GCOSSpaceCraft().
|
inline |
Return Good Time Intervals.
Definition at line 152 of file GCOSSpaceCraft.hpp.
References m_gti.
Referenced by GCOSObservation::load(), and read().
|
protected |
Initialise class members.
Definition at line 492 of file GCOSSpaceCraft.cpp.
References GGti::clear(), m_deadc, m_gti, m_livetime, m_livetimes, m_ontime, and m_pointings.
Referenced by clear(), GCOSSpaceCraft(), GCOSSpaceCraft(), GCOSSpaceCraft(), and operator=().
|
inline |
Signals whether there are no pointing entries.
Definition at line 128 of file GCOSSpaceCraft.hpp.
References m_pointings.
| double GCOSSpaceCraft::livetime | ( | const GSkyDir & | dir | ) | const |
Compute livetime for a given sky direction.
| [in] | dir | Sky direction. |
Computes the lifetime of a given sky direction taking into account only the time bins during which the source is not occulted by the Earth. The method assumes the Earth to be spherically symmetric with a radius of 6378 km.
Definition at line 251 of file GCOSSpaceCraft.cpp.
References GCOSPointing::altitude(), GSkyDir::dist(), GCOSPointing::earth_nadir(), GCOSPointing::livetime(), livetime(), m_pointings, and size().
Compute livetime for a sky map.
| [in] | map | Sky map. |
Computes the lifetime for the pixels of a sky map taking into account only the time bins during which the pixels are not occulted by the Earth. The method assumes the Earth to be spherically symmetric with a radius of 6378 km.
Definition at line 293 of file GCOSSpaceCraft.cpp.
References GCOSPointing::altitude(), GSkyDir::dist(), GCOSPointing::earth_nadir(), GSkyMap::extract(), GCOSPointing::livetime(), livetime(), m_pointings, and size().
|
inline |
Return livetime in seconds.
Definition at line 188 of file GCOSSpaceCraft.hpp.
References m_livetime.
Referenced by livetime(), livetime(), GCOSObservation::load(), load_ori(), and print().
|
inline |
Return vector of livetimes.
Definition at line 164 of file GCOSSpaceCraft.hpp.
References m_livetimes.
| void GCOSSpaceCraft::load | ( | const GFilename & | filename | ) |
Load COSI space craft file.
| [in] | filename | Space craft file name. |
Definition at line 347 of file GCOSSpaceCraft.cpp.
References GFilename::is_fits(), load_fits(), and load_ori().
Referenced by GCOSSpaceCraft(), and GCOSObservation::load().
|
protected |
Load COSI space craft file from FITS file.
| [in] | filename | Space craft FITS file name. |
Definition at line 704 of file GCOSSpaceCraft.cpp.
References clear(), GFits::close(), and read().
Referenced by load().
|
protected |
Load COSI space craft file from ORI file.
| [in] | filename | Space craft ORI file name. |
Load space craft information from an ORI file. The ORI file is a whitespace separated list of 10 values, with a trailer and footer line. This method does not depend on the existence of the trailer and footer line but it scans all lines that have exactly 10 entries.
The method computes the Good Time Intervals that are defined by the ORI file by collecting entries that have non-zero livetime in a single interval.
Definition at line 551 of file GCOSSpaceCraft.cpp.
References GCOSPointing::altitude(), GGti::append(), clear(), gammalib::cos_time(), GCOSPointing::earth_nadir(), GCOSPointing::earth_zenith(), gammalib::expand_env(), G_LOAD_ORI, GSkyDir::lb_deg(), GCOSPointing::livetime(), livetime(), m_deadc, m_gti, m_livetime, m_livetimes, m_ontime, m_pointings, gammalib::pi, GSkyDir::rotate(), GCOSPointing::sc_x(), GCOSPointing::sc_z(), size(), gammalib::split(), gammalib::strip_chars(), gammalib::strip_whitespace(), GCOSPointing::time(), gammalib::todouble(), and GFilename::url().
Referenced by load().
|
inline |
Return ontime in seconds.
Definition at line 176 of file GCOSSpaceCraft.hpp.
References m_ontime.
Referenced by GCOSObservation::load(), and print().
| GCOSSpaceCraft & GCOSSpaceCraft::operator= | ( | const GCOSSpaceCraft & | spacecraft | ) |
Assignment operator.
| [in] | spacecraft | COSI space craft. |
Definition at line 137 of file GCOSSpaceCraft.cpp.
References copy_members(), free_members(), and init_members().
| GCOSPointing & GCOSSpaceCraft::operator[] | ( | const int & | index | ) |
Return reference to COSI pointing.
| [in] | index | Pointing index [0,...,size()-1]. |
| GException::out_of_range | Pointing index outside valid range. |
Returns reference to a COSI pointing.
Definition at line 169 of file GCOSSpaceCraft.cpp.
References G_OPERATOR, m_pointings, and size().
| const GCOSPointing & GCOSSpaceCraft::operator[] | ( | const int & | index | ) | const |
Return reference to COSI pointing (const version)
| [in] | index | Pointing index [0,...,size()-1]. |
| GException::out_of_range | Pointing index outside valid range. |
Returns reference to a COSI pointing.
Definition at line 194 of file GCOSSpaceCraft.cpp.
References G_OPERATOR, m_pointings, and size().
Print space craft information.
| [in] | chatter | Chattiness. |
Implements GBase.
Definition at line 454 of file GCOSSpaceCraft.cpp.
References livetime(), m_deadc, m_gti, ontime(), gammalib::parformat(), GGti::print(), gammalib::reduce(), SILENT, size(), and gammalib::str().
| void GCOSSpaceCraft::read | ( | const GFits & | fits | ) |
Read COSI space craft FITS file.
| [in] | fits | FITS file. |
Read the COSI space craft information from a FITS file object.
Definition at line 398 of file GCOSSpaceCraft.cpp.
References clear(), gammalib::extname_gti, gti(), m_gti, GGti::read(), read_livetimes(), read_pointings(), and GFits::table().
Referenced by load_fits().
|
protected |
Read livetimes from FITS file.
| [in] | fits | FITS file. |
Read livetimes from FITS file.
Definition at line 800 of file GCOSSpaceCraft.cpp.
References m_livetimes, GFitsTable::nrows(), GFitsTableCol::real(), and GFits::table().
Referenced by read().
|
protected |
Read pointings from FITS file.
| [in] | fits | FITS file. |
Read pointings from FITS file.
Definition at line 730 of file GCOSSpaceCraft.cpp.
References gammalib::cos_time(), GSkyDir::lb_deg(), m_deadc, m_livetime, m_ontime, m_pointings, GFitsTable::nrows(), gammalib::pi, GFitsHDU::real(), GFitsTableCol::real(), GSkyDir::rotate(), and GFits::table().
Referenced by read().
| void GCOSSpaceCraft::save | ( | const GFilename & | filename, |
| const bool & | clobber = false ) const |
Save COSI space craft FITS file.
| [in] | filename | Space craft FITS file name. |
| [in] | clobber | Overwrite existing FITS file? |
Saves COSI space craft information into a FITS file.
Definition at line 372 of file GCOSSpaceCraft.cpp.
References GFits::close(), GFits::saveto(), and write().
|
inline |
Return number of pointing entries.
Definition at line 140 of file GCOSSpaceCraft.hpp.
References m_pointings.
Referenced by livetime(), livetime(), load_ori(), operator[](), operator[](), print(), write(), and write_pointings().
| void GCOSSpaceCraft::write | ( | GFits & | fits | ) | const |
Write COSI space craft into FITS file.
| [in] | fits | FITS file. |
Write the COSI space craft into FITS file.
Definition at line 427 of file GCOSSpaceCraft.cpp.
References m_gti, size(), GGti::write(), write_livetimes(), and write_pointings().
Referenced by save().
|
protected |
Write livetimes into FITS file.
| [in] | fits | FITS file. |
Write livetimes into FITS file.
Definition at line 916 of file GCOSSpaceCraft.cpp.
References GFits::append(), GFitsTable::append(), GFitsHDU::card(), GFitsHDU::extname(), m_deadc, m_livetime, m_livetimes, m_ontime, and GFitsTableCol::unit().
Referenced by write().
|
protected |
Write pointings into FITS file.
| [in] | fits | FITS file. |
Write pointings into FITS file.
Definition at line 836 of file GCOSSpaceCraft.cpp.
References GFits::append(), GFitsTable::append(), GFitsHDU::card(), gammalib::cos_seconds(), GFitsHDU::extname(), m_deadc, m_livetime, m_ontime, m_pointings, size(), and GFitsTableCol::unit().
Referenced by write().
|
protected |
Deadtime correction.
Definition at line 106 of file GCOSSpaceCraft.hpp.
Referenced by copy_members(), deadc(), init_members(), load_ori(), print(), read_pointings(), write_livetimes(), and write_pointings().
|
protected |
Good Time Intervals.
Definition at line 101 of file GCOSSpaceCraft.hpp.
Referenced by copy_members(), gti(), init_members(), load_ori(), print(), read(), and write().
|
protected |
Livetime (sec)
Definition at line 105 of file GCOSSpaceCraft.hpp.
Referenced by copy_members(), init_members(), livetime(), load_ori(), read_pointings(), write_livetimes(), and write_pointings().
|
protected |
Livetimes for each Good Time Interval (sec)
Definition at line 102 of file GCOSSpaceCraft.hpp.
Referenced by copy_members(), init_members(), livetimes(), load_ori(), read_livetimes(), and write_livetimes().
|
protected |
Ontime (sec)
Definition at line 104 of file GCOSSpaceCraft.hpp.
Referenced by copy_members(), init_members(), load_ori(), ontime(), read_pointings(), write_livetimes(), and write_pointings().
|
protected |
Pointings.
Definition at line 103 of file GCOSSpaceCraft.hpp.
Referenced by copy_members(), init_members(), is_empty(), livetime(), livetime(), load_ori(), operator[](), operator[](), read_pointings(), size(), and write_pointings().