ctools  2.0.0
 All Classes Namespaces Files Functions Variables Macros Pages
ctfindvar Class Reference

Time variability search tool. More...

#include <ctfindvar.hpp>

Inheritance diagram for ctfindvar:
ctobservation ctool GApplication

Public Member Functions

 ctfindvar (void)
 Void constructor. More...
 
 ctfindvar (const GObservations &obs)
 Observations constructor. More...
 
 ctfindvar (int argc, char *argv[])
 Command line constructor. More...
 
 ctfindvar (const ctfindvar &app)
 Copy constructor. More...
 
virtual ~ctfindvar (void)
 Destructor. More...
 
ctfindvaroperator= (const ctfindvar &app)
 Assignment operator. More...
 
void clear (void)
 Clear time variability search tool. More...
 
void process (void)
 Process time variability search tool. More...
 
void save (void)
 Save peak significance map and significance distributions. More...
 
- Public Member Functions inherited from ctobservation
 ctobservation (const std::string &name, const std::string &version)
 Name constructor. More...
 
 ctobservation (const std::string &name, const std::string &version, const GApplicationPars &pars)
 Application parameters constructor. More...
 
 ctobservation (const std::string &name, const std::string &version, int argc, char *argv[])
 Command line constructor. More...
 
 ctobservation (const std::string &name, const std::string &version, const GObservations &obs)
 Observations constructor. More...
 
 ctobservation (const ctobservation &app)
 Copy constructor. More...
 
virtual ~ctobservation (void)
 Destructor. More...
 
ctobservationoperator= (const ctobservation &app)
 Assignment operator. More...
 
void obs (const GObservations &obs)
 Set observation container. More...
 
const GObservations & obs (void) const
 Return observation container. More...
 
- Public Member Functions inherited from ctool
 ctool (const std::string &name, const std::string &version)
 Name constructor. More...
 
 ctool (const std::string &name, const std::string &version, const GApplicationPars &pars)
 Application parameter constructor. More...
 
 ctool (const std::string &name, const std::string &version, int argc, char *argv[])
 Command line constructor. More...
 
 ctool (const ctool &app)
 Copy constructor. More...
 
virtual ~ctool (void)
 Destructor. More...
 
ctooloperator= (const ctool &app)
 Assignment operator. More...
 
virtual void run (void)
 Run ctool. More...
 
virtual void execute (void)
 Execute ctool. More...
 

Protected Member Functions

void init_members (void)
 Initialise class members. More...
 
void copy_members (const ctfindvar &app)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void get_parameters (void)
 Get application parameters. More...
 
void init_gtis (void)
 Initialize Good Time Intervals. More...
 
void create_cube (void)
 Create counts cube. More...
 
void fill_cube (GCTAObservation *obs)
 Fill the cube from the events in an observation. More...
 
void analyse_cube (void)
 Analyse all pixels of counts cube. More...
 
std::vector< int > get_pixels (void)
 Return pixel vector. More...
 
GNdarray get_variability_sig (const int &ipix)
 Get the significance of variability for a given skymap pixel. More...
 
std::vector< double > get_alphas (const int &ipix) const
 Get alpha vector. More...
 
double gti_overlap (const GGti &gti1, const GGti &gti2) const
 Returns number of seconds that two GTIs overlap. More...
 
GTime get_tstart (void)
 Get start time. More...
 
GTime get_tstop (void)
 Get stop time. More...
 
GModelSky sky_model (const GSkyDir &dir) const
 Return sky model for a given sky direction. More...
 
void write_source_histograms (GFits &fits)
 Write source histograms in FITS format. More...
 
int time2inx (const GTime &time) const
 Get the map index associated with a given time. More...
 
- Protected Member Functions inherited from ctobservation
GCTAObservation * first_unbinned_observation (void)
 Return first unbinned CTA observation. More...
 
GCTAObservation * next_unbinned_observation (void)
 Return next unbinned CTA observation. More...
 
const GCTAObservation * first_unbinned_observation (void) const
 Return first unbinned CTA observation (const version) More...
 
const GCTAObservation * next_unbinned_observation (void) const
 Return next unbinned CTA observation (const version) More...
 
void read_ogip_keywords (GFitsHDU *hdu) const
 Read OGIP keywords from FITS HDU. More...
 
void write_ogip_keywords (GFitsHDU *hdu) const
 Write OGIP keywords in FITS HDU. More...
 
void set_obs_statistic (const std::string &statistic)
 Set fit statistic for CTA observations. More...
 
