Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ignore_and_fire neuron model #2987

Merged
merged 28 commits into from
Dec 11, 2023
Merged

Conversation

mlober
Copy link
Contributor

@mlober mlober commented Nov 14, 2023

This PR adds the ignore_and_fire neuron model of @tomtetzlaff. This neuron model was developed for benchmarking purposes with the goal of retaining constant activity levels while up- and down-scaling of the network. It sends out spikes in fixed time intervals, independent of the given input. It is handled like a regular neuron model by nest.

I suggest @tomtetzlaff and @jessica-mitchell as reviewers.

@jessica-mitchell jessica-mitchell added this to In progress in Documentation via automation Nov 14, 2023
@jessica-mitchell jessica-mitchell added this to To do in Models via automation Nov 14, 2023
@jessica-mitchell jessica-mitchell added T: Enhancement New functionality, model or documentation S: Normal Handle this with default priority labels Nov 14, 2023
@clinssen clinssen self-requested a review November 14, 2023 14:16
Copy link

@tomtetzlaff tomtetzlaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot Melissa. Looks good to me. Just some minor things in the documentation.

models/ignore_and_fire.h Show resolved Hide resolved
models/ignore_and_fire.h Outdated Show resolved Hide resolved
models/ignore_and_fire.h Outdated Show resolved Hide resolved
models/ignore_and_fire.h Outdated Show resolved Hide resolved
Documentation automation moved this from In progress to Review Nov 15, 2023
Models automation moved this from To do to Review Nov 15, 2023
@clinssen
Copy link
Contributor

Hi, thank you for the contribution! Is there any unit test that you might be able to add for the model?

@tomtetzlaff
Copy link

Hi Charl, maybe one could create one from this:

import nest
import numpy

def ignore_and_fire_test():
     
    rate = 5.            ## firing rate (spikes/s)
    phase = 0.4          ## firing phase
    dt = 2**-3           ## simulation time resolution (ms)
    T = 1000.            ## simulation time (ms)

    nest.ResetKernel()
    nest.SetKernelStatus({
        'print_time': True,
        'resolution': dt
    })

    neuron = nest.Create("ignore_and_fire", 1)
    neuron.set({'rate': rate, 'phase': phase})

    spike_recorder = nest.Create('spike_recorder')

    nest.Connect(neuron,spike_recorder)

    nest.Simulate(T)

    ## theoretical spike times
    period = 1./rate * 1e3
    first_spike_time = phase * period + dt
    spike_times_target = numpy.arange(first_spike_time, T, period)

    ## spike times of NEST model
    spike_times_nest = nest.GetStatus(spike_recorder,'events')[0]['times']

    print()
    print('spike times (NEST):', spike_times_nest)
    print('spike times (target):', spike_times_target)

    test_passed = numpy.alltrue(spike_times_nest == spike_times_target)
    print('test passed: %r' % test_passed)
    
    return test_passed

ignore_and_fire_test()

Copy link
Contributor

@jessica-mitchell jessica-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @mlober and @tomtetzlaff for your contribution!
I have a few changes requested: also the table is not rendering on Read the Docs and needs to be fixed up. See output: https://nest-simulator--2987.org.readthedocs.build/en/2987/models/ignore_and_fire.html

models/ignore_and_fire.h Outdated Show resolved Hide resolved
models/ignore_and_fire.h Outdated Show resolved Hide resolved
models/ignore_and_fire.h Outdated Show resolved Hide resolved
models/ignore_and_fire.h Outdated Show resolved Hide resolved
models/ignore_and_fire.h Outdated Show resolved Hide resolved
models/ignore_and_fire.h Outdated Show resolved Hide resolved
models/ignore_and_fire.h Show resolved Hide resolved
models/ignore_and_fire.h Outdated Show resolved Hide resolved
Copy link

@tomtetzlaff tomtetzlaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jessica. This looks all very good to me. How can we fix the table? I copied the format from some other neuron model, iaf_psc_alpha, I think.

mlober and others added 6 commits November 24, 2023 16:11
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
mlober and others added 3 commits November 24, 2023 16:12
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
Co-authored-by: jessica-mitchell <mitchell20j@gmail.com>
@jessica-mitchell
Copy link
Contributor

Thanks Jessica. This looks all very good to me. How can we fix the table? I copied the format from some other neuron model, iaf_psc_alpha, I think.

I fixed the table, it was only a misalignment of the second item in the second row

Copy link
Contributor

@jessica-mitchell jessica-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @mlober @tomtetzlaff lgtm!

@jessica-mitchell
Copy link
Contributor

ping @clinssen :)

Copy link
Contributor

@clinssen clinssen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you!

@heplesser
Copy link
Contributor

@tomtetzlaff Could you re-review so we can proceed to merging?

@heplesser heplesser merged commit 508a1d7 into nest:master Dec 11, 2023
24 checks passed
Documentation automation moved this from Review to Done Dec 11, 2023
Models automation moved this from Review to Done Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: Normal Handle this with default priority T: Enhancement New functionality, model or documentation
Projects
Documentation
  
Done
Models
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants