Commit 148a99f98e6eca34d289036b63c433ddfb185602

Authored by Jürgen Knödlseder
1 parent 892c9f41

Clean-up public method interface.

ChangeLog
1   -2014-07-22 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
  1 +2014-07-24 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
2 2  
3 3 * Version 0.8.0 released
4 4 ========================
5 5  
  6 + Clean-up public interface
6 7 Adapt to GammaLib 0.9.0 interface
7 8 ctbin now always merges event lists into a single counts cube
8 9 Add ctexpcube tool (generates exposure cube)
... ...
... ... @@ -2,7 +2,7 @@ New Features and Important Changes in ctools 00-08-00
2 2  
3 3 Author(s) : Juergen Knoedlseder
4 4  
5   -22 July 2014
  5 +24 July 2014
6 6  
7 7  
8 8 1. Introduction
... ... @@ -10,6 +10,12 @@ Author(s) : Juergen Knoedlseder
10 10 This document briefly summarizes executable by executable the most
11 11 important changes made since the last release of ctools.
12 12  
  13 +For all ctools, the public method interface was cleaned up so that
  14 +only methods that are really useful for an outside client are
  15 +exposed. Low-level methods that are used by the application are now
  16 +protected, as improper usage of these methods may lead to
  17 +unpredictable results.
  18 +
13 19  
14 20 2. Configuration
15 21 -----------------
... ...
pyext/ctcubemask.i
... ... @@ -45,13 +45,11 @@ public:
45 45 virtual ~ctcubemask(void);
46 46  
47 47 // Methods
48   - void clear(void);
49   - void execute(void);
50   - void run(void);
51   - void save(void);
52   - GObservations& obs(void);
53   - void get_parameters(void);
54   - void apply_mask(GCTAObservation* obs);
  48 + void clear(void);
  49 + void execute(void);
  50 + void run(void);
  51 + void save(void);
  52 + const GObservations& obs(void) const;
55 53 };
56 54  
57 55  
... ...
pyext/ctexpcube.i
... ... @@ -46,12 +46,11 @@ public:
46 46 virtual ~ctexpcube(void);
47 47  
48 48 // Methods
49   - void clear(void);
50   - void execute(void);
51   - void run(void);
52   - void save(void);
53   - const GObservations& obs(void) const;
54   - const GCTAExposure& expcube(void) const;
  49 + void clear(void);
  50 + void execute(void);
  51 + void run(void);
  52 + void save(void);
  53 + const GCTAExposure& expcube(void) const;
55 54 };
56 55  
57 56  
... ...
pyext/ctlike.i
... ... @@ -46,14 +46,12 @@ public:
46 46 virtual ~ctlike(void);
47 47  
48 48 // Methods
49   - void clear(void);
50   - void execute(void);
51   - void run(void);
52   - void save(void);
53   - GObservations& obs(void);
54   - GOptimizer* opt(void);
55   - void get_parameters(void);
56   - void optimize_lm(void);
  49 + void clear(void);
  50 + void execute(void);
  51 + void run(void);
  52 + void save(void);
  53 + const GObservations& obs(void) const;
  54 + const GOptimizer* opt(void) const;
57 55 };
58 56  
59 57  
... ...
pyext/ctmodel.i
... ... @@ -46,14 +46,11 @@ public:
46 46 virtual ~ctmodel(void);
47 47  
48 48 // Methods
49   - void clear(void);
50   - void execute(void);
51   - void run(void);
52   - void save(void);
53   - GObservations& obs(void) { return m_obs; }
54   - void get_parameters(void);
55   - void setup_obs(void);
56   - void model_map(GCTAObservation* obs, const GModels& models);
  49 + void clear(void);
  50 + void execute(void);
  51 + void run(void);
  52 + void save(void);
  53 + const GObservations& obs(void) const;
