From be0c9fecc5c5e1c06ce63708a858c3dbca28aae2 Mon Sep 17 00:00:00 2001 From: Nicholas Tolley Date: Thu, 8 Aug 2024 18:29:31 -0400 Subject: [PATCH] add dt and tstop attributes --- hnn_core/dipole.py | 4 ++++ hnn_core/network.py | 3 +++ hnn_core/tests/test_dipole.py | 2 ++ 3 files changed, 9 insertions(+) diff --git a/hnn_core/dipole.py b/hnn_core/dipole.py index 789a91800..408acfb31 100644 --- a/hnn_core/dipole.py +++ b/hnn_core/dipole.py @@ -103,6 +103,10 @@ def simulate_dipole(net, tstop, dt=0.025, n_trials=None, record_vsec=False, net._params['record_ca'] = record_ca + net._tstop = tstop + + net._dt = dt + if postproc: warnings.warn('The postproc-argument is deprecated and will be removed' ' in a future release of hnn-core. Please define ' diff --git a/hnn_core/network.py b/hnn_core/network.py index 589f9136b..3315c44d3 100644 --- a/hnn_core/network.py +++ b/hnn_core/network.py @@ -443,6 +443,9 @@ def __init__(self, params, add_drives_from_params=False, if add_drives_from_params: _add_drives_from_params(self) + self._tstop = None + self._dt = None + def __repr__(self): class_name = self.__class__.__name__ s = ("%d x %d Pyramidal cells (L2, L5)" diff --git a/hnn_core/tests/test_dipole.py b/hnn_core/tests/test_dipole.py index d329ec98c..9beea6b9d 100644 --- a/hnn_core/tests/test_dipole.py +++ b/hnn_core/tests/test_dipole.py @@ -193,6 +193,8 @@ def test_dipole_simulation(): # test Network.copy() returns 'bare' network after simulating dpl = simulate_dipole(net, tstop=25., n_trials=1)[0] + assert net._dt == 0.025 + assert net._tstop == 25.0 net_copy = net.copy() assert len(net_copy.external_drives['evprox1']['events']) == 0