Commit cb3431480190842fa4ace915d39b7e37e96c4e28

Authored by Jürgen Knödlseder
1 parent 413461b4

Add ctmodel::models() method that allows assigning of a model container for modelling.

pyext/ctmodel.i
1 /*************************************************************************** 1 /***************************************************************************
2 * ctmodel - Model cube generation tool * 2 * ctmodel - Model cube generation tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2012-2014 by Juergen Knoedlseder * 4 + * copyright (C) 2012-2015 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -50,6 +50,7 @@ public: @@ -50,6 +50,7 @@ public:
50 const GObservations& obs(void) const; 50 const GObservations& obs(void) const;
51 const GCTAEventCube& cube(void) const; 51 const GCTAEventCube& cube(void) const;
52 void cube(const GCTAEventCube& cube); 52 void cube(const GCTAEventCube& cube);
  53 + void models(const GModels& models);
53 }; 54 };
54 55
55 56
src/ctmodel/ctmodel.cpp
@@ -432,6 +432,8 @@ void ctmodel::get_parameters(void) @@ -432,6 +432,8 @@ void ctmodel::get_parameters(void)
432 432
433 // Read model definition file if required 433 // Read model definition file if required
434 if (m_obs.models().size() == 0) { 434 if (m_obs.models().size() == 0) {
  435 +
  436 + // Get model filename
435 std::string inmodel = (*this)["inmodel"].filename(); 437 std::string inmodel = (*this)["inmodel"].filename();
436 438
437 // Load models from file 439 // Load models from file
src/ctmodel/ctmodel.hpp
@@ -71,6 +71,7 @@ public: @@ -71,6 +71,7 @@ public:
71 const GObservations& obs(void) const; 71 const GObservations& obs(void) const;
72 const GCTAEventCube& cube(void) const; 72 const GCTAEventCube& cube(void) const;
73 void cube(const GCTAEventCube& cube); 73 void cube(const GCTAEventCube& cube);
  74 + void models(const GModels& models);
74 75
75 protected: 76 protected:
76 // Protected methods 77 // Protected methods
@@ -130,4 +131,19 @@ bool ctmodel::has_cube(void) const @@ -130,4 +131,19 @@ bool ctmodel::has_cube(void) const
130 return m_has_cube; 131 return m_has_cube;
131 } 132 }
132 133
  134 +
  135 +/***********************************************************************//**
  136 + * @brief Set models
  137 + *
  138 + * @param[in] models Model container.
  139 + *
  140 + * Set model container that should be used for model generation.
  141 + ***************************************************************************/
  142 +inline
  143 +void ctmodel::models(const GModels& models)
  144 +{
  145 + m_obs.models(models);
  146 + return;
  147 +}
  148 +
133 #endif /* CTMODEL_HPP */ 149 #endif /* CTMODEL_HPP */