Commit 7ca5c0c58a051dc989176afbc2c698a0cc3a5a36

Authored by knodlseder
1 parent e2d77d47

initial version

pyext/GEbounds.i 0 โ†’ 100644
  1 +/***************************************************************************
  2 + * GEbounds.i - Energy boundary class python I/F *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  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 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GEbounds.i
  15 + * @brief GEbounds class python interface
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "GEbounds.hpp"
  21 +%}
  22 +
  23 +
  24 +/***********************************************************************//**
  25 + * @class GEbounds
  26 + *
  27 + * @brief Interface for the GEbounds class.
  28 + *
  29 + * This class holds a list of energy intervals that are used for science
  30 + * analysis.
  31 + ***************************************************************************/
  32 +class GEbounds {
  33 +public:
  34 + // Constructors and destructors
  35 + GEbounds(void);
  36 + GEbounds(const GEbounds& ebds);
  37 + virtual ~GEbounds(void);
  38 +
  39 + // Methods
  40 + void clear(void);
  41 + void append(const GEnergy& emin, const GEnergy& emax);
  42 + void insert(const GEnergy& emin, const GEnergy& emax);
  43 + void setlin(const GEnergy& emin, const GEnergy& emax, const int& num);
  44 + void setlog(const GEnergy& emin, const GEnergy& emax, const int& num);
  45 + void load(const std::string& filename,
  46 + const std::string& extname = "EBOUNDS");
  47 + void save(const std::string& filename, bool clobber,
  48 + const std::string& extname = "EBOUNDS");
  49 + void read(GFitsTable* hdu);
  50 + void write(GFits* file, const std::string& extname = "EBOUNDS");
  51 + int index(const GEnergy& eng) const;
  52 + int size(void) const { return m_num; }
  53 + GEnergy emin(void) const { return m_emin; }
  54 + GEnergy emax(void) const { return m_emax; }
  55 + GEnergy emin(int inx) const;
  56 + GEnergy emax(int inx) const;
  57 + GEnergy emean(int inx) const;
  58 + GEnergy elogmean(int inx) const;
  59 + bool isin(const GEnergy& eng) const;
  60 +};
  61 +
  62 +
  63 +/***********************************************************************//**
  64 + * @brief GEbounds class extension
  65 + ***************************************************************************/
  66 +%extend GEbounds {
  67 + /*
  68 + char *__str__() {
  69 + static std::string result = self->print();
  70 + return ((char*)result.c_str());
  71 + }
  72 + */
  73 + GEbounds copy() {
  74 + return (*self);
  75 + }
  76 +};
... ...
pyext/GEnergy.i 0 โ†’ 100644
  1 +/***************************************************************************
  2 + * GEnergy.i - Energy class python I/F *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  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 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GEnergy.i
  15 + * @brief GEnergy class python interface
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "GEnergy.hpp"
  21 +%}
  22 +
  23 +
  24 +/***********************************************************************//**
  25 + * @class GEnergy
  26 + *
  27 + * @brief Class that handles energies in a unit independent way.
  28 + *
  29 + * The GEnergy class stores an energy value in units of MeV and implements
  30 + * methods that provide automatic conversion of the energy values in other
  31 + * units. This makes instrument specific implementations more robust and
  32 + * reduces the risk of unit errors.
  33 + ***************************************************************************/
  34 +class GEnergy {
  35 + // Operator friends
  36 + /*
  37 + friend GEnergy operator+ (const GEnergy &a, const GEnergy &b);
  38 + friend GEnergy operator- (const GEnergy &a, const GEnergy &b);
  39 + friend GEnergy operator* (const double &a, const GEnergy &b);
  40 + friend GEnergy operator* (const GEnergy &a, const double &b);
  41 + friend GEnergy operator/ (const GEnergy &a, const double &b);
  42 + friend bool operator== (const GEnergy &a, const GEnergy &b);
  43 + friend bool operator!= (const GEnergy &a, const GEnergy &b);
  44 + friend bool operator< (const GEnergy &a, const GEnergy &b);
  45 + friend bool operator<= (const GEnergy &a, const GEnergy &b);
  46 + friend bool operator> (const GEnergy &a, const GEnergy &b);
  47 + friend bool operator>= (const GEnergy &a, const GEnergy &b);
  48 + */
  49 +
  50 +public:
  51 + // Constructors and destructors
  52 + GEnergy(void);
  53 + GEnergy(const GEnergy& eng);
  54 + ~GEnergy(void);
  55 +
  56 + // Operators
  57 + GEnergy& operator+= (const GEnergy& eng);
  58 + GEnergy& operator-= (const GEnergy& eng);
  59 +
  60 + // Methods
  61 + void clear(void) { m_energy = 0.0; }
  62 + double erg(void) const;
  63 + double keV(void) const;
  64 + double MeV(void) const;
  65 + double GeV(void) const;
  66 + double TeV(void) const;
  67 + void erg(const double& eng);
  68 + void keV(const double& eng);
  69 + void MeV(const double& eng);
  70 + void GeV(const double& eng);
  71 + void TeV(const double& eng);
  72 +};
  73 +
  74 +
  75 +/***********************************************************************//**
  76 + * @brief GEnergy class extension
  77 + ***************************************************************************/
  78 +%extend GEnergy {
  79 + char *__str__() {
  80 + static std::string result = self->print();
  81 + return ((char*)result.c_str());
  82 + }
  83 + GEnergy copy() {
  84 + return (*self);
  85 + }
  86 +};
