GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GPulsar Class Reference

Pulsar class. More...

#include <GPulsar.hpp>

Inheritance diagram for GPulsar:
GBase

Public Member Functions

 GPulsar (void)
 Void constructor. More...
 
 GPulsar (const GFilename &filename, const std::string &name="")
 Filename constructor. More...
 
 GPulsar (const GPulsar &pulsar)
 Copy constructor. More...
 
virtual ~GPulsar (void)
 Destructor. More...
 
GPulsaroperator= (const GPulsar &pulsar)
 Assignment operator. More...
 
GPulsarEphemerisoperator[] (const int &index)
 Return reference to ephemeris. More...
 
const GPulsarEphemerisoperator[] (const int &index) const
 Return reference to ephemeris (const version) More...
 
virtual void clear (void)
 Clear Pulsar. More...
 
virtual GPulsarclone (void) const
 Clone Pulsar. More...
 
virtual std::string classname (void) const
 Return class name. More...
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print Pulsar. More...
 
int size (void) const
 Return number of ephemerides for pulsar. More...
 
bool is_empty (void) const
 Signals if there are no ephemerides for pulsar. More...
 
GPulsarEphemerisat (const int &index)
 Return reference to ephemeris. More...
 
const GPulsarEphemerisat (const int &index) const
 Return reference to ephemeris (const version) More...
 
const std::string & name (void) const
 Return pulsar name. More...
 
void name (const std::string &name)
 Set pulsar name. More...
 
const GPulsarEphemerisephemeris (const GTime &time) const
 Return pulsar ephemeris. More...
 
GGti validity (void) const
 Return validity intervals of pulsar ephemerides. More...
 
void load (const GFilename &filename, const std::string &name="")
 Load Pulsar from ephemerides file. More...
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor. More...
 

Protected Member Functions

void init_members (void)
 Initialise class members. More...
 
void copy_members (const GPulsar &pulsar)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void load_fits (const GFilename &filename, const std::string &name="")
 Load Pulsar from ephemerides FITS file. More...
 
void load_integral (const GFitsTable *table, const std::string &name="")
 Load Pulsar from INTEGRAL ephemerides FITS table. More...
 
void load_fermi (const GFitsTable *table, const std::string &name="")
 Load Pulsar from Fermi ephemerides FITS table. More...
 
void load_psrtime (const GFilename &filename, const std::string &name="")
 Load Pulsar from ephemerides psrtime file. More...
 
void load_parfile (const GFilename &filename)
 Load Pulsar from ephemeris par file. More...
 

Protected Attributes

std::string m_name
 Pulsar name. More...
 
std::vector< GPulsarEphemerism_ephemerides
 Pulsar ephemerides. More...
 

Detailed Description

Pulsar class.

This class implements a pulsar, defined by a name and a list of pulsar ephemerides.

Definition at line 53 of file GPulsar.hpp.

Constructor & Destructor Documentation

GPulsar::GPulsar ( void  )

Void constructor.

Definition at line 65 of file GPulsar.cpp.

References init_members().

Referenced by clone().

GPulsar::GPulsar ( const GFilename filename,
const std::string &  name = "" 
)

Filename constructor.

Parameters
[in]filenameFile name of pulsar ephemerides
[in]namePulsar name

Constructs a pulsar from an ephemerides file. In case that several pulsars are present in the specified ephemerides file the name of the pulsar that should be constructed is to be specified.

Definition at line 85 of file GPulsar.cpp.

References init_members(), and load().

GPulsar::GPulsar ( const GPulsar pulsar)

Copy constructor.

Parameters
[in]pulsarPulsar.

Definition at line 103 of file GPulsar.cpp.

References copy_members(), and init_members().

GPulsar::~GPulsar ( void  )
virtual

Destructor.

Definition at line 119 of file GPulsar.cpp.

References free_members().

Member Function Documentation

GPulsarEphemeris & GPulsar::at ( const int &  index)

Return reference to ephemeris.

