brian-team / brian2genn

Brian 2 frontend to the GeNN simulator
http://brian2genn.readthedocs.io/
GNU General Public License v2.0
46 stars 16 forks source link

[MRG] Apply Brian2's latest changes related to division/mod and timestep #70

Closed mstimberg closed 6 years ago

mstimberg commented 6 years ago

To be consistent with Brian2's semantics for division etc. (and to not fail the new tests), we have to apply the same changes for _brian_mod, _brian_floordiv and _timestep.

mstimberg commented 6 years ago

I also sneaked in an additional change to this branch: as @denisalevi predicted in https://github.com/brian-team/brian2genn/issues/64#issuecomment-417723712 , the removal of the lastupdate variable made certain models in Brian2GeNN not work anymore. The reason is that the previous code initialized GeNN's sparse data structure together with the conversion of the first synaptic variable. This wasn't a problem as long as lastupdate existed, because it meant that every synapse had at least one synaptic variable. Now, simple models of the Synapses(source, target, '', on_pre='v+=1') do not have any synaptic variables anymore and therefore the conversion was never called. My commit fixes this by separating the initialization and the synapse conversion.

tnowotny commented 6 years ago

Sounds very reasonable - thank you.

mstimberg commented 6 years ago

Thanks for the feedback, I'll merge this right away to avoid the hour-long wait for the tests to run through. There are still other changes in the pipeline...