Commit 5fb3bfaf348882278fc8a1ea90646e28356f6c64

Authored by knodlseder
1 parent 2e74f2e2

Read output file as last parameters as proper order parameter parsing is easier …

…to understand for the user.

Instead of reading ahead the output parameter, I added a flag that signals when ahead reading is desired.
src/ctbin/ctbin.cpp
... ... @@ -206,9 +206,8 @@ void ctbin::clear(void)
206 206 ***************************************************************************/
207 207 void ctbin::execute(void)
208 208 {
209   - // Read ahead output filename so that it gets dumped correctly in the
210   - // parameters log
211   - m_outfile = (*this)["outfile"].filename();
  209 + // Signal that some parameters should be read ahead
  210 + m_read_ahead = true;
212 211  
213 212 // Bin the event data
214 213 run();
... ... @@ -439,6 +438,12 @@ void ctbin::get_parameters(void)
439 438 m_nxpix = (*this)["nxpix"].integer();
440 439 m_nypix = (*this)["nypix"].integer();
441 440  
  441 + // Optionally read ahead parameters so that they get correctly
  442 + // dumped into the log file
  443 + if (m_read_ahead) {
  444 + m_outfile = (*this)["outfile"].filename();
  445 + }
  446 +
442 447 // Return
443 448 return;
444 449 }
... ... @@ -614,7 +619,8 @@ void ctbin::init_members(void)
614 619 // Initialise protected members
615 620 m_obs.clear();
616 621 m_infiles.clear();
617   - m_use_xml = false;
  622 + m_use_xml = false;
  623 + m_read_ahead = false;
618 624  
619 625 // Set logger properties
620 626 log.date(true);
... ... @@ -647,9 +653,10 @@ void ctbin::copy_members(const ctbin& app)
647 653 m_nypix = app.m_nypix;
648 654  
649 655 // Copy protected members
650   - m_obs = app.m_obs;
651   - m_infiles = app.m_infiles;
652   - m_use_xml = app.m_use_xml;
  656 + m_obs = app.m_obs;
  657 + m_infiles = app.m_infiles;
  658 + m_use_xml = app.m_use_xml;
  659 + m_read_ahead = app.m_read_ahead;
653 660  
654 661 // Return
655 662 return;
... ...
src/ctbin/ctbin.hpp
... ... @@ -80,24 +80,25 @@ protected:
80 80 const std::string& outfile) const;
81 81  
82 82 // User parameters
83   - std::string m_evfile; //!< Input event list or XML file
84   - std::string m_outfile; //!< Output counts map or XML file
85   - std::string m_prefix; //!< Prefix for multiple counts maps
86   - double m_emin; //!< Lower energy
87   - double m_emax; //!< Upper energy
88   - int m_enumbins; //!< Number of energy bins
89   - std::string m_proj; //!< WCS projection
90   - std::string m_coordsys; //!< Coordinate system
91   - double m_xref; //!< Longitude reference coordinate
92   - double m_yref; //!< Latitude reference coordinate
93   - double m_binsz; //!< Pixel size
94   - int m_nxpix; //!< Number of pixels in longitude
95   - int m_nypix; //!< Number of pixels in latitude
  83 + std::string m_evfile; //!< Input event list or XML file
  84 + std::string m_outfile; //!< Output counts map or XML file
  85 + std::string m_prefix; //!< Prefix for multiple counts maps
  86 + double m_emin; //!< Lower energy
  87 + double m_emax; //!< Upper energy
  88 + int m_enumbins; //!< Number of energy bins
  89 + std::string m_proj; //!< WCS projection
  90 + std::string m_coordsys; //!< Coordinate system
  91 + double m_xref; //!< Longitude reference coordinate
  92 + double m_yref; //!< Latitude reference coordinate
  93 + double m_binsz; //!< Pixel size
  94 + int m_nxpix; //!< Number of pixels in longitude
  95 + int m_nypix; //!< Number of pixels in latitude
96 96  
97 97 // Protected members
98   - GObservations m_obs; //!< Observation container
99   - std::vector<std::string> m_infiles; //!< Input event filenames
100   - bool m_use_xml; //!< Use XML file instead of FITS file
  98 + GObservations m_obs; //!< Observation container
  99 + std::vector<std::string> m_infiles; //!< Input event filenames
  100 + bool m_use_xml; //!< Use XML file instead of FITS file
  101 + bool m_read_ahead; //!< Read ahead parameters
101 102 };
102 103  
103 104 #endif /* CTBIN_HPP */
... ...