Parameters
[in]indexEphemeris index [0,...,size()-1].
Exceptions
GException::out_of_rangeEphemeris index is out of range.

Returns a reference to the ephemeris with the specified index.

Definition at line 204 of file GPulsar.cpp.

References G_AT, m_ephemerides, and size().

const GPulsarEphemeris & GPulsar::at ( const int &  index) const

Return reference to ephemeris (const version)

Parameters
[in]indexEphemeris index [0,...,size()-1].
Exceptions
GException::out_of_rangeEphemeris index is out of range.

Returns a const reference to the ephemeris with the specified index.

Definition at line 228 of file GPulsar.cpp.

References G_AT, m_ephemerides, and size().

std::string GPulsar::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GPulsar").

Implements GBase.

Definition at line 136 of file GPulsar.hpp.

void GPulsar::clear ( void  )
virtual

Clear Pulsar.

Implements GBase.

Definition at line 171 of file GPulsar.cpp.

References free_members(), and init_members().

Referenced by GCOMSelection::init_members(), and load().

GPulsar * GPulsar::clone ( void  ) const
virtual

Clone Pulsar.

Returns
Pointer to deep copy of Pulsar.

Implements GBase.

Definition at line 189 of file GPulsar.cpp.

References GPulsar().

void GPulsar::copy_members ( const GPulsar pulsar)
protected

Copy class members.

Parameters
[in]pulsarPulsar.

Definition at line 450 of file GPulsar.cpp.

References m_ephemerides, and m_name.

Referenced by GPulsar(), and operator=().

const GPulsarEphemeris & GPulsar::ephemeris ( const GTime time) const

Return pulsar ephemeris.

param[in] time Time.

Returns
Pulsar ephemeris.
Exceptions
GException::invalid_argumentNo valid ephemeris found for specified time.

Returns the pulsar ephemeris as function of time.

Definition at line 253 of file GPulsar.cpp.

References G_EPHEMERIS, m_ephemerides, GTime::mjd(), size(), and gammalib::str().

Referenced by GCOMDri::compute_dre(), load_fermi(), load_integral(), load_parfile(), and load_psrtime().

void GPulsar::free_members ( void  )
protected

Delete class members.

Definition at line 464 of file GPulsar.cpp.

Referenced by clear(), operator=(), and ~GPulsar().

void GPulsar::init_members ( void  )
protected

Initialise class members.

Definition at line 434 of file GPulsar.cpp.

References m_ephemerides, and m_name.

Referenced by clear(), GPulsar(), and operator=().

bool GPulsar::is_empty ( void  ) const
inline

Signals if there are no ephemerides for pulsar.

Returns
True if there are no ephemerides for pulsar, false otherwise.

Signals if there are no ephemerides for pulsar.

Definition at line 164 of file GPulsar.hpp.

References m_ephemerides.

Referenced by GCOMSelection::print(), and print().

void GPulsar::load ( const GFilename filename,
const std::string &  name = "" 
)

Load Pulsar from ephemerides file.

Parameters
[in]filenameFile name of pulsar ephemerides
[in]namePulsar name
Exceptions
GException::file_errorCould not open specified file as an ASCII file

Load a pulsar from an ephemerides file. In case that several pulsars are present in the specified ephemerides file the name of the pulsar that should be constructed is to be specified.

Definition at line 314 of file GPulsar.cpp.

References clear(), G_LOAD, GFilename::is_fits(), load_fits(), load_parfile(), load_psrtime(), gammalib::split(), and GFilename::url().

Referenced by GPulsar().

void GPulsar::load_fermi ( const GFitsTable table,
const std::string &  name = "" 
)
protected

Load Pulsar from Fermi ephemerides FITS table.

Parameters
[in]tableFermi ephemerides FITS table
[in]namePulsar name
Exceptions
GException::invalid_argumentSpecified pulsar name not found in FITS table

Load a pulsar from Fermi ephemerides FITS table.

Definition at line 632 of file GPulsar.cpp.