57 54 };
58 55  
59 56  
... ...
pyext/ctobssim.i
1 1 /***************************************************************************
2 2 * ctobssim - CTA observation simulation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2011-2014 by Jurgen Knodlseder *
  4 + * copyright (C) 2011-2014 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file ctobssim.i
23 23 * @brief CTA observation simulation tool Python interface definition
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
... ... @@ -45,15 +45,11 @@ public:
45 45 virtual ~ctobssim(void);
46 46  
47 47 // Methods
48   - void clear(void);
49   - void execute(void);
50   - void run(void);
51   - void save(void);
52   - GObservations& obs(void);
53   - void get_parameters(void);
54   - void set_list(GCTAObservation* obs);
55   - void simulate_source(GCTAObservation* obs, const GModels& models, GRan& ran, GLog* wrklog=NULL);
56   - void simulate_background(GCTAObservation* obs, const GModels& models, GRan& ran, GLog* wrklog=NULL);
  48 + void clear(void);
  49 + void execute(void);
  50 + void run(void);
  51 + void save(void);
  52 + const GObservations& obs(void) const;
57 53 };
58 54  
59 55  
... ...
pyext/ctpsfcube.i
... ... @@ -46,17 +46,11 @@ public:
46 46 virtual ~ctpsfcube(void);
47 47  
48 48 // Methods
49   - void clear(void);
50   - void execute(void);
51   - void run(void);
52   - void save(void);
53   - const GObservations& obs(void) const;
54   - const GCTAMeanPsf& psfcube(void) const;
55   - void get_parameters(void);
56   - void get_obs(void);
57   - void set_response(void);
58   - void get_ebounds(void);
59   - void set_from_cntmap(const std::string& filename);
  49 + void clear(void);
  50 + void execute(void);
  51 + void run(void);
  52 + void save(void);
  53 + const GCTAMeanPsf& psfcube(void) const;
60 54 };
61 55  
62 56 /***********************************************************************//**
... ...
pyext/ctselect.i
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file ctselect.i
23 23 * @brief CTA data selection tool Python interface definition
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
... ... @@ -45,13 +45,11 @@ public:
45 45 virtual ~ctselect(void);
46 46  
47 47 // Methods
48   - void clear(void);
49   - void execute(void);
50   - void run(void);
51   - void save(void);
52   - GObservations& obs(void) { return m_obs; }
53   - void get_parameters(void);
54   - void select_events(GCTAObservation* obs, const std::string& filename);
  48 + void clear(void);
  49 + void execute(void);
  50 + void run(void);
  51 + void save(void);
  52 + const GObservations& obs(void) const;
55 53 };
56 54  
57 55  
... ...
pyext/ctskymap.i
... ... @@ -49,11 +49,7 @@ public:
49 49 void execute(void);
50 50 void run(void);
51 51 void save(void);
52   - GObservations& obs(void);
53   - GSkymap& skymap(void);
54   - void get_parameters(void);
55   - void init_map(GCTAObservation* obs);
56   - void map_events(GCTAObservation* obs);
  52 + const GSkymap& map(void) const;
57 53 };
58 54  
59 55  
... ...
src/ctcubemask/ctcubemask.hpp
... ... @@ -56,19 +56,19 @@ public:
56 56 ctcubemask& operator=(const ctcubemask& app);
57 57  
58 58 // Methods
59   - void clear(void);
60   - void execute(void);
61   - void run(void);
62   - void save(void);
63   - GObservations& obs(void) { return m_obs; }
64   - void get_parameters(void);
65   - void apply_mask(GCTAObservation* obs);
  59 + void clear(void);
  60 + void execute(void);
  61 + void run(void);
  62 + void save(void);
  63 + const GObservations& obs(void) const;
66 64  
67 65 protected:
68 66 // Protected methods
69 67 void init_members(void);
70 68 void copy_members(const ctcubemask& app);
71 69 void free_members(void);
  70 + void get_parameters(void);
  71 + void apply_mask(GCTAObservation* obs);
72 72 std::string check_infile(const std::string& filename) const;
73 73 std::string set_outfile_name(const std::string& filename) const;
74 74 void save_fits(void);
... ... @@ -95,4 +95,16 @@ protected:
95 95 bool m_read_ahead; //!< Read ahead parameters
96 96 };
97 97  
  98 +
  99 +/***********************************************************************//**
  100 + * @brief Return observation container
  101 + *
  102 + * @return Reference to observation container
  103 + ***************************************************************************/
  104 +inline
  105 +const GObservations& ctcubemask::obs(void) const
  106 +{
  107 + return m_obs;
  108 +}
  109 +