... ...
pyext/GEvent.i 0 โ†’ 100644
  1 +/***************************************************************************
  2 + * GEvent.i - Abstract event class python I/F *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  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 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GEvent.i
  15 + * @brief GEvent class python interface
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "GEvent.hpp"
  21 +%}
  22 +
  23 +
  24 +/***********************************************************************//**
  25 + * @class GEvent
  26 + *
  27 + * @brief Abstract interface for the event classes.
  28 + *
  29 + * This class provides an abstract interface to an event. An event can be
  30 + * either a physical event occuring in the instrument (called an event
  31 + * atom) or a collection of events with similar properties (called an
  32 + * event bin). While event atoms are used for unbinned analysis, event bins
  33 + * are used for binned analysis. The methods isatom() and isbin() inform
  34 + * whether an event is an atom or a bin.
  35 + *
  36 + * Each event has 3 attributes: energy, instrument direction and time.
  37 + * These attributes can be accessed and changed through the energy(),
  38 + * dir(), and time() methods.
  39 + *
  40 + * The counts() and error() methods return the number of counts and the
  41 + * error in this number for each event. For event atoms the number of
  42 + * counts is 1 and the error is 0. The event bins, the number of counts
  43 + * is the number of events within a bin, and error is the uncertainty in
  44 + * this number (typically the square root of the number, yet also other
  45 + * schemes may be implemented).
  46 + *
  47 + * The size() method returns the size of an event bin, which is the
  48 + * quantity that has to be multiplied by the probability for an event to
  49 + * occur to predict the number of events in a bin. For event atoms this
  50 + * quantity is by definition 1. For event bins, the size is the solid
  51 + * angle of the event bin times the energy width times the ontime interval
  52 + * covered by the events.
  53 + *
  54 + * The GEvent class does not hold any data members. Data members are stored
  55 + * in the derived classes.
  56 + ***************************************************************************/
  57 +class GEvent {
  58 +
  59 +public:
  60 + // Constructors and destructors
  61 + GEvent(void);
  62 + GEvent(const GEvent& event);
  63 + virtual ~GEvent(void);
  64 +
  65 + // Event access methods
  66 + virtual const GInstDir& dir(void) const = 0;
  67 + virtual const GEnergy& energy(void) const = 0;
  68 + virtual const GTime& time(void) const = 0;
  69 + virtual double counts(void) const = 0;
  70 + virtual double error(void) const = 0;
  71 +
  72 + // Other methods
  73 + virtual void clear(void) = 0;
  74 + virtual GEvent* clone(void) const = 0;
  75 + virtual double size(void) const = 0;
  76 + virtual bool isatom(void) const = 0;
  77 + virtual bool isbin(void) const = 0;
  78 +};
  79 +
  80 +
  81 +/***********************************************************************//**
  82 + * @brief GEvent class extension
  83 + ***************************************************************************/
  84 +%extend GEvent {
  85 + /*
  86 + char *__str__() {
  87 + static std::string result = self->print();
  88 + return ((char*)result.c_str());
  89 + }
  90 + */
  91 +};