References GPulsarEphemeris::dir(), ephemeris(), GPulsarEphemeris::f0(), GPulsarEphemeris::f1(), GPulsarEphemeris::f2(), G_LOAD_FERMI, GFitsTableCol::integer(), m_ephemerides, m_name, GTime::mjd(), GPulsarEphemeris::name(), name(), GFitsTableCol::nrows(), GPulsarEphemeris::phase(), GSkyDir::radec_deg(), GFitsTableCol::real(), gammalib::sec_in_day, GFitsTableCol::string(), GPulsarEphemeris::t0(), GPulsarEphemeris::tstart(), and GPulsarEphemeris::tstop().

Referenced by load_fits().

void GPulsar::load_fits ( const GFilename filename,
const std::string &  name = "" 
)
protected

Load Pulsar from ephemerides FITS file.

Parameters
[in]filenameName of pulsar ephemerides FITS file
[in]namePulsar name
Exceptions
GException::file_errorFITS file format not recognised

Load a pulsar from an ephemerides FITS file. In case that several pulsars are present in the specified ephemerides file the name of the pulsar that should be constructed is to be specified.

Definition at line 484 of file GPulsar.cpp.

References GFits::contains(), G_LOAD_FITS, load_fermi(), load_integral(), GFits::table(), and GFilename::url().

Referenced by load().

void GPulsar::load_integral ( const GFitsTable table,
const std::string &  name = "" 
)
protected

Load Pulsar from INTEGRAL ephemerides FITS table.

Parameters
[in]tableINTEGRAL ephemerides FITS table
[in]namePulsar name
Exceptions
GException::invalid_argumentSpecified pulsar name not found in FITS table

Load a pulsar from INTEGRAL ephemerides FITS table. In the INTEGRAL format only a single pulsar will be present in the FITS file, specified by the SOURCEID keyword.

Definition at line 529 of file GPulsar.cpp.

References GPulsarEphemeris::dir(), ephemeris(), GPulsarEphemeris::f0(), GPulsarEphemeris::f1(), GPulsarEphemeris::f2(), G_LOAD_INTEGRAL, m_ephemerides, m_name, GTime::mjd(), GPulsarEphemeris::name(), GFitsTableCol::nrows(), GPulsarEphemeris::phase(), GSkyDir::radec_deg(), GFitsTableCol::real(), GFitsHDU::real(), GFitsHDU::string(), GPulsarEphemeris::t0(), GPulsarEphemeris::tstart(), and GPulsarEphemeris::tstop().

Referenced by load_fits().

void GPulsar::load_parfile ( const GFilename filename)
protected

Load Pulsar from ephemeris par file.

Parameters
[in]filenameName of pulsar ephemeris par file
Exceptions
GException::file_errorCould not open ephemeris ASCII file
GException::invalid_argumentNo valid Right Ascension and Declination found

Load a pulsar from an ephemeris par file.

Definition at line 885 of file GPulsar.cpp.

References GPulsarEphemeris::dir(), ephemeris(), GPulsarEphemeris::f0(), GPulsarEphemeris::f1(), GPulsarEphemeris::f2(), G_LOAD_PARFILE, m_ephemerides, m_name, GTime::mjd(), GPulsarEphemeris::name(), GSkyDir::radec_deg(), gammalib::rstrip_chars(), gammalib::split(), gammalib::str(), GPulsarEphemeris::t0(), gammalib::todouble(), GPulsarEphemeris::tstart(), GPulsarEphemeris::tstop(), and GFilename::url().

Referenced by load().

void GPulsar::load_psrtime ( const GFilename filename,
const std::string &  name = "" 
)
protected

Load Pulsar from ephemerides psrtime file.

Parameters
[in]filenameName of pulsar ephemerides psrtime file
[in]namePulsar name
Exceptions
GException::file_errorCould not open ephemerides ASCII file
GException::invalid_argumentNo pulsar name specified for a file that contains multiple pulsars

Load a pulsar from an ephemerides psrtime file. In case that several pulsars are present in the specified ephemerides file the name of the pulsar that should be constructed is to be specified.