void set_obs_bounds ()
 Set observation boundaries for CTA observations. More...
 
void save_events_fits (void)
 Save event list in FITS format. More...
 
void save_events_xml (void)
 Save event list(s) in XML format. More...
 
void init_members (void)
 Initialise class members. More...
 
void copy_members (const ctobservation &app)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
- Protected Member Functions inherited from ctool
void init_members (void)
 Initialise class members. More...
 
void copy_members (const ctool &app)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void sync_pfiles (void)
 Synchronise parameter files. More...
 
const bool & read_ahead (void) const
 Signal whether parameters should be read ahead. More...
 
void setup_observations (GObservations &obs, const bool &response=true, const bool &list=true, const bool &cube=true)
 Setup observation container. More...
 
void setup_models (GObservations &obs, const std::string &name="")
 Setup model container. More...
 
GEbounds create_ebounds (void)
 Create energy boundaries from user parameters. More...
 
GEnergies create_energies (void)
 Create energies from user parameters. More...
 
GSkyMap create_map (const GObservations &obs)
 Create a skymap from user parameters. More...
 
GCTAEventCube create_cube (const GObservations &obs)
 Create a CTA event cube from user parameters. More...
 
GCTAObservation create_cta_obs (void)
 Create a CTA observation from User parameters. More...
 
void require_inobs (const std::string &method)
 Throws exception if inobs parameter is not valid. More...
 
void require_inobs_nolist (const std::string &method)
 
void require_inobs_nocube (const std::string &method)
 Throws exception if inobs parameter is a counts cube. More...
 
GCTARoi get_roi (const GCTAPointing &pnt=GCTAPointing())
 Return RoI from User parameters. More...
 
GEbounds get_ebounds (void)
 Return energy boundaries from User parameters. More...
 
GGti get_gti (const GTimeReference &ref)
 Return Good Time Intervals from User parameter. More...
 
GCTAPointing get_pointing (void)
 Return CTA pointing from User parameters. More...
 
GSkyDir get_skydir (void)
 Return sky direction from User parameters. More...
 
std::string set_outfile_name (const std::string &filename)
 Set output file name. More...
 
bool is_stacked (void)
 Query user parameters for stacked analysis. More...
 
bool is_onoff (void)
 Query user parameters for On/Off analysis. More...
 
void log_parameters (const GChatter &chatter)
 Log application parameters. More...
 
void log_observations (const GChatter &chatter, const GObservations &obs, const std::string &what="Observation")
 Log observation container. More...
 
void log_models (const GChatter &chatter, const GModels &models, const std::string &what="Model")
 Log model container. More...
 
void set_response (GObservations &obs)
 Set response for all CTA observations in container. More...
 
std::vector< bool > set_edisp (GObservations &obs, const bool &edisp) const
 Set energy dispersion to CTA observations. More...
 
void restore_edisp (GObservations &obs, const std::vector< bool > &edisp) const
 Restore energy dispersion flags of CTA observations. More...
 
void set_obs_response (GCTAObservation *obs)
 Set response for CTA observation. More...
 
GObservations get_observations (const bool &get_response=true)
 Get observation container. More...
 
GSkyDir get_mean_pointing (const GObservations &obs)
 Derives mean pointing from CTA observations. More...
 
size_t get_current_rss (void)
 Get current resident set size (physical memory use) in Bytes. More...
 
std::string get_obs_header (const GObservation *obs) const
 Return observation header string. More...
 
GEnergies insert_energy_boundaries (const GEnergies &energies, const GCTAObservation &obs)
 Insert observation energy boundaries into list of energies. More...
 
std::vector< bool > cube_layer_usage (const GEbounds &cube_ebounds, const GEbounds &list_ebounds) const
 Determine the counts cube layer usage. More...
 
std::string get_gtiname (const std::string &filename, const std::string &evtname) const
 Get Good Time Intervals extension name. More...
 
void save_event_list (const GCTAObservation *obs, const std::string &infile, const std::string &evtname, const std::string &gtiname, const std::string &outfile) const
 Save event list into FITS file. More...
 
std::string warn_too_few_energies (const GEnergies &energies) const
 Set warning string if there are too few energies. More...
 
std::string warn_xml_suffix (const GFilename &filename) const
 Set warning string if file has no .xml suffix. More...
 
void provide_help (void) const
 Dump help text in the console. More...
 

Protected Attributes

GSkyMap m_counts
 Counts for each time interval. More...
 
std::vector< GGti > m_gti
 List of time intervals. More...
 