98 110 #endif /* CTCUBEMASK_HPP */
... ...
src/ctexpcube/ctexpcube.hpp
... ... @@ -55,12 +55,11 @@ public:
55 55 ctexpcube& operator=(const ctexpcube& app);
56 56  
57 57 // Methods
58   - void clear(void);
59   - void execute(void);
60   - void run(void);
61   - void save(void);
62   - const GObservations& obs(void) const;
63   - const GCTAExposure& expcube(void) const;
  58 + void clear(void);
  59 + void execute(void);
  60 + void run(void);
  61 + void save(void);
  62 + const GCTAExposure& expcube(void) const;
64 63  
65 64 protected:
66 65 // Protected methods
... ... @@ -86,18 +85,6 @@ protected:
86 85  
87 86  
88 87 /***********************************************************************//**
89   - * @brief Return observation container
90   - *
91   - * @return Observation container
92   - ***************************************************************************/
93   -inline
94   -const GObservations& ctexpcube::obs(void) const
95   -{
96   - return (m_obs);
97   -}
98   -
99   -
100   -/***********************************************************************//**
101 88 * @brief Return exposure cube
102 89 *
103 90 * @return Exposure cube
... ...
src/ctlike/ctlike.hpp
... ... @@ -55,21 +55,21 @@ public:
55 55 ctlike& operator= (const ctlike& app);
56 56  
57 57 // Methods
58   - void clear(void);
59   - void execute(void);
60   - void run(void);
61   - void save(void);
62   - GObservations& obs(void) { return m_obs; }
63   - GOptimizer* opt(void) { return m_opt; }
64   - void get_parameters(void);
65   - void optimize_lm(void);
66   - double reoptimize_lm(void);
  58 + void clear(void);
  59 + void execute(void);
  60 + void run(void);
  61 + void save(void);
  62 + const GObservations& obs(void) const;
  63 + const GOptimizer* opt(void) const;
67 64  
68 65 protected:
69 66 // Protected methods
70   - void init_members(void);
71   - void copy_members(const ctlike& app);
72   - void free_members(void);
  67 + void init_members(void);
  68 + void copy_members(const ctlike& app);
  69 + void free_members(void);
  70 + void get_parameters(void);
  71 + void optimize_lm(void);
  72 + double reoptimize_lm(void);
73 73  
74 74 // User parameters
75 75 std::string m_stat; //!< Optimisation statistics (poisson/gaussian)
... ... @@ -89,4 +89,28 @@ protected:
89 89 bool m_read_ahead; //!< Read ahead parameters
90 90 };
91 91  
  92 +
  93 +/***********************************************************************//**
  94 + * @brief Return observation container
  95 + *
  96 + * @return Reference to observation container
  97 + ***************************************************************************/
  98 +inline
  99 +const GObservations& ctlike::obs(void) const
  100 +{
  101 + return m_obs;
  102 +}
  103 +
  104 +
  105 +/***********************************************************************//**
  106 + * @brief Return optimizer
  107 + *
  108 + * @return Pointer to optimizer
  109 + ***************************************************************************/
  110 +inline
  111 +const GOptimizer* ctlike::opt(void) const
  112 +{
  113 + return m_opt;
  114 +}
  115 +
92 116 #endif /* CTLIKE_HPP */
... ...
src/ctmodel/ctmodel.hpp
... ... @@ -64,20 +64,20 @@ public:
64 64 ctmodel& operator=(const ctmodel& app);
65 65  
66 66 // Methods
67   - void clear(void);
68   - void execute(void);
69   - void run(void);
70   - void save(void);
71   - GObservations& obs(void) { return m_obs; }
72   - void get_parameters(void);
73   - void setup_obs(void);
74   - void model_map(GCTAObservation* obs, const GModels& models);
  67 + void clear(void);
  68 + void execute(void);
  69 + void run(void);
  70 + void save(void);
  71 + const GObservations& obs(void) const;
