Permalink
Browse files

Merge pull request #1692 from KaiSzuttor/accumulator

accumulator: initialize m_obs member in scriptinterface.
  • Loading branch information...
fweik committed Dec 7, 2017
2 parents 2f66734 + 452959b commit 95e17bd52827d65a7f10303807ad073c5dbdb7b6
Showing with 2 additions and 0 deletions.
  1. +1 −0 src/script_interface/accumulators/Accumulator.hpp
  2. +1 −0 testsuite/accumulator.py
@@ -43,6 +43,7 @@ class Accumulator : public AutoParameters {
// We are expecting a ScriptInterface::Observables::Observable here,
// throw if not. That means the assigned object had the wrong type.
if (obs_ptr) {
m_obs = obs_ptr;
m_accumulator->m_obs = obs_ptr->observable();
m_accumulator->initialize();
}
View
@@ -57,6 +57,7 @@ def test_accumulator(self):
for i in range(self.positions.shape[0]):
self.system.part[0].pos = self.positions[i]
self.system.integrator.run(1)
self.assertEqual(self.pos_obs, self.pos_obs_acc.get_params()['obs'])
np.testing.assert_allclose(
self.pos_obs_acc.get_mean(), np.mean(
self.positions, axis=0), atol=1e-4)

0 comments on commit 95e17bd

Please sign in to comment.