GModels m_inmodel
 List of models for source positions. More...
 
GSkyDir m_max_sig_dir
 Sky direction associated with maximum significance. More...
 
double m_minoff
 Minimum counts for use in significance calculation. More...
 
double m_sig_threshold
 Minimum significance required to set source as variable. More...
 
GSkyMap m_peaksigmap
 Skymap holding the maximum significance. More...
 
GNdarray m_pixsigsrc
 Store distributions of the source significances. More...
 
GNdarray m_pixsigmax
 Store distribution for pixel with max significance. More...
 
GTime m_tstart
 Start time for variability study. More...
 
GTime m_tstop
 Stop time for variability study. More...
 
GEnergy m_emin
 Minimum energy for events. More...
 
GEnergy m_emax
 Maximum energy for events. More...
 
GModels m_model_above_thr
 Model storing position with significance above thr. More...
 
- Protected Attributes inherited from ctobservation
GObservations m_obs
 Observation container. More...
 
- Protected Attributes inherited from ctool
bool m_read_ahead
 Read ahead output parameters. More...
 
bool m_use_xml
 Use XML file instead of FITS file for observations. More...
 

Detailed Description

Time variability search tool.

Todo:
Add tool description.

Definition at line 47 of file ctfindvar.hpp.

Constructor & Destructor Documentation

ctfindvar::ctfindvar ( void  )

Void constructor.

Constructs empty time variability search tool.

Definition at line 67 of file ctfindvar.cpp.

References init_members().

ctfindvar::ctfindvar ( const GObservations &  obs)
explicit

Observations constructor.

param[in] obs Observation container.

Constructs time variability search tool from an observation container.

Definition at line 84 of file ctfindvar.cpp.

References init_members().

ctfindvar::ctfindvar ( int  argc,
char *  argv[] 
)

Command line constructor.

Parameters
[in]argcNumber of arguments in command line.
[in]argvArray of command line arguments.

Constructs time variability search tool using command line arguments for user parameter setting.

Definition at line 104 of file ctfindvar.cpp.

References init_members().

ctfindvar::ctfindvar ( const ctfindvar app)

Copy constructor.

Parameters
[in]appsearch time variability tool.

Constructs time variability search tool from another time variability search tool.

Definition at line 123 of file ctfindvar.cpp.

References copy_members(), and init_members().

ctfindvar::~ctfindvar ( void  )
virtual

Destructor.

Destructs search time variability tool.

Definition at line 141 of file ctfindvar.cpp.

References free_members().

Member Function Documentation

void ctfindvar::analyse_cube ( void  )
protected

Analyse all pixels of counts cube.

Definition at line 718 of file ctfindvar.cpp.

References get_pixels(), get_variability_sig(), m_counts, m_gti, m_max_sig_dir, m_model_above_thr, m_peaksigmap, m_pixsigmax, m_pixsigsrc, m_sig_threshold, and sky_model().

Referenced by process().

void ctfindvar::clear ( void  )
virtual

Clear time variability search tool.

Clears time variability search tool.

Implements ctobservation.

Definition at line 200 of file ctfindvar.cpp.

References free_members(), ctool::free_members(), ctobservation::free_members(), init_members(), ctool::init_members(), and ctobservation::init_members().

void ctfindvar::copy_members ( const ctfindvar app)
protected

Copy class members.

Parameters
[in]appsearch time variability tool.

Definition at line 370 of file ctfindvar.cpp.

References m_counts, m_emax, m_emin, m_gti, m_inmodel, m_max_sig_dir, m_minoff, m_model_above_thr, m_peaksigmap, m_pixsigsrc, m_sig_threshold, m_tstart, and m_tstop.

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

void ctfindvar::create_cube ( void  )
protected

Create counts cube.

Creates a counts cube comprising a sky map for each Good Time Interval.

Definition at line 556 of file ctfindvar.cpp.

References ctool::create_map(), fill_cube(), m_counts, m_gti, ctobservation::m_obs, m_peaksigmap, and ctobservation::obs().

Referenced by process().

void ctfindvar::fill_cube ( GCTAObservation *  obs)
protected

Fill the cube from the events in an observation.

Parameters
[in]obsPointer to CTA observation.

Fills the cube from the events in an observation.

Definition at line 603 of file ctfindvar.cpp.

References G_FILL_CUBE, ctool::get_obs_header(), m_counts, m_emax, m_emin, and time2inx().

Referenced by create_cube().

void ctfindvar::free_members ( void  )
protected