75 72  
76 73 protected:
77 74 // Protected methods
78 75 void init_members(void);
79 76 void copy_members(const ctmodel& app);
80 77 void free_members(void);
  78 + void get_parameters(void);
  79 + void setup_obs(void);
  80 + void model_map(GCTAObservation* obs, const GModels& models);
81 81 std::string set_outfile_name(const std::string& filename) const;
82 82 void save_fits(void);
83 83 void save_xml(void);
... ... @@ -115,4 +115,16 @@ protected:
115 115 bool m_read_ahead; //!< Read ahead parameters
116 116 };
117 117  
  118 +
  119 +/***********************************************************************//**
  120 + * @brief Return observation container
  121 + *
  122 + * @return Reference to observation container
  123 + ***************************************************************************/
  124 +inline
  125 +const GObservations& ctmodel::obs(void) const
  126 +{
  127 + return m_obs;
  128 +}
  129 +
118 130 #endif /* CTMODEL_HPP */
... ...
src/ctobssim/ctobssim.hpp
... ... @@ -60,21 +60,27 @@ public:
60 60 ctobssim& operator=(const ctobssim& app);
61 61  
62 62 // Methods
63   - void clear(void);
64   - void execute(void);
65   - void run(void);
66   - void save(void);
67   - GObservations& obs(void) { return m_obs; }
68   - void get_parameters(void);
69   - void set_list(GCTAObservation* obs);
70   - void simulate_source(GCTAObservation* obs, const GModels& models,GRan& ran, GLog* wrklog=NULL);
71   - void simulate_background(GCTAObservation* obs, const GModels& models,GRan& ran, GLog* wrklog=NULL);
  63 + void clear(void);
  64 + void execute(void);
  65 + void run(void);
  66 + void save(void);
  67 + const GObservations& obs(void) const;
72 68  
73 69 protected:
74 70 // Protected methods
75 71 void init_members(void);
76 72 void copy_members(const ctobssim& app);
77 73 void free_members(void);
  74 + void get_parameters(void);
  75 + void set_list(GCTAObservation* obs);
  76 + void simulate_source(GCTAObservation* obs,
  77 + const GModels& models,
  78 + GRan& ran,
  79 + GLog* wrklog = NULL);
  80 + void simulate_background(GCTAObservation* obs,
  81 + const GModels& models,
  82 + GRan& ran,
  83 + GLog* wrklog = NULL);
78 84 void save_fits(void);
79 85 void save_xml(void);
80 86  
... ... @@ -106,4 +112,16 @@ protected:
106 112 int m_event_id; //!< Event identifier
107 113 };
108 114  
  115 +
  116 +/***********************************************************************//**
  117 + * @brief Return observation container
  118 + *
  119 + * @return Reference to observation container
  120 + ***************************************************************************/
  121 +inline
  122 +const GObservations& ctobssim::obs(void) const
  123 +{
  124 + return m_obs;
  125 +}
  126 +
109 127 #endif /* CTOBSSIM_HPP */
... ...
src/ctpsfcube/ctpsfcube.hpp
... ... @@ -55,23 +55,22 @@ public:
55 55 ctpsfcube& operator=(const ctpsfcube& app);
56 56  
57 57 // Methods
58   - void clear(void);
59   - void execute(void);
60   - void run(void);
61   - void save(void);
62   - const GObservations& obs(void) const;
63   - const GCTAMeanPsf& psfcube(void) const;
64   - void get_parameters(void);
65   - void get_obs(void);
66   - void set_response(void);
67   - void get_ebounds(void);
68   - void set_from_cntmap(const std::string& filename);
  58 + void clear(void);
  59 + void execute(void);
  60 + void run(void);
  61 + void save(void);
  62 + const GCTAMeanPsf& psfcube(void) const;
69 63  
70 64 protected:
71 65 // Protected methods
72   - void init_members(void);
73   - void copy_members(const ctpsfcube& app);
74   - void free_members(void);
  66 + void init_members(void);
  67 + void copy_members(const ctpsfcube& app);
  68 + void free_members(void);
  69 + void get_parameters(void);
  70 + void get_obs(void);
  71 + void set_response(void);
  72 + void get_ebounds(void);
  73 + void set_from_cntmap(const std::string& filename);
