diff --git a/ChangeLog b/ChangeLog index 6a78cb8..8ab3580 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -2016-07-31 +2016-08-04 * Version 1.2.0 released ======================== + Fix exception when calling ctools clear() methods (#1835) Add support modules to cscripts (#1830) Fix lacking coverage measure for cscripts execution (#1827) Set "addbounds" parameters by default to "no" (#1819) diff --git a/NEWS b/NEWS index f759d34..674d172 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ New Features and Important Changes in ctools 1.2.0 -31 July 2016 +4 August 2016 Introduction @@ -27,82 +27,106 @@ None ctobssim - CTA observation simulation ------------------------------------- -None +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). ctselect - CTA event selection ------------------------------ -None +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). ctbin - CTA event binning ------------------------- -None +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). ctlike - Maximum likelihood fitting ----------------------------------- -None +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). cttsmap - Generation of Test Statistic map ------------------------------------------ -None +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). ctskymap - CTA sky mapping -------------------------- -None +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). ctmodel - CTA counts cube modelling ----------------------------------- -None +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). ctexpcube - CTA exposure cube generation ---------------------------------------- Set hidden "addbounds" parameter by default to "no" (#1819). +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). + ctpsfcube - CTA point spread function cube generation ----------------------------------------------------- Set hidden "addbounds" parameter by default to "no" (#1819). +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). + ctedispcube - CTA energy dispersion cube generation --------------------------------------------------- Set hidden "addbounds" parameter by default to "no" (#1819). +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). + ctbkgcube - CTA background cube generation ------------------------------------------ Set hidden "addbounds" parameter by default to "no" (#1819). +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). + ctmapcube - CTA map cube generation ----------------------------------- -None +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). ctcubemask - CTA cube filtering ------------------------------- -None +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). ctbutterfly - Generate butterfly diagrams ----------------------------------------- -None +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). ctulimit - Compute upper limit ------------------------------ -None +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). cterror - Likelihood profile error computation ---------------------------------------------- -None +The clear() method now calls GApplication::clear() to conserve the properties +of the tool (#1835). cscripts diff --git a/README.md b/README.md index 03f1f1b..7c8ecdb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ctools information ================== -* Version: 1.2.0.dev1 (31 July 2016) +* Version: 1.2.0.dev1 (4 August 2016) * Author: Juergen Knoedlseder (jurgen.knodlseder@irap.omp.eu) * GammaLib dependency: 1.2.0.dev1 diff --git a/src/ctbin/ctbin.cpp b/src/ctbin/ctbin.cpp index 8ab6f93..84bbcdd 100644 --- a/src/ctbin/ctbin.cpp +++ b/src/ctbin/ctbin.cpp @@ -195,13 +195,17 @@ void ctbin::clear(void) // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/ctbkgcube/ctbkgcube.cpp b/src/ctbkgcube/ctbkgcube.cpp index 4e88d37..46fcfa1 100644 --- a/src/ctbkgcube/ctbkgcube.cpp +++ b/src/ctbkgcube/ctbkgcube.cpp @@ -175,20 +175,26 @@ ctbkgcube& ctbkgcube::operator=(const ctbkgcube& app) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear ctbkgcube tool + * + * Clears ctbkgcube tool. ***************************************************************************/ void ctbkgcube::clear(void) { // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/ctbutterfly/ctbutterfly.cpp b/src/ctbutterfly/ctbutterfly.cpp index c25f7c5..e130361 100644 --- a/src/ctbutterfly/ctbutterfly.cpp +++ b/src/ctbutterfly/ctbutterfly.cpp @@ -176,20 +176,26 @@ ctbutterfly& ctbutterfly::operator=(const ctbutterfly& app) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear ctbutterfly tool + * + * Clears ctbutterfly tool. ***************************************************************************/ void ctbutterfly::clear(void) { // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } @@ -313,10 +319,6 @@ void ctbutterfly::run(void) double cov_pg = m_covariance(inx_prefactor,inx_index); double cov_gg = m_covariance(inx_index,inx_index); - // Initialise min and max intensities - m_min_intensities.assign(m_ebounds.size(), 1e30); - m_max_intensities.assign(m_ebounds.size(), 0.0); - // Compute eigenvectors and eigenvalues double lambda1; double lambda2; @@ -346,6 +348,12 @@ void ctbutterfly::run(void) // Write header into logger log_header1(TERSE, "Generate butterfly"); + // Initialise result arrays + m_energies.assign(m_ebounds.size(), 0.0); + m_intensities.assign(m_ebounds.size(), 0.0); + m_min_intensities.assign(m_ebounds.size(), 1e30); + m_max_intensities.assign(m_ebounds.size(), 0.0); + // Walk around the error ellipse int nt = 360; double dt = gammalib::twopi/double(nt); @@ -382,7 +390,7 @@ void ctbutterfly::run(void) // Evaluate power law double intensity = plaw.eval(energy, time); - + // Get extremes if (intensity < m_min_intensities[k]) { m_min_intensities[k] = intensity; @@ -395,13 +403,10 @@ void ctbutterfly::run(void) } // endfor: looped over all angles - // Write header into logger - log_header1(TERSE, "Results"); - - // Setup power law model + // Setup power law model for mean prefactor and index GModelSpectralPlaw plaw(prefactor_mean, index_mean, pivot); - // Show results + // Compute energy and intensity vectors for mean power law for (int k = 0; k < m_ebounds.size(); ++k) { // Get the energy of current bin @@ -412,16 +417,24 @@ void ctbutterfly::run(void) double intensity = plaw.eval(energy, time); // Store results - m_energies.push_back(energy.MeV()); - m_intensities.push_back(intensity); + m_energies[k] = energy.MeV(); + m_intensities[k] = intensity; + + } // endfor: looped over energies + + // Write header into logger + log_header1(TERSE, "Results"); + + // Show results + for (int k = 0; k < m_ebounds.size(); ++k) { // Write results into logger - log_value(NORMAL, "Intensity at "+energy.print(), - gammalib::str(intensity)+" ("+ + log_value(NORMAL, "Intensity at "+gammalib::str(m_energies[k])+" MeV", + gammalib::str(m_intensities[k])+" ("+ gammalib::str(m_min_intensities[k])+", "+ gammalib::str(m_max_intensities[k])+") ph/cm2/s/MeV"); - } // endfor + } // endfor: looped over energies // Restore energy dispersion flag for all CTA observations for (int i = 0; i < m_obs.size(); ++i) { diff --git a/src/ctcubemask/ctcubemask.cpp b/src/ctcubemask/ctcubemask.cpp index 3496b8e..51186d0 100644 --- a/src/ctcubemask/ctcubemask.cpp +++ b/src/ctcubemask/ctcubemask.cpp @@ -177,20 +177,26 @@ ctcubemask& ctcubemask::operator=(const ctcubemask& app) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear ctcubemask tool + * + * Clears ctcubemask tool. ***************************************************************************/ void ctcubemask::clear(void) { // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/ctedispcube/ctedispcube.cpp b/src/ctedispcube/ctedispcube.cpp index 2f5403a..35de96a 100644 --- a/src/ctedispcube/ctedispcube.cpp +++ b/src/ctedispcube/ctedispcube.cpp @@ -195,13 +195,17 @@ void ctedispcube::clear(void) // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/cterror/cterror.cpp b/src/cterror/cterror.cpp index 2901e5c..5063d8a 100644 --- a/src/cterror/cterror.cpp +++ b/src/cterror/cterror.cpp @@ -188,22 +188,26 @@ cterror& cterror::operator=(const cterror& app) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear cterror tool * - * Resets the cterror tool to a clean initial state. + * Clears cterror tool. ***************************************************************************/ void cterror::clear(void) { // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/ctexpcube/ctexpcube.cpp b/src/ctexpcube/ctexpcube.cpp index cdaeb12..3da1d90 100644 --- a/src/ctexpcube/ctexpcube.cpp +++ b/src/ctexpcube/ctexpcube.cpp @@ -175,20 +175,26 @@ ctexpcube& ctexpcube::operator=(const ctexpcube& app) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear ctexpcube tool + * + * Clears ctexpcube tool. ***************************************************************************/ void ctexpcube::clear(void) { // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/ctlike/ctlike.cpp b/src/ctlike/ctlike.cpp index a6f130a..a7c3f89 100644 --- a/src/ctlike/ctlike.cpp +++ b/src/ctlike/ctlike.cpp @@ -171,20 +171,26 @@ ctlike& ctlike::operator=(const ctlike& app) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear ctlike tool + * + * Clears ctlike tool. ***************************************************************************/ void ctlike::clear(void) { // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/ctmapcube/ctmapcube.cpp b/src/ctmapcube/ctmapcube.cpp index e9bfc5e..3832f36 100644 --- a/src/ctmapcube/ctmapcube.cpp +++ b/src/ctmapcube/ctmapcube.cpp @@ -151,20 +151,26 @@ ctmapcube& ctmapcube::operator=(const ctmapcube& app) ==========================================================================*/ /***********************************************************************//** - * @brief Clear tool + * @brief Clear ctmapcube tool + * + * Clears ctmapcube tool. ***************************************************************************/ void ctmapcube::clear(void) { // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/ctmodel/ctmodel.cpp b/src/ctmodel/ctmodel.cpp index e87ac41..6a79c86 100644 --- a/src/ctmodel/ctmodel.cpp +++ b/src/ctmodel/ctmodel.cpp @@ -175,20 +175,26 @@ ctmodel& ctmodel::operator=(const ctmodel& app) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear ctmodel tool + * + * Clears ctmodel tool. ***************************************************************************/ void ctmodel::clear(void) { // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/ctobssim/ctobssim.cpp b/src/ctobssim/ctobssim.cpp index 049a5c6..d581984 100644 --- a/src/ctobssim/ctobssim.cpp +++ b/src/ctobssim/ctobssim.cpp @@ -203,13 +203,17 @@ void ctobssim::clear(void) // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/ctpsfcube/ctpsfcube.cpp b/src/ctpsfcube/ctpsfcube.cpp index 932a9db..a4d435d 100644 --- a/src/ctpsfcube/ctpsfcube.cpp +++ b/src/ctpsfcube/ctpsfcube.cpp @@ -174,20 +174,26 @@ ctpsfcube& ctpsfcube::operator=(const ctpsfcube& app) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear ctpsfcube tool + * + * Clears ctpsfcube tool. ***************************************************************************/ void ctpsfcube::clear(void) { // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/ctselect/ctselect.cpp b/src/ctselect/ctselect.cpp index a687d8e..29c3cf4 100644 --- a/src/ctselect/ctselect.cpp +++ b/src/ctselect/ctselect.cpp @@ -179,20 +179,26 @@ ctselect& ctselect::operator=(const ctselect& app) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear ctselect tool + * + * Clears ctselect tool. ***************************************************************************/ void ctselect::clear(void) { // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/ctskymap/ctskymap.cpp b/src/ctskymap/ctskymap.cpp index 1597f0b..fb29760 100644 --- a/src/ctskymap/ctskymap.cpp +++ b/src/ctskymap/ctskymap.cpp @@ -175,20 +175,26 @@ ctskymap& ctskymap::operator=(const ctskymap& app) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear ctskymap tool + * + * Clears ctskymap tool. ***************************************************************************/ void ctskymap::clear(void) { // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/cttsmap/cttsmap.cpp b/src/cttsmap/cttsmap.cpp index 8ac037e..716a8e5 100644 --- a/src/cttsmap/cttsmap.cpp +++ b/src/cttsmap/cttsmap.cpp @@ -173,20 +173,26 @@ cttsmap& cttsmap::operator=(const cttsmap& app) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear cttsmap tool + * + * Clears cttsmap tool. ***************************************************************************/ void cttsmap::clear(void) { // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/ctulimit/ctulimit.cpp b/src/ctulimit/ctulimit.cpp index d038b66..d20901e 100644 --- a/src/ctulimit/ctulimit.cpp +++ b/src/ctulimit/ctulimit.cpp @@ -198,13 +198,17 @@ void ctulimit::clear(void) // Free members free_members(); this->ctool::free_members(); - this->GApplication::free_members(); + + // Clear base class (needed to conserve tool name and version) + this->GApplication::clear(); // Initialise members - this->GApplication::init_members(); this->ctool::init_members(); init_members(); + // Write header into logger + log_header(); + // Return return; } diff --git a/src/support/ctool.cpp b/src/support/ctool.cpp index 9618266..5b3ce42 100644 --- a/src/support/ctool.cpp +++ b/src/support/ctool.cpp @@ -276,9 +276,7 @@ void ctool::copy_members(const ctool& app) void ctool::free_members(void) { // Write separator into logger - if (logTerse()) { - log << std::endl; - } + log_string(TERSE, "\n"); // Return return; diff --git a/test/test_ctbin.py b/test/test_ctbin.py index 52c5e30..20158aa 100755 --- a/test/test_ctbin.py +++ b/test/test_ctbin.py @@ -179,14 +179,14 @@ class Test(test): self._check_cube(evt, 5542) # Now clear ctbin tool - #bin.clear() # Segfaults, see issue #1835 + bin.clear() # Check that cleared ctbin has an empty observation container and # counts cube - #self.test_value(bin.obs().size(), 0, - # 'Check that empty ctbin has an empty observation container') - #self.test_value(bin.cube().size(), 0, - # 'Check that empty ctbin has an empty counts cube') + self.test_value(bin.obs().size(), 0, + 'Check that empty ctbin has an empty observation container') + self.test_value(bin.cube().size(), 0, + 'Check that empty ctbin has an empty counts cube') # Prepare observation container for stacked analysis cta = gammalib.GCTAObservation(self._events) diff --git a/test/test_ctbkgcube.py b/test/test_ctbkgcube.py index eeb7c6b..e0d6120 100755 --- a/test/test_ctbkgcube.py +++ b/test/test_ctbkgcube.py @@ -116,8 +116,6 @@ class Test(test): bkgcube['inobs'] = self._events bkgcube['inmodel'] = self._model bkgcube['incube'] = 'NONE' - bkgcube['outcube'] = 'ctbkgcube_py1.fits' - bkgcube['outmodel'] = 'ctbkgcube_py1.xml' bkgcube['caldb'] = self._caldb bkgcube['irf'] = self._irf bkgcube['ebinalg'] = 'LOG' @@ -131,6 +129,8 @@ class Test(test): bkgcube['proj'] = 'CAR' bkgcube['xref'] = 83.63 bkgcube['yref'] = 22.01 + bkgcube['outcube'] = 'ctbkgcube_py1.fits' + bkgcube['outmodel'] = 'ctbkgcube_py1.xml' bkgcube['logfile'] = 'ctbkgcube_py1.log' bkgcube['chatter'] = 2 @@ -142,6 +142,87 @@ class Test(test): # Check result file self._check_result_file('ctbkgcube_py1.fits') + # Set-up ctbkgcube from counts cube + bkgcube = ctools.ctbkgcube() + bkgcube['inobs'] = self._events + bkgcube['inmodel'] = self._model + bkgcube['incube'] = self._cntcube + bkgcube['caldb'] = self._caldb + bkgcube['irf'] = self._irf + bkgcube['outcube'] = 'ctbkgcube_py2.fits' + bkgcube['outmodel'] = 'ctbkgcube_py2.xml' + bkgcube['logfile'] = 'ctbkgcube_py2.log' + bkgcube['chatter'] = 3 + bkgcube['publish'] = True + bkgcube['addbounds'] = True + + # Execute ctbkgcube tool + bkgcube.logFileOpen() # Make sure we get a log file + bkgcube.execute() + + # Check result file + self._check_result_file('ctbkgcube_py2.fits') + + # Copy ctbkgcube tool and execute copied tool + cpy_bkgcube = bkgcube + cpy_bkgcube['outcube'] = 'ctbkgcube_py3.fits' + cpy_bkgcube['outmodel'] = 'ctbkgcube_py3.xml' + cpy_bkgcube['logfile'] = 'ctbkgcube_py3.log' + cpy_bkgcube['chatter'] = 4 + cpy_bkgcube.execute() + + # Check result file + self._check_result_file('ctbkgcube_py3.fits') + + # Clear ctbkgcube tool + bkgcube.clear() + + # TODO: Do some test after clearing of ctbkgcube tool + + # Prepare observation container + obs1 = gammalib.GCTAObservation(self._events) + obs2 = gammalib.GCTAObservation(self._cntcube) + obs3 = gammalib.GLATObservation() + obs1.id('0001') + obs2.id('0002') + obs3.id('0001') + obs3.events(gammalib.GLATEventList()) + obs = gammalib.GObservations() + obs.append(obs1) + obs.append(obs2) + obs.append(obs3) + obs.models(gammalib.GModels(self._model)) + + # Set-up ctbkgcube from observation container + bkgcube = ctools.ctbkgcube(obs) + #bkgcube['inobs'] = self._events + #bkgcube['inmodel'] = self._model + bkgcube['incube'] = 'NONE' + bkgcube['caldb'] = self._caldb + bkgcube['irf'] = self._irf + bkgcube['ebinalg'] = 'LOG' + bkgcube['emin'] = 0.1 + bkgcube['emax'] = 100 + bkgcube['enumbins'] = 20 + bkgcube['nxpix'] = 10 + bkgcube['nypix'] = 10 + bkgcube['binsz'] = 0.4 + bkgcube['coordsys'] = 'CEL' + bkgcube['proj'] = 'CAR' + bkgcube['xref'] = 83.63 + bkgcube['yref'] = 22.01 + bkgcube['outcube'] = 'ctbkgcube_py4.fits' + bkgcube['outmodel'] = 'ctbkgcube_py4.xml' + bkgcube['logfile'] = 'ctbkgcube_py4.log' + bkgcube['chatter'] = 4 + + # Execute ctbkgcube tool + bkgcube.logFileOpen() # Make sure we get a log file + bkgcube.execute() + + # Check result file + self._check_result_file('ctbkgcube_py4.fits') + # Return return diff --git a/test/test_ctbutterfly.py b/test/test_ctbutterfly.py index 137f746..46e971f 100755 --- a/test/test_ctbutterfly.py +++ b/test/test_ctbutterfly.py @@ -138,13 +138,33 @@ class Test(test): butterfly['logfile'] = 'ctbutterfly_py2.log' butterfly['chatter'] = 3 - # Run ctbutterfly tool + # Execute ctbutterfly tool butterfly.logFileOpen() # Make sure we get a log file butterfly.execute() # Check result file self._check_result_file('ctbutterfly_py2.dat') + # Recover observation container + obs = butterfly.obs() + + # TODO: Do someting test on observation container + + # Copy ctbkgcube tool and execute copy + cpy_butterfly = butterfly + cpy_butterfly['outfile'] = 'ctbutterfly_py3.dat' + cpy_butterfly['logfile'] = 'ctbutterfly_py3.log' + cpy_butterfly['chatter'] = 4 + cpy_butterfly.execute() + + # Check result file + self._check_result_file('ctbutterfly_py3.dat') + + # Clear ctbkgcube tool + butterfly.clear() + + # TODO: Do some test after clearing + # Return return diff --git a/test/test_ctcubemask.py b/test/test_ctcubemask.py index 1c625a9..78a20ec 100755 --- a/test/test_ctcubemask.py +++ b/test/test_ctcubemask.py @@ -139,6 +139,7 @@ class Test(test): mask['outcube'] = 'ctcubemask_py2.fits' mask['logfile'] = 'ctcubemask_py2.log' mask['chatter'] = 3 + mask['publish'] = True # Execute ctcubemask tool mask.logFileOpen() # Make sure we get a log file @@ -147,6 +148,21 @@ class Test(test): # Check result file self._check_result_file('ctcubemask_py2.fits', events=5542) + # Copy ctcubemask tool and execute copy + cpy_mask = mask + cpy_mask['outcube'] = 'ctcubemask_py3.fits' + cpy_mask['logfile'] = 'ctcubemask_py3.log' + cpy_mask['chatter'] = 4 + cpy_mask.execute() + + # Check result file + self._check_result_file('ctcubemask_py3.fits', events=5542) + + # Clear ctcubemask tool + mask.clear() + + # TODO: Do some test after clearing + # Return return