Delete class members.

Definition at line 395 of file ctfindvar.cpp.

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

std::vector< double > ctfindvar::get_alphas ( const int &  ipix) const
protected

Get alpha vector.

Parameters
[in]ipixSky map pixel index
Returns
Vector containing effective exposure

Definition at line 1013 of file ctfindvar.cpp.

References G_FILL_ALPHA_VECTOR, ctool::get_obs_header(), gti_overlap(), m_counts, m_emax, m_emin, m_gti, ctobservation::m_obs, and ctobservation::obs().

Referenced by get_variability_sig().

void ctfindvar::get_parameters ( void  )
protected
std::vector< int > ctfindvar::get_pixels ( void  )
protected

Return pixel vector.

Returns
Vector of sky map pixels

Returns a vector of sky map pixels that corresponds to the source model positions.

Definition at line 799 of file ctfindvar.cpp.

References m_counts, and m_inmodel.

Referenced by analyse_cube().

GTime ctfindvar::get_tstart ( void  )
protected

Get start time.

Returns
Start time

Definition at line 1131 of file ctfindvar.cpp.

References ctobservation::m_obs, and ctobservation::obs().

Referenced by init_gtis().

GTime ctfindvar::get_tstop ( void  )
protected

Get stop time.

Returns
Stop time

Definition at line 1184 of file ctfindvar.cpp.

References ctobservation::m_obs, and ctobservation::obs().

Referenced by init_gtis().

GNdarray ctfindvar::get_variability_sig ( const int &  ipix)
protected

Get the significance of variability for a given skymap pixel.

Parameters
[in]ipixSky map pixel index.
Returns
Histogram of significances.

Significance is computed according to Li & Ma equation 17: see: https://doi.org/10.1086/161295 Some modification is made in order to handle the case where Non = 0, but Noff != 0.

Definition at line 917 of file ctfindvar.cpp.

References get_alphas(), m_counts, m_gti, m_minoff, and m_sig_threshold.

Referenced by analyse_cube().

double ctfindvar::gti_overlap ( const GGti &  gti1,
const GGti &  gti2 
) const
protected

Returns number of seconds that two GTIs overlap.

Parameters
[in]gti1First GTI
[in]gti2Second GTI
Returns
Number of seconds that gti1 and gti2 overlap

Definition at line 1102 of file ctfindvar.cpp.

Referenced by get_alphas(), and init_gtis().

void ctfindvar::init_gtis ( void  )
protected

Initialize Good Time Intervals.

Exceptions
GException::invalid_valueInvalid start or stop time or insufficient time bins

Initialise Good Time Intervals for the variability search.

Definition at line 477 of file ctfindvar.cpp.

References G_INIT_GTIS, get_tstart(), get_tstop(), gti_overlap(), m_gti, ctobservation::m_obs, m_tstart, m_tstop, and ctobservation::obs().

Referenced by process().

void ctfindvar::init_members ( void  )
protected

Initialise class members.

Definition at line 343 of file ctfindvar.cpp.

References m_counts, m_emax, m_emin, m_gti, m_inmodel, m_max_sig_dir, m_minoff, m_model_above_thr, m_peaksigmap, m_pixsigsrc, m_sig_threshold, m_tstart, and m_tstop.

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

ctfindvar & ctfindvar::operator= ( const ctfindvar app)

Assignment operator.

Parameters
[in]appTime variability search tool.
Returns
Time variability search tool.

Assigns time variability search tool.

Definition at line 165 of file ctfindvar.cpp.

References copy_members(), free_members(), init_members(), and ctobservation::operator=().

void ctfindvar::process ( void  )
virtual

Process time variability search tool.

Implements ctobservation.

Definition at line 226 of file ctfindvar.cpp.

References analyse_cube(), create_cube(), get_parameters(), init_gtis(), ctool::log_observations(), and ctobservation::m_obs.

void ctfindvar::save ( void  )
virtual

Save peak significance map and significance distributions.

Saves the peak significance and source signficance distributions. Optionally, the generated counts cube can also be saved if 'outcube' has been specified.

Implements ctobservation.

Definition at line 255 of file ctfindvar.cpp.

References m_counts, m_model_above_thr, m_peaksigmap, and write_source_histograms().

GModelSky ctfindvar::sky_model ( const GSkyDir &  dir) const
protected

Return sky model for a given sky direction.

Parameters
[in]dirSky direction
Returns
Sky model for a given sky direction

Returns a point source sky model at the position of the current pixel with a power law spectral model corresponding to 1% of the Crab flux.