75 74  
76 75 // User parameters
77 76 std::string m_outfile; //!< Output PSF cube file
... ... @@ -86,18 +85,6 @@ protected:
86 85  
87 86  
88 87 /***********************************************************************//**
89   - * @brief Return observation container
90   - *
91   - * @return Observation container
92   - ***************************************************************************/
93   -inline
94   -const GObservations& ctpsfcube::obs(void) const
95   -{
96   - return (m_obs);
97   -}
98   -
99   -
100   -/***********************************************************************//**
101 88 * @brief Return PSF cube
102 89 *
103 90 * @return PSF cube
... ...
src/ctselect/ctselect.hpp
... ... @@ -53,22 +53,22 @@ public:
53 53 virtual ~ctselect(void);
54 54  
55 55 // Operators
56   - ctselect& operator= (const ctselect& app);
  56 + ctselect& operator=(const ctselect& app);
57 57  
58 58 // Methods
59   - void clear(void);
60   - void execute(void);
61   - void run(void);
62   - void save(void);
63   - GObservations& obs(void) { return m_obs; }
64   - void get_parameters(void);
65   - void select_events(GCTAObservation* obs, const std::string& filename);
  59 + void clear(void);
  60 + void execute(void);
  61 + void run(void);
  62 + void save(void);
  63 + const GObservations& obs(void) const;
66 64  
67 65 protected:
68 66 // Protected methods
69 67 void init_members(void);
70 68 void copy_members(const ctselect& app);
71 69 void free_members(void);
  70 + void get_parameters(void);
  71 + void select_events(GCTAObservation* obs, const std::string& filename);
72 72 std::string check_infile(const std::string& filename) const;
73 73 std::string set_outfile_name(const std::string& filename) const;
74 74 void save_fits(void);
... ... @@ -101,4 +101,16 @@ protected:
101 101 GTimeReference m_cta_ref; //!< CTA time reference
102 102 };
103 103  
  104 +
  105 +/***********************************************************************//**
  106 + * @brief Return observation container
  107 + *
  108 + * @return Reference to observation container
  109 + ***************************************************************************/
  110 +inline
  111 +const GObservations& ctselect::obs(void) const
  112 +{
  113 + return m_obs;
  114 +}
  115 +
104 116 #endif /* CTSELECT_HPP */
... ...
src/ctskymap/ctskymap.hpp
... ... @@ -53,25 +53,23 @@ public:
53 53 virtual ~ctskymap(void);
54 54  
55 55 // Operators
56   - ctskymap& operator= (const ctskymap& app);
  56 + ctskymap& operator=(const ctskymap& app);
57 57  
58 58 // Methods
59 59 void clear(void);
60 60 void execute(void);
61 61 void run(void);
62 62 void save(void);
63   - GObservations& obs(void) { return m_obs; }
64   - GSkymap& skymap(void) { return m_skymap; }
65   - void get_parameters(void);
66   - void init_map(GCTAObservation* obs);
67   - void map_events(GCTAObservation* obs);
68   -
  63 + const GSkymap& map(void) const;
69 64  
70 65 protected:
71 66 // Protected methods
72 67 void init_members(void);
73 68 void copy_members(const ctskymap& app);
74 69 void free_members(void);
  70 + void get_parameters(void);
  71 + void init_map(GCTAObservation* obs);
  72 + void map_events(GCTAObservation* obs);
75 73  
76 74 // User parameters
77 75 std::string m_evfile; //!< Input event list
... ... @@ -91,4 +89,16 @@ protected:
91 89 GSkymap m_skymap; //!< Sky map
92 90 };
93 91  
  92 +
  93 +/***********************************************************************//**
  94 + * @brief Return observation container
  95 + *
  96 + * @return Reference to observation container
  97 + ***************************************************************************/
  98 +inline
  99 +const GSkymap& ctskymap::map(void) const
  100 +{
  101 + return m_skymap;
  102 +}
  103 +
94 104 #endif /* CTSKYMAP_HPP */
... ...