ctools  2.1.0.dev
 All Classes Namespaces Files Functions Variables Macros Pages
ctcubemask Class Reference

Cube filter tool. More...

#include <ctcubemask.hpp>

Inheritance diagram for ctcubemask:
ctobservation ctool GApplication

Public Member Functions

 ctcubemask (void)
 Void constructor. More...
 
 ctcubemask (const GObservations &obs)
 Observations constructor. More...
 
 ctcubemask (int argc, char *argv[])
 Command line constructor. More...
 
 ctcubemask (const ctcubemask &app)
 Copy constructor. More...
 
virtual ~ctcubemask (void)
 Destructor. More...
 
ctcubemaskoperator= (const ctcubemask &app)
 Assignment operator. More...
 
void clear (void)
 Clear ctcubemask tool. More...
 
void process (void)
 Mask data cube. More...
 
void save (void)
 Save the masked event cube(s) More...
 
void publish (const std::string &name="")
 Publish counts cube. 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 ctcubemask &app)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void get_parameters (void)
 Get application parameters. More...
 
void apply_mask (GCTAObservation *obs)
 Apply mask to event cube. More...
 
std::string region_string (const GSkyRegion &region) const
 Return region string. More...
 
std::string set_outfile_name (const std::string &filename) const
 Set output file name. More...
 
void save_fits (void)
 Save counts cube in FITS format. More...
 
void save_xml (void)
 Save counts cube(s) in XML format. 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

GFilename m_outcube
 Output event list or XML file. More...
 
std::string m_prefix
 Prefix for multiple counts maps. More...
 
double m_emin
 Lower energy. More...
 
double m_emax
 Upper energy. More...
 
bool m_publish
 Publish counts cube? More...
 
std::vector< std::string > m_infiles
 Input event filenames. More...
 
bool m_select_energy
 Perform energy selection. 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

Cube filter tool.

Definition at line 47 of file ctcubemask.hpp.

Constructor & Destructor Documentation

ctcubemask::ctcubemask ( void  )

Void constructor.

Definition at line 53 of file ctcubemask.cpp.

References init_members().

ctcubemask::ctcubemask ( const GObservations &  obs)
explicit

Observations constructor.

param[in] obs Observation container.

This constructor creates an instance of the class that is initialised from an observation container.

Definition at line 71 of file ctcubemask.cpp.

References init_members().

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

Command line constructor.

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

Definition at line 90 of file ctcubemask.cpp.

References init_members().

ctcubemask::ctcubemask ( const ctcubemask app)

Copy constructor.

Parameters
[in]appApplication.

Definition at line 106 of file ctcubemask.cpp.

References copy_members(), and init_members().

ctcubemask::~ctcubemask ( void  )
virtual

Destructor.

Definition at line 122 of file ctcubemask.cpp.

References free_members().

Member Function Documentation

void ctcubemask::apply_mask ( GCTAObservation *  obs)
protected

Apply mask to event cube.

Parameters
[in]obsCTA observation.

Apply mask to an event cube. The mask sets content of event bins outside the region of interest or the energy of interest to -1. These pixels will be ignored in likelihood fitting.

Definition at line 478 of file ctcubemask.cpp.

References ctool::get_roi(), m_emax, m_emin, m_select_energy, and region_string().

Referenced by process().

void ctcubemask::clear ( void  )
virtual

Clear ctcubemask tool.

Clears ctcubemask tool.

Implements ctobservation.

Definition at line 179 of file ctcubemask.cpp.

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

void ctcubemask::copy_members ( const ctcubemask app)
protected

Copy class members.

Parameters
[in]appApplication.

Definition at line 389 of file ctcubemask.cpp.

References m_emax, m_emin, m_infiles, m_outcube, m_prefix, m_publish, and m_select_energy.

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

void ctcubemask::free_members ( void  )
protected

Delete class members.

Definition at line 410 of file ctcubemask.cpp.

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

void ctcubemask::get_parameters ( void  )
protected

Get application parameters.

Get all task parameters from parameter file or (if required) by querying the user.

This method also loads observations if no observations are yet allocated. Observations are either loaded from a single CTA even cube, or from a XML file using the metadata information that is stored in that file.

Definition at line 427 of file ctcubemask.cpp.

References ctool::get_roi(), ctool::log_parameters(), m_emax, m_emin, ctobservation::m_obs, m_publish, m_select_energy, ctool::read_ahead(), and ctool::setup_observations().

Referenced by process().

void ctcubemask::init_members ( void  )
protected