... ...
pyext/GEventAtom.i 0 โ†’ 100644
  1 +/***************************************************************************
  2 + * GEventAtom.i - Abstract event atom class python I/F *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  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 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GEventAtom.i
  15 + * @brief GEventAtom class python interface
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "GEventAtom.hpp"
  21 +%}
  22 +
  23 +
  24 +/***********************************************************************//**
  25 + * @class GEventAtom
  26 + *
  27 + * @brief Abstract interface for the event atom class.
  28 + *
  29 + * An event atom is a single event occuring in an instrument. Event atoms
  30 + * are used for unbinned analysis.
  31 + *
  32 + * Each event has 3 attributes: energy, instrument direction and time.
  33 + * These attributes can be accessed and changed through the energy(),
  34 + * dir(), and time() methods.
  35 + *
  36 + * The counts() and error() methods return the number of counts and the
  37 + * error in this number for each event. For event atoms the number of
  38 + * counts is 1 and the error is 0.
  39 + *
  40 + * The size() method returns the size of an event bin ,which is the
  41 + * quantity that has to be multiplied by the probability for an event to
  42 + * occur to predict the number of events in a bin. For event atoms this
  43 + * quantity is by definition 1.
  44 + *
  45 + * The GEventAtom class does not hold any data members. Data members are
  46 + * stored in the derived classes.
  47 + ***************************************************************************/
  48 +class GEventAtom : public GEvent {
  49 +public:
  50 + // Constructors and destructors
  51 + GEventAtom(void);
  52 + GEventAtom(const GEventAtom& atom);
  53 + virtual ~GEventAtom(void);
  54 +
  55 + // Event access methods
  56 + virtual const GInstDir& dir(void) const = 0;
  57 + virtual const GEnergy& energy(void) const = 0;
  58 + virtual const GTime& time(void) const = 0;
  59 + double counts(void) const { return 1.0; }
  60 + double error(void) const { return 0.0; }
  61 +
  62 + // Other methods
  63 + virtual void clear(void) = 0;
  64 + virtual double size(void) const { return 1.0; }
  65 + virtual GEventAtom* clone(void) const = 0;
  66 + virtual bool isatom(void) const { return true; }
  67 + virtual bool isbin(void) const { return false; }
  68 +};
  69 +
  70 +
  71 +/***********************************************************************//**
  72 + * @brief GEventAtom class extension
  73 + ***************************************************************************/
  74 +%extend GEventAtom {
  75 + /*
  76 + char *__str__() {
  77 + static std::string result = self->print();
  78 + return ((char*)result.c_str());
  79 + }
  80 + */
  81 +};
