ctools
2.0.0
|
Model cube generation tool. More...
#include <ctmodel.hpp>
Public Member Functions | |
ctmodel (void) | |
Void constructor. More... | |
ctmodel (const GObservations &obs) | |
Observations constructor. More... | |
ctmodel (int argc, char *argv[]) | |
Command line constructor. More... | |
ctmodel (const ctmodel &app) | |
Copy constructor. More... | |
virtual | ~ctmodel (void) |
Destructor. More... | |
ctmodel & | operator= (const ctmodel &app) |
Assignment operator. More... | |
void | clear (void) |
Clear ctmodel tool. More... | |
void | process (void) |
Generate the model map(s) More... | |
void | save (void) |
Save model cube. More... | |
void | publish (const std::string &name="") |
Publish model cube. More... | |
const GCTAEventCube & | cube (void) const |
Return model cube. More... | |
void | cube (const GCTAEventCube &cube) |
Set model cube. More... | |
void | models (const GModels &models) |
Set models. 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... | |
ctobservation & | operator= (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... | |
ctool & | operator= (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 ctmodel &app) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | get_parameters (void) |
Get application parameters. More... | |
void | get_obs (void) |
Get observation container. More... | |
void | extract_cube_properties (void) |
Extract cube properties in data members. More... | |
void | fill_cube (const GCTAObservation *obs, GModels &models) |
Fill models into model cube. More... | |
bool | has_cube (void) const |
Signal if cube has been set or loaded. More... | |
GModels | trim_models (GModels &all_models, const GCTARoi &roi) |
Find the models falling inside a defined region of interest. 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 >iname, 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 | |
GFilename | m_outcube |
Output model cube. More... | |
bool | m_apply_edisp |
Apply energy dispersion? More... | |
bool | m_publish |
Publish model cube? More... | |
GChatter | m_chatter |
Chattiness. More... | |
GCTAEventCube | m_cube |
Model cube. More... | |
GGti | m_gti |
Model cube GTIs. More... | |
bool | m_has_cube |
Signal if cube exists. More... | |
bool | m_append_cube |
Signal to append cube. More... | |
bool | m_binned |
Signal binned mode. More... | |
std::vector< GCTAInstDir > | m_dir |
Cube directions. More... | |
std::vector< double > | m_solidangle |
Cube solid angles. More... | |
std::vector< GEnergy > | m_energy |
Cube energies. More... | |
std::vector< GEnergy > | m_ewidth |
Cube energy widths. More... | |
GTime | m_time |
Cube time. More... | |
double | m_ra_pnt |
Right Ascension of pointing. More... | |
double | m_dec_pnt |
Declination Ascension of pointing. 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... | |
Model cube generation tool.
This class creates counts model map(s). The definition of the counts model can be taken from a predefined observation container, from the counts maps found in an observation definition XML file, from an individual counts map, or from the parameter definition.
Results are stored in an observation container that can be written to disk in form of FITS files (model maps) and an updated observation definition XML file.
Definition at line 53 of file ctmodel.hpp.
ctmodel::ctmodel | ( | void | ) |
|
explicit |
Observations constructor.
param[in] obs Observation container.
This method creates an instance of the class by copying an existing observations container.
Definition at line 80 of file ctmodel.cpp.
References init_members().
ctmodel::ctmodel | ( | int | argc, |
char * | argv[] | ||
) |
Command line constructor.
[in] | argc | Number of arguments in command line. |
[in] | argv | Array of command line arguments. |
Definition at line 98 of file ctmodel.cpp.
References init_members().
ctmodel::ctmodel | ( | const ctmodel & | app | ) |
Copy constructor.
[in] | app | Application. |
Definition at line 114 of file ctmodel.cpp.
References copy_members(), and init_members().
|
virtual |
|
virtual |
Clear ctmodel tool.
Clears ctmodel tool.
Implements ctobservation.
Definition at line 187 of file ctmodel.cpp.
References free_members(), ctool::free_members(), ctobservation::free_members(), init_members(), ctool::init_members(), and ctobservation::init_members().
|
protected |
Copy class members.
[in] | app | Application. |
Definition at line 443 of file ctmodel.cpp.
References m_append_cube, m_apply_edisp, m_binned, m_chatter, m_cube, m_dec_pnt, m_dir, m_energy, m_ewidth, m_gti, m_has_cube, m_outcube, m_publish, m_ra_pnt, m_solidangle, and m_time.
Referenced by ctmodel(), and operator=().
|
inline |
Return model cube.
Definition at line 115 of file ctmodel.hpp.
References m_cube.
Referenced by cube(), get_obs(), and get_parameters().
void ctmodel::cube | ( | const GCTAEventCube & | cube | ) |
Set model cube.
[in] | cube | Model cube. |
Set model cube and set all cube bins to zero.
Definition at line 384 of file ctmodel.cpp.
References cube(), m_cube, and m_has_cube.
|
protected |
Extract cube properties in data members.
Definition at line 803 of file ctmodel.cpp.
References m_cube, m_dir, m_energy, m_ewidth, m_solidangle, and m_time.
Referenced by process().
|
protected |
Fill models into model cube.
[in] | obs | CTA observation. |
[in] | models | Model container. |
Adds the expected number of events for a given observation to the events that are already found in the model cube. The method also updates the GTI of the model cube so that cube GTI is a list of the GTIs of all observations that were used to generate the model cube.
Definition at line 864 of file ctmodel.cpp.
References ctool::cube_layer_usage(), ctool::get_obs_header(), m_chatter, m_cube, m_dec_pnt, m_dir, m_energy, m_ewidth, m_gti, m_ra_pnt, m_solidangle, m_time, and trim_models().
Referenced by process().
|
protected |
Delete class members.
Definition at line 473 of file ctmodel.cpp.
Referenced by clear(), operator=(), and ~ctmodel().
|
protected |
Get observation container.
Get an observation container according to the user parameters. The method supports loading of a individual FITS file or an observation definition file in XML format.
If the input filename is empty, the method checks for the existence of the "expcube", "psfcube" and "bkgcube" parameters. If file names have been specified, the method loads the files and creates a dummy events cube that is appended to the observation container.
If no file names are specified for the "expcube", "psfcube" or "bkgcube" parameters, the method reads the necessary parameters to build a CTA observation from scratch.
The method sets m_append_cube = true and m_binned = true in case that a stacked observation is requested (as detected by the presence of the "expcube", "psfcube", and "bkgcube" parameters). In that case, it appended a dummy event cube to the observation.
Definition at line 648 of file ctmodel.cpp.
References ctool::create_cta_obs(), ctool::create_ebounds(), cube(), G_GET_OBS, m_append_cube, m_binned, ctobservation::m_obs, ctool::m_use_xml, ctobservation::set_obs_bounds(), ctool::set_obs_response(), and ctool::set_response().
Referenced by get_parameters().
|
protected |
Get application parameters.
Get all task parameters from parameter file or (if required) by querying the user. The parameters are read in the correct order.
Definition at line 486 of file ctmodel.cpp.
References ctool::create_cube(), cube(), get_obs(), ctool::log_parameters(), m_append_cube, m_apply_edisp, m_binned, m_chatter, m_cube, m_has_cube, ctobservation::m_obs, m_publish, cscripts.mputils::nthreads(), ctobservation::obs(), ctool::read_ahead(), and ctool::setup_observations().
Referenced by process().
|
inlineprotected |
Signal if cube has been set or loaded.
Definition at line 127 of file ctmodel.hpp.
References m_has_cube.
|
protected |
Initialise class members.
Definition at line 411 of file ctmodel.cpp.
References m_append_cube, m_apply_edisp, m_binned, m_chatter, m_cube, m_dec_pnt, m_dir, m_energy, m_ewidth, m_gti, m_has_cube, m_outcube, m_publish, m_ra_pnt, m_solidangle, and m_time.
Referenced by clear(), ctmodel(), and operator=().
|
inline |
Set models.
[in] | models | Model container. |
Set model container that should be used for model generation.
Definition at line 141 of file ctmodel.hpp.
References ctobservation::m_obs.
Referenced by process().
Assignment operator.
[in] | app | Application. |
Definition at line 152 of file ctmodel.cpp.
References copy_members(), free_members(), init_members(), and ctobservation::operator=().
|
virtual |
Generate the model map(s)
This method reads the task parameters from the parfile, sets up the observation container, loops over all CTA observations in the container and generates a model map for each CTA observation.
Implements ctobservation.
Definition at line 217 of file ctmodel.cpp.
References extract_cube_properties(), fill_cube(), ctool::get_obs_header(), get_parameters(), ctool::log_models(), ctool::log_observations(), m_apply_edisp, m_binned, m_cube, ctobservation::m_obs, m_publish, models(), ctobservation::obs(), publish(), ctool::restore_edisp(), and ctool::set_edisp().
void ctmodel::publish | ( | const std::string & | name = "" | ) |
Publish model cube.
[in] | name | Model cube name. |
Definition at line 355 of file ctmodel.cpp.
References CTMODEL_NAME, and m_cube.
Referenced by process().
|
virtual |
Save model cube.
Saves the model cube into a FITS file specified using the "outfile" task parameter.
Implements ctobservation.
Definition at line 311 of file ctmodel.cpp.
|
protected |
Find the models falling inside a defined region of interest.
[in,out] | all_models | Model container to be trimmed. |
[in] | roi | Observation region of interest. |
Note that a buffer is added to the observation region to ensure that point sources (which have radius=0) are appropriately included if they fall near the edge of the observation.
Definition at line 1017 of file ctmodel.cpp.
Referenced by fill_cube().
|
protected |
Signal to append cube.
Definition at line 97 of file ctmodel.hpp.
Referenced by copy_members(), get_obs(), get_parameters(), and init_members().
|
protected |
Apply energy dispersion?
Definition at line 89 of file ctmodel.hpp.
Referenced by copy_members(), get_parameters(), init_members(), and process().
|
protected |
Signal binned mode.
Definition at line 98 of file ctmodel.hpp.
Referenced by copy_members(), get_obs(), get_parameters(), init_members(), and process().
|
protected |
Chattiness.
Definition at line 91 of file ctmodel.hpp.
Referenced by copy_members(), fill_cube(), get_parameters(), and init_members().
|
protected |
Model cube.
Definition at line 94 of file ctmodel.hpp.
Referenced by copy_members(), cube(), extract_cube_properties(), fill_cube(), get_parameters(), init_members(), process(), publish(), and save().
|
protected |
Declination Ascension of pointing.
Definition at line 105 of file ctmodel.hpp.
Referenced by copy_members(), fill_cube(), init_members(), and save().
|
protected |
Cube directions.
Definition at line 99 of file ctmodel.hpp.
Referenced by copy_members(), extract_cube_properties(), fill_cube(), and init_members().
|
protected |
Cube energies.
Definition at line 101 of file ctmodel.hpp.
Referenced by copy_members(), extract_cube_properties(), fill_cube(), and init_members().
|
protected |
Cube energy widths.
Definition at line 102 of file ctmodel.hpp.
Referenced by copy_members(), extract_cube_properties(), fill_cube(), and init_members().
|
protected |
Model cube GTIs.
Definition at line 95 of file ctmodel.hpp.
Referenced by copy_members(), fill_cube(), and init_members().
|
protected |
Signal if cube exists.
Definition at line 96 of file ctmodel.hpp.
Referenced by copy_members(), cube(), get_parameters(), has_cube(), and init_members().
|
protected |
Output model cube.
Definition at line 88 of file ctmodel.hpp.
Referenced by copy_members(), init_members(), and save().
|
protected |
Publish model cube?
Definition at line 90 of file ctmodel.hpp.
Referenced by copy_members(), get_parameters(), init_members(), and process().
|
protected |
Right Ascension of pointing.
Definition at line 104 of file ctmodel.hpp.
Referenced by copy_members(), fill_cube(), init_members(), and save().
|
protected |
Cube solid angles.
Definition at line 100 of file ctmodel.hpp.
Referenced by copy_members(), extract_cube_properties(), fill_cube(), and init_members().
|
protected |
Cube time.
Definition at line 103 of file ctmodel.hpp.
Referenced by copy_members(), extract_cube_properties(), fill_cube(), and init_members().