Initialise class members.

Definition at line 366 of file ctcubemask.cpp.

References m_emax, m_emin, m_infiles, m_outcube, m_prefix, m_publish, and m_select_energy.

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

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

Assignment operator.

Parameters
[in]appApplication.
Returns
Application.

Definition at line 144 of file ctcubemask.cpp.

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

void ctcubemask::process ( void  )
virtual

Mask data cube.

This method reads in the application parameters and loops over all observations that were found to apply a mask on the event cube.

Implements ctobservation.

Definition at line 208 of file ctcubemask.cpp.

References apply_mask(), ctool::get_obs_header(), get_parameters(), ctool::log_observations(), m_infiles, ctobservation::m_obs, m_publish, ctool::m_use_xml, ctobservation::obs(), and publish().

void ctcubemask::publish ( const std::string &  name = "")

Publish counts cube.

Parameters
[in]nameCounts cube name.

Publishes the first counts cube in the observation container on the VO Hub.

Definition at line 324 of file ctcubemask.cpp.

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

Referenced by process().

std::string ctcubemask::region_string ( const GSkyRegion &  region) const
protected

Return region string.

Parameters
[in]regionSky region.

Returns a formatted region string for logging.

Definition at line 622 of file ctcubemask.cpp.

Referenced by apply_mask().

void ctcubemask::save ( void  )
virtual

Save the masked event cube(s)

This method saves the masked event cube(s) into FITS file(s). There are two modes, depending on the m_use_xml flag.

If m_use_xml is true, all masked event cube(s) will be saved into FITS files, where the output filenames are constructued from the input filenames by prepending the m_prefix string to name. Any path information will be stripped form the input name, hence event cube files will be written into the local working directory (unless some path information is present in the prefix). In addition, an XML file will be created that gathers the filename information for the masked event cube(s). If an XML file was present on input, all metadata information will be copied from this input file.

If m_use_xml is false, the masked event cubes will be saved into a FITS file.

Implements ctobservation.

Definition at line 288 of file ctcubemask.cpp.

References ctobservation::m_obs, m_outcube, m_prefix, ctool::m_use_xml, save_fits(), and save_xml().

void ctcubemask::save_fits ( void  )
protected

Save counts cube in FITS format.

Save the counts cube as a FITS file. The filename of the FITS file is specified by the m_outfile member.

Definition at line 671 of file ctcubemask.cpp.

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

Referenced by save().

void ctcubemask::save_xml ( void  )
protected

Save counts cube(s) in XML format.

Save the counts cube(s) into FITS files and write the file path information into an XML file. The filename of the XML file is specified by the m_outfile member, the filename(s) of the counts cube(s) are built by prepending the prefix given by the m_prefix member to the input counts cube(s) filenames. Any path present in the input filename will be stripped, i.e. the counts cube(s) will be written in the local working directory (unless a path is specified in the m_prefix member).

Definition at line 711 of file ctcubemask.cpp.

References m_infiles, ctobservation::m_obs, m_outcube, ctobservation::obs(), set_outfile_name(), and ctool::warn_xml_suffix().

Referenced by save().

std::string ctcubemask::set_outfile_name ( const std::string &  filename) const
protected

Set output file name.

Parameters
[in]filenameInput file name.

This converts an input filename into an output filename by prepending a prefix to the input filename. Any path will be stripped from the input filename.

Definition at line 652 of file ctcubemask.cpp.

References m_prefix.

Referenced by save_xml().

Member Data Documentation

double ctcubemask::m_emax
protected

Upper energy.

Definition at line 82 of file ctcubemask.hpp.

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

double ctcubemask::m_emin
protected

Lower energy.

Definition at line 81 of file ctcubemask.hpp.

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

std::vector<std::string> ctcubemask::m_infiles
protected

Input event filenames.

Definition at line 86 of file ctcubemask.hpp.

Referenced by copy_members(), init_members(), process(), and save_xml().

GFilename ctcubemask::m_outcube
protected

Output event list or XML file.

Definition at line 79 of file ctcubemask.hpp.

Referenced by copy_members(), init_members(), save(), save_fits(), and save_xml().

std::string ctcubemask::m_prefix
protected

Prefix for multiple counts maps.

Definition at line 80 of file ctcubemask.hpp.

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

bool ctcubemask::m_publish
protected

Publish counts cube?

Definition at line 83 of file ctcubemask.hpp.

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

bool ctcubemask::m_select_energy
protected

Perform energy selection.

Definition at line 87 of file ctcubemask.hpp.

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


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