... ...
pyext/GEventBin.i 0 โ†’ 100644
  1 +/***************************************************************************
  2 + * GEventBin.i - Abstract event bin class python I/F *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  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 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GEventBin.i
  15 + * @brief GEventBin class python interface
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "GEventBin.hpp"
  21 +%}
  22 +
  23 +
  24 +/***********************************************************************//**
  25 + * @class GEventBin
  26 + *
  27 + * @brief Abstract interface for the event bin class.
  28 + *
  29 + * An event bin is a collection of event atoms with similar properties.
  30 + * Event bins are used for binned analysis.
  31 + *
  32 + * Each event has 3 attributes: energy, instrument direction and time.
  33 + * These attributes can be accessed and changed through the energy(),
  34 + * dir(), and time() methods.
  35 + *
  36 + * The counts() and error() methods return the number of events within an
  37 + * event bin and the uncertainty in this number, which by default is
  38 + * given by the square root of the number of events (this is the default
  39 + * implementation provided by this class).
  40 + *
  41 + * The size() method returns the size of an event bin, which is the
  42 + * quantity that has to be multiplied by the probability for an event to
  43 + * occur to predict the number of events in a bin). The size is the solid
  44 + * angle of the event bin times the energy width times the ontime interval
  45 + * covered by the events.
  46 + *
  47 + * The GEventBin class does not hold any data members. Data members are
  48 + * stored in the derived classes.
  49 + ***************************************************************************/
  50 +class GEventBin : public GEvent {
  51 +public:
  52 + // Constructors and destructors
  53 + GEventBin(void);
  54 + GEventBin(const GEventBin& bin);
  55 + virtual ~GEventBin(void);
  56 +
  57 + // Event access methods
  58 + virtual const GInstDir& dir(void) const = 0;
  59 + virtual const GEnergy& energy(void) const = 0;
  60 + virtual const GTime& time(void) const = 0;
  61 + virtual double counts(void) const = 0;
  62 + virtual double error(void) const;
  63 +
  64 + // Other methods
  65 + virtual void clear(void) = 0;
  66 + virtual double size(void) const = 0;
  67 + virtual GEventBin* clone(void) const = 0;
  68 + bool isatom(void) const { return false; }
  69 + bool isbin(void) const { return true; }
  70 +};
  71 +
  72 +
  73 +/***********************************************************************//**
  74 + * @brief GEventBin class extension
  75 + ***************************************************************************/
  76 +%extend GEventBin {
  77 + /*
  78 + char *__str__() {
  79 + static std::string result = self->print();
  80 + return ((char*)result.c_str());
  81 + }
  82 + */
  83 +};
... ...
pyext/GEventCube.i 0 โ†’ 100644
  1 +/***************************************************************************
  2 + * GEventCube.i - Abstract event cube container class python I/F *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  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 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GEventCube.i
  15 + * @brief GEventCube class python interface
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "GEventCube.hpp"
  21 +%}
  22 +
  23 +
  24 +/***********************************************************************//**
  25 + * @class GEventCube
  26 + *
  27 + * @brief GEventCube container class interface defintion.
  28 + ***************************************************************************/
  29 +class GEventCube : public GEvents {
  30 +public:
  31 + // Constructors and destructors
  32 + GEventCube(void);
  33 + GEventCube(const GEventCube& cube);
  34 + virtual ~GEventCube(void);
  35 +
  36 + // Pure virtual methods
  37 + virtual void clear(void) = 0;
  38 + virtual GEventCube* clone(void) const = 0;
  39 + virtual void load(const std::string& filename) = 0;
  40 + virtual GEvent* pointer(int index) = 0;
  41 + virtual int number(void) const = 0;
  42 +
  43 + // Implemented pure virtual methods
  44 + int size(void) const { return m_elements; }
  45 + int dim(void) const { return m_dim; }
  46 + int naxis(int axis) const;
  47 + bool islist(void) const { return false; }
  48 + bool iscube(void) const { return true; }
  49 +};
  50 +
  51 +
  52 +/***********************************************************************//**
  53 + * @brief GEventCube class extension
  54 + ***************************************************************************/
  55 +%extend GEventCube {
  56 + /*
  57 + char *__str__() {
  58 + static std::string result = self->print();
  59 + return ((char*)result.c_str());
  60 + }
  61 + */
  62 +};
... ...
pyext/GEventList.i 0 โ†’ 100644
  1 +/***************************************************************************
  2 + * GEventList.i - Abstract event list container class python I/F *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  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 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GEventList.i
  15 + * @brief GEventList class python interface
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "GEventList.hpp"
  21 +%}
  22 +
  23 +
  24 +/***********************************************************************//**
  25 + * @class GEventList
  26 + *
  27 + * @brief GEventList container class interface defintion.
  28 + ***************************************************************************/
  29 +class GEventList : public GEvents {
  30 +public:
  31 + // Constructors and destructors
  32 + GEventList();
  33 + GEventList(const GEventList& list);
  34 + virtual ~GEventList();
  35 +
  36 + // Pure virtual methods
  37 + virtual void clear(void) = 0;
  38 + virtual GEventList* clone(void) const = 0;
  39 + virtual void load(const std::string& filename) = 0;
  40 + virtual GEventAtom* pointer(int index) = 0;
  41 + virtual int number(void) const = 0;
  42 + virtual int size(void) const = 0;
  43 +
  44 + // Implemented pure virtul methods
  45 + bool islist(void) const { return true; }
  46 + bool iscube(void) const { return false; }
  47 +};
  48 +
  49 +
  50 +/***********************************************************************//**
  51 + * @brief GEventList class extension
  52 + ***************************************************************************/
  53 +%extend GEventList {
  54 + /*
  55 + char *__str__() {
  56 + static std::string result = self->print();
  57 + return ((char*)result.c_str());
  58 + }
  59 + */
  60 +};