The model name is built from the celestial coordinates of the source.

Definition at line 875 of file ctfindvar.cpp.

Referenced by analyse_cube().

int ctfindvar::time2inx ( const GTime &  time) const
protected

Get the map index associated with a given time.

Parameters
[in]timeTime
Returns
Index of map in counts cube

Definition at line 1404 of file ctfindvar.cpp.

References m_gti.

Referenced by fill_cube(), and write_source_histograms().

void ctfindvar::write_source_histograms ( GFits &  fits)
protected

Write source histograms in FITS format.

Parameters
[in,out]fitsFITS file

This method creates two FITS binary table extensions and appends them to the FITS file.

The first extension is named "SOURCE SIGNIFICANCE" and contains the significance of the variability as function of time bin for the pixel with the maximum significance and for each source.

The second extension is named "SOURCE POSITION" and contains the Right Ascension and Declination for the maximum significance pixel and for each source.

Definition at line 1248 of file ctfindvar.cpp.

References m_inmodel, m_max_sig_dir, m_pixsigmax, m_pixsigsrc, m_tstart, m_tstop, and time2inx().

Referenced by save().

Member Data Documentation

GSkyMap ctfindvar::m_counts
protected

Counts for each time interval.

Definition at line 85 of file ctfindvar.hpp.

Referenced by analyse_cube(), copy_members(), create_cube(), fill_cube(), get_alphas(), get_pixels(), get_variability_sig(), init_members(), and save().

GEnergy ctfindvar::m_emax
protected

Maximum energy for events.

Definition at line 97 of file ctfindvar.hpp.

Referenced by copy_members(), fill_cube(), get_alphas(), get_parameters(), and init_members().

GEnergy ctfindvar::m_emin
protected

Minimum energy for events.

Definition at line 96 of file ctfindvar.hpp.

Referenced by copy_members(), fill_cube(), get_alphas(), get_parameters(), and init_members().

std::vector<GGti> ctfindvar::m_gti
protected

List of time intervals.

Definition at line 86 of file ctfindvar.hpp.

Referenced by analyse_cube(), copy_members(), create_cube(), get_alphas(), get_variability_sig(), init_gtis(), init_members(), and time2inx().

GModels ctfindvar::m_inmodel
protected

List of models for source positions.

Definition at line 87 of file ctfindvar.hpp.

Referenced by copy_members(), get_parameters(), get_pixels(), init_members(), and write_source_histograms().

GSkyDir ctfindvar::m_max_sig_dir
protected

Sky direction associated with maximum significance.

Definition at line 88 of file ctfindvar.hpp.

Referenced by analyse_cube(), copy_members(), init_members(), and write_source_histograms().

double ctfindvar::m_minoff
protected

Minimum counts for use in significance calculation.

Definition at line 89 of file ctfindvar.hpp.

Referenced by copy_members(), get_parameters(), get_variability_sig(), and init_members().

GModels ctfindvar::m_model_above_thr
protected

Model storing position with significance above thr.

Definition at line 98 of file ctfindvar.hpp.

Referenced by analyse_cube(), copy_members(), init_members(), and save().

GSkyMap ctfindvar::m_peaksigmap
protected

Skymap holding the maximum significance.

Definition at line 91 of file ctfindvar.hpp.

Referenced by analyse_cube(), copy_members(), create_cube(), init_members(), and save().

GNdarray ctfindvar::m_pixsigmax
protected

Store distribution for pixel with max significance.

Definition at line 93 of file ctfindvar.hpp.

Referenced by analyse_cube(), and write_source_histograms().

GNdarray ctfindvar::m_pixsigsrc
protected

Store distributions of the source significances.

Definition at line 92 of file ctfindvar.hpp.

Referenced by analyse_cube(), copy_members(), init_members(), and write_source_histograms().

double ctfindvar::m_sig_threshold
protected

Minimum significance required to set source as variable.

Definition at line 90 of file ctfindvar.hpp.

Referenced by analyse_cube(), copy_members(), get_parameters(), get_variability_sig(), and init_members().

GTime ctfindvar::m_tstart
protected

Start time for variability study.

Definition at line 94 of file ctfindvar.hpp.

Referenced by copy_members(), init_gtis(), init_members(), and write_source_histograms().

GTime ctfindvar::m_tstop
protected

Stop time for variability study.

Definition at line 95 of file ctfindvar.hpp.

Referenced by copy_members(), init_gtis(), init_members(), and write_source_histograms().


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