Class: Mlr::Strategy::Python
- Inherits:
-
Object
- Object
- Mlr::Strategy::Python
- Defined in:
- lib/mlr/strategy/python.rb
Constant Summary collapse
- SCRIPT =
<<~PYTHON import localization as lx P=lx.Project(mode='%{mode}',solver='%{solver}') %{anchors} t,label=P.add_target() %{measures} P.solve() PYTHON
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(points:, mode: Mlr::MODE2D, solver: Mlr::SOLVER_LSE) ⇒ Python
constructor
A new instance of Python.
- #options ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(points:, mode: Mlr::MODE2D, solver: Mlr::SOLVER_LSE) ⇒ Python
Returns a new instance of Python.
19 20 21 22 23 |
# File 'lib/mlr/strategy/python.rb', line 19 def initialize(points:, mode: Mlr::MODE2D, solver: Mlr::SOLVER_LSE) @points = points @mode = mode @solver = solver end |
Class Method Details
.get_point(options) ⇒ Object
15 16 17 |
# File 'lib/mlr/strategy/python.rb', line 15 def self.get_point() new().run end |
Instance Method Details
#options ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/mlr/strategy/python.rb', line 33 def { anchors: get_anchors, measures: get_measures, mode: get_mode, solver: get_solver } end |
#run ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/mlr/strategy/python.rb', line 25 def run # run python script PyCall.exec(SCRIPT % ) # get result from python make_point(PyCall.eval('t.loc')) end |