... ...
pyext/GEvents.i 0 โ†’ 100644
  1 +/***************************************************************************
  2 + * GEvents.i - Event container class python I/F *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  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 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GEvents.i
  15 + * @brief GEvents class python interface
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "GEvents.hpp"
  21 +%}
  22 +
  23 +
  24 +/***********************************************************************//**
  25 + * @class GEvents
  26 + *
  27 + * @brief GEvents container class interface defintion.
  28 + *
  29 + * This class is an abstract container base class for events. Events are
  30 + * generally associated to an observation, and the class keeps the pointer
  31 + * to an existing observations as a member.
  32 + ***************************************************************************/
  33 +class GEvents {
  34 +public:
  35 + // Constructors and destructors
  36 + GEvents();
  37 + GEvents(const GEvents& events);
  38 + virtual ~GEvents();
  39 +
  40 + // Pure virtual methods
  41 + virtual void clear(void) = 0;
  42 + virtual GEvents* clone(void) const = 0;
  43 + virtual void load(const std::string& filename) = 0;
  44 + virtual GEvent* pointer(int index) = 0;
  45 + virtual int number(void) const = 0;
  46 + virtual int size(void) const = 0;
  47 + virtual bool islist(void) const = 0;
  48 + virtual bool iscube(void) const = 0;
  49 +};
  50 +
  51 +
  52 +/***********************************************************************//**
  53 + * @brief GEvents class extension
  54 + ***************************************************************************/
  55 +%extend GEvents {
  56 + /*
  57 + char *__str__() {
  58 + static std::string result = self->print();
  59 + return ((char*)result.c_str());
  60 + }
  61 + */
  62 +};
... ...
pyext/GGti.i 0 โ†’ 100644
  1 +/***************************************************************************
  2 + * GGti.i - Good time interval class python I/F *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  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 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GGti.i
  15 + * @brief GGti class python interface
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "GGti.hpp"
  21 +%}
  22 +
  23 +
  24 +/***********************************************************************//**
  25 + * @class GGti
  26 + *
  27 + * @brief Interface for the GTI class.
  28 + *
  29 + * This class holds a list of Good Time Intervals, i.e. time intervals that
  30 + * are valid for science analysis. Times are stored using the GTime class.
  31 + ***************************************************************************/
  32 +class GGti {
  33 +public:
  34 + // Constructors and destructors
  35 + GGti(void);
  36 + GGti(const GGti& gti);
  37 + virtual ~GGti(void);
  38 +
  39 + // Methods
  40 + void clear(void);
  41 + void add(const GTime& tstart, const GTime& tstop);
  42 + void append(const GTime& tstart, const GTime& tstop);
  43 + void insert(const GTime& tstart, const GTime& tstop);
  44 + void load(const std::string& filename,
  45 + const std::string& extname = "GTI");
  46 + void save(const std::string& filename, bool clobber,
  47 + const std::string& extname = "GTI");
  48 + void read(GFitsTable* hdu);
  49 + void write(GFits* file, const std::string& extname = "GTI");
  50 + int size(void) const { return m_num; }
  51 + GTime tstart(void) const { return m_tstart; }
  52 + GTime tstop(void) const { return m_tstop; }
  53 + GTime tstart(int inx) const;
  54 + GTime tstop(int inx) const;
  55 + double telapse(void) const { return m_telapse; }
  56 + double ontime(void) const { return m_ontime; }
  57 + bool isin(const GTime& t) const;
  58 +};
  59 +
  60 +
  61 +/***********************************************************************//**
  62 + * @brief GGti class extension
  63 + ***************************************************************************/
  64 +%extend GGti {
  65 + /*
  66 + char *__str__() {
  67 + static std::string result = self->print();
  68 + return ((char*)result.c_str());
  69 + }
  70 + */
  71 + GGti copy() {
  72 + return (*self);
  73 + }
  74 +};