Definition at line 740 of file GPulsar.cpp.

References GPulsarEphemeris::dir(), ephemeris(), GPulsarEphemeris::f0(), GPulsarEphemeris::f1(), GPulsarEphemeris::f2(), G_LOAD_PSRTIME, GEphemerides::geo2ssb(), m_ephemerides, m_name, GTime::mjd(), GPulsarEphemeris::name(), name(), GPulsarEphemeris::phase(), GSkyDir::radec_deg(), gammalib::replace_segment(), gammalib::sec_in_day, gammalib::split(), GPulsarEphemeris::t0(), GPulsarEphemeris::timesys(), gammalib::todouble(), GPulsarEphemeris::tstart(), GPulsarEphemeris::tstop(), GFilename::url(), and GTime::utc2tt().

Referenced by load().

const std::string & GPulsar::name ( void  ) const
inline

Return pulsar name.

Returns
Pulsar name

Definition at line 176 of file GPulsar.hpp.

References m_name.

Referenced by load_fermi(), load_psrtime(), and name().

void GPulsar::name ( const std::string &  name)
inline

Set pulsar name.

Parameters
[in]namePulsar name.

Definition at line 188 of file GPulsar.hpp.

References m_name, and name().

GPulsar & GPulsar::operator= ( const GPulsar pulsar)

Assignment operator.

Parameters
[in]pulsarPulsar.
Returns
Pulsar.

Definition at line 141 of file GPulsar.cpp.

References copy_members(), free_members(), and init_members().

GPulsarEphemeris & GPulsar::operator[] ( const int &  index)
inline

Return reference to ephemeris.

Parameters
[in]indexEphemeris index [0,...,size()-1].

Returns a reference to the ephemeris with the specified index.

Definition at line 110 of file GPulsar.hpp.

References m_ephemerides.

const GPulsarEphemeris & GPulsar::operator[] ( const int &  index) const
inline

Return reference to ephemeris (const version)

Parameters
[in]indexEphemeris index [0,...,size()-1].

Returns a const reference to the ephemeris with the specified index.

Definition at line 124 of file GPulsar.hpp.

References m_ephemerides.

std::string GPulsar::print ( const GChatter chatter = NORMAL) const
virtual

Print Pulsar.

Parameters
[in]chatterChattiness.
Returns
String containing Pulsar information.

Implements GBase.

Definition at line 381 of file GPulsar.cpp.

References EXPLICIT, is_empty(), m_ephemerides, m_name, GTime::mjd(), gammalib::parformat(), SILENT, gammalib::str(), GGti::tstart(), GGti::tstop(), GTime::utc(), and validity().

Referenced by GCOMSelection::print().

int GPulsar::size ( void  ) const
inline

Return number of ephemerides for pulsar.

Returns
Number of ephemerides for pulsar.

Returns the number of ephemerides for pulsar.

Definition at line 150 of file GPulsar.hpp.

References m_ephemerides.

Referenced by at(), ephemeris(), and validity().

GGti GPulsar::validity ( void  ) const

Return validity intervals of pulsar ephemerides.

Returns
Validity intervals of pulsar ephemerides.

Returns the validity intervals of pulsar ephemerides as Good Time Intervals.

Definition at line 286 of file GPulsar.cpp.

References GGti::append(), m_ephemerides, and size().

Referenced by GCOMDri::compute_dre(), GCOMDri::compute_drg(), GCOMDris::compute_drws_energy(), GCOMDris::compute_drws_phibar(), GCOMDri::compute_drx(), print(), GCOMDris::vetorate_generate(), and GCOMDris::vetorate_setup().

Member Data Documentation

std::vector<GPulsarEphemeris> GPulsar::m_ephemerides
protected
std::string GPulsar::m_name
protected

Pulsar name.

Definition at line 97 of file GPulsar.hpp.

Referenced by copy_members(), init_members(), load_fermi(), load_integral(), load_parfile(), load_psrtime(), name(), and print().


The documentation for this class was generated from the following files: