ctools  2.0.0
 All Classes Namespaces Files Functions Variables Macros Pages
ctfindvar.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * ctfindvar - Time variability search tool *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2018-2022 by Simon Bonnefoy *
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 ctfindvar.hpp
23  * @brief Time variability search tool definition
24  * @author Simon Bonnefoy
25  */
26 
27 #ifndef CTFINDVAR_HPP
28 #define CTFINDVAR_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include "ctobservation.hpp"
32 #include "GSkyMap.hpp"
33 #include "GGti.hpp"
34 
35 
36 /* __Definitions _________________________________________________________ */
37 #define CTFINDVAR_NAME "ctfindvar"
38 
39 
40 /***********************************************************************//**
41  * @class ctfindvar
42  *
43  * @brief Time variability search tool
44  *
45  * @todo Add tool description.
46  ***************************************************************************/
47 class ctfindvar : public ctobservation {
48 public:
49  // Constructors and destructors
50  ctfindvar(void);
51  explicit ctfindvar(const GObservations& obs);
52  ctfindvar(int argc, char *argv[]);
53  ctfindvar(const ctfindvar& app);
54  virtual ~ctfindvar(void);
55 
56  // Operators
57  ctfindvar& operator=(const ctfindvar& app);
58 
59  // Methods
60  void clear(void);
61  void process(void);
62  void save(void);
63 
64 protected:
65  // Protected methods
66  void init_members(void);
67  void copy_members(const ctfindvar& app);
68  void free_members(void);
69  void get_parameters(void);
70  void init_gtis(void);
71  void create_cube(void);
72  void fill_cube(GCTAObservation* obs);
73  void analyse_cube(void);
74  std::vector<int> get_pixels(void);
75  GNdarray get_variability_sig(const int& ipix);
76  std::vector<double> get_alphas(const int& ipix) const;
77  double gti_overlap(const GGti& gti1, const GGti& gti2) const;
78  GTime get_tstart(void);
79  GTime get_tstop(void);
80  GModelSky sky_model(const GSkyDir& dir) const;
81  void write_source_histograms(GFits& fits);
82  int time2inx(const GTime& time) const;
83 
84  // Protected members
85  GSkyMap m_counts; //!< Counts for each time interval
86  std::vector<GGti> m_gti; //!< List of time intervals
87  GModels m_inmodel; //!< List of models for source positions
88  GSkyDir m_max_sig_dir; //!< Sky direction associated with maximum significance
89  double m_minoff; //!< Minimum counts for use in significance calculation
90  double m_sig_threshold; //!< Minimum significance required to set source as variable
91  GSkyMap m_peaksigmap; //!< Skymap holding the maximum significance
92  GNdarray m_pixsigsrc; //!< Store distributions of the source significances
93  GNdarray m_pixsigmax; //!< Store distribution for pixel with max significance
94  GTime m_tstart; //!< Start time for variability study
95  GTime m_tstop; //!< Stop time for variability study
96  GEnergy m_emin; //!< Minimum energy for events
97  GEnergy m_emax; //!< Maximum energy for events
98  GModels m_model_above_thr; //!< Model storing position with significance above thr
99 
100 };
101 
102 #endif /* CTFINDVAR_HPP */
Time variability search tool.
Definition: ctfindvar.hpp:47
std::vector< double > get_alphas(const int &ipix) const
Get alpha vector.
Definition: ctfindvar.cpp:1013
GTime m_tstart
Start time for variability study.
Definition: ctfindvar.hpp:94
GNdarray m_pixsigsrc
Store distributions of the source significances.
Definition: ctfindvar.hpp:92
int time2inx(const GTime &time) const
Get the map index associated with a given time.
Definition: ctfindvar.cpp:1404
ctfindvar(void)
Void constructor.
Definition: ctfindvar.cpp:67
void save(void)
Save peak significance map and significance distributions.
Definition: ctfindvar.cpp:255
GTime get_tstart(void)
Get start time.
Definition: ctfindvar.cpp:1131
const GObservations & obs(void) const
Return observation container.
void process(void)
Process time variability search tool.
Definition: ctfindvar.cpp:226
void analyse_cube(void)
Analyse all pixels of counts cube.
Definition: ctfindvar.cpp:718
void clear(void)
Clear time variability search tool.
Definition: ctfindvar.cpp:200
ctfindvar & operator=(const ctfindvar &app)
Assignment operator.
Definition: ctfindvar.cpp:165
GNdarray m_pixsigmax
Store distribution for pixel with max significance.
Definition: ctfindvar.hpp:93
GEnergy m_emin
Minimum energy for events.
Definition: ctfindvar.hpp:96
GModelSky sky_model(const GSkyDir &dir) const
Return sky model for a given sky direction.
Definition: ctfindvar.cpp:875
void copy_members(const ctfindvar &app)
Copy class members.
Definition: ctfindvar.cpp:370
GTime get_tstop(void)
Get stop time.
Definition: ctfindvar.cpp:1184
GSkyMap m_peaksigmap
Skymap holding the maximum significance.
Definition: ctfindvar.hpp:91
void init_gtis(void)
Initialize Good Time Intervals.
Definition: ctfindvar.cpp:477
Observation tool base class interface definition.
Base class for observation tools.
GModels m_model_above_thr
Model storing position with significance above thr.
Definition: ctfindvar.hpp:98
virtual ~ctfindvar(void)
Destructor.
Definition: ctfindvar.cpp:141
void init_members(void)
Initialise class members.
Definition: ctfindvar.cpp:343
double m_sig_threshold
Minimum significance required to set source as variable.
Definition: ctfindvar.hpp:90
void create_cube(void)
Create counts cube.
Definition: ctfindvar.cpp:556
void free_members(void)
Delete class members.
Definition: ctfindvar.cpp:395
std::vector< int > get_pixels(void)
Return pixel vector.
Definition: ctfindvar.cpp:799
std::vector< GGti > m_gti
List of time intervals.
Definition: ctfindvar.hpp:86
GTime m_tstop
Stop time for variability study.
Definition: ctfindvar.hpp:95
GSkyMap m_counts
Counts for each time interval.
Definition: ctfindvar.hpp:85
GNdarray get_variability_sig(const int &ipix)
Get the significance of variability for a given skymap pixel.
Definition: ctfindvar.cpp:917
double m_minoff
Minimum counts for use in significance calculation.
Definition: ctfindvar.hpp:89
double gti_overlap(const GGti &gti1, const GGti &gti2) const
Returns number of seconds that two GTIs overlap.
Definition: ctfindvar.cpp:1102
void get_parameters(void)
Get application parameters.
Definition: ctfindvar.cpp:405
void fill_cube(GCTAObservation *obs)
Fill the cube from the events in an observation.
Definition: ctfindvar.cpp:603
void write_source_histograms(GFits &fits)
Write source histograms in FITS format.
Definition: ctfindvar.cpp:1248
GSkyDir m_max_sig_dir
Sky direction associated with maximum significance.
Definition: ctfindvar.hpp:88
GModels m_inmodel
List of models for source positions.
Definition: ctfindvar.hpp:87
GEnergy m_emax
Maximum energy for events.
Definition: ctfindvar.hpp:97