... ...
pyext/GRoi.i 0 โ†’ 100644
  1 +/***************************************************************************
  2 + * GRoi.i - Region of interest class python I/F *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  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 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GRoi.i
  15 + * @brief GRoi class python interface
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "GRoi.hpp"
  21 +%}
  22 +
  23 +
  24 +/***********************************************************************//**
  25 + * @class GRoi
  26 + *
  27 + * @brief Abstract interface for the region of interest classes.
  28 + *
  29 + * The region of interest class holds instrument specific information about
  30 + * the spatial region in detector or telescopes coordinates that is used
  31 + * for an analysis. In particular, the definition of a region of interest
  32 + * is required for an unbinned analysis.
  33 + ***************************************************************************/
  34 +class GRoi {
  35 +public:
  36 + // Constructors and destructors
  37 + GRoi(void);
  38 + GRoi(const GRoi& roi);
  39 + virtual ~GRoi(void);
  40 +
  41 + // Pure virtual methods
  42 + virtual GRoi* clone(void) const = 0;
  43 +};
  44 +
  45 +
  46 +/***********************************************************************//**
  47 + * @brief GRoi class extension
  48 + ***************************************************************************/
  49 +%extend GRoi {
  50 + /*
  51 + char *__str__() {
  52 + static std::string result = self->print();
  53 + return ((char*)result.c_str());
  54 + }
  55 + */
  56 +};
... ...
pyext/GTime.i 0 โ†’ 100644
  1 +/***************************************************************************
  2 + * GTime.i - Time class python I/F *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  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 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GTime.i
  15 + * @brief GTime class python interface
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "GTime.hpp"
  21 +%}
  22 +
  23 +
  24 +/***********************************************************************//**
  25 + * @class GTime
  26 + *
  27 + * @brief Class that handles times in a system independent way.
  28 + *
  29 + * The GTime class stores a time value in MJD and implements methods that
  30 + * provide automatic conversion of the time values in other systems. This
  31 + * makes instrument specific implementations more robust and reduces the
  32 + * risk of unit errors.
  33 + ***************************************************************************/
  34 +class GTime {
  35 + // Operator friends
  36 + /*
  37 + friend GTime operator+ (const GTime &a, const GTime &b);
  38 + friend GTime operator- (const GTime &a, const GTime &b);
  39 + friend GTime operator* (const double &a, const GTime &b);
  40 + friend GTime operator* (const GTime &a, const double &b);
  41 + friend bool operator== (const GTime &a, const GTime &b);
  42 + friend bool operator!= (const GTime &a, const GTime &b);
  43 + friend bool operator< (const GTime &a, const GTime &b);
  44 + friend bool operator<= (const GTime &a, const GTime &b);
  45 + friend bool operator> (const GTime &a, const GTime &b);
  46 + friend bool operator>= (const GTime &a, const GTime &b);
  47 + */
  48 +
  49 +public:
  50 + // Constructors and destructors
  51 + GTime(void);
  52 + GTime(const GTime& time);
  53 + ~GTime(void);
  54 +
  55 + // Methods
  56 + void clear(void) { m_time = 0.0; }
  57 + double mjd(void) const;
  58 + void mjd(const double& time);
  59 + double met(void) const;
  60 + void met(const double& time);
  61 +};
  62 +
  63 +
  64 +/***********************************************************************//**
  65 + * @brief GTime class extension
  66 + ***************************************************************************/
  67 +%extend GTime {
  68 + /*
  69 + char *__str__() {
  70 + static std::string result = self->print();
  71 + return ((char*)result.c_str());
  72 + }
  73 + */
  74 + GTime copy() {
  75 + return (*self);
  76 + }
  77 +};
... ...