nest / nestml

A domain specific language for neuron and synapse models in spiking neural network simulation
GNU General Public License v2.0
46 stars 45 forks source link

Add predefined ``timestep()`` function #1100

Open clinssen opened 2 weeks ago

clinssen commented 2 weeks ago

Add a timestep() function so models can be formulated in more generic terms than using the resolution() function. The latter assumes a fixed simulation timestep; the former is compatible with timesteps of arbitrary size (with subsequent steps potentially being of different size).

Existing time-based functions (resolution() and steps()) will remain, in order to be able to formulate models optimised for fixed-timestep simulators. This is also necessary to get a numerically identical result with NEST for at least one of the tests (stdp triplet synapse test). A warning will be emitted during model validation with a recommendation to use timestep() where possible.

New refractoriness mechanisms are implemented based on a countdown ODE (thanks to Tom Tetzlaff and Markus Diesmann!) This means that neither resolution() nor timestep() needs to be used any longer in the neuron models for the refractoriness mechanism. (See discussion in #988).

As a sidegoal: the triplet STDP synapse test contained simultaneously occurring pre- and post-spikes in the test set, which is not yet properly handled (this is already spun off to https://github.com/nest/nestml/issues/703). This meant that passing the test was relying on poorly predictable floating point behaviour. I have updated the spike sequences to not contain overlapping spikes, set the proper edge case flags and enabled the test for multiple synaptic delays (which now works).

TODO

clinssen commented 3 days ago

Thank you for the detailed review! I have implemented all your comments, especially having done a rewrite of the "Implementing refractoriness" section in the neuron models documentation. Could you have another look? Much obliged!

github-actions[bot] commented 3 days ago

🐰 Bencher Report

Branch1100/merge
Testbedubuntu-latest

⚠️ WARNING: The following Measure does not have a Threshold. Without a Threshold, no Alerts will ever be generated!

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds CLI flag.

Click to view all benchmark results
BenchmarkLatencynanoseconds (ns)
tests/nest_continuous_benchmarking/test_nest_continuous_benchmarking.py::TestNESTContinuousBenchmarking::test_stdp_nn_synapse📈 view plot
⚠️ NO THRESHOLD
4,253,700,342.00
🐰 View full continuous benchmarking report in Bencher