Giter Site home page Giter Site logo

Comments (5)

thesamovar avatar thesamovar commented on May 22, 2024

This is a bit weird - shouldn't is_active be allocated once and then assigned to by is_active[:] = ...?

from brian2.

mstimberg avatar mstimberg commented on May 22, 2024

This is a bit weird - shouldn't is_active be allocated once and then assigned to by is_active[:] = ...?

I guess this is a consequence of my previous optimisation... The is_active calculation is now contained in the abstract code of the state update, so the state updater abstract code looks something like:

is_active = (t >= refractory_until)
_x = is_active*dt*(-x/tau) + x
x = _x
_array_x[:] = x
_array_is_active[:] = is_active

from brian2.

thesamovar avatar thesamovar commented on May 22, 2024

Ah yes, I see. OK, so that's unavoidable indeed. Well fixed in that case! ;)

from brian2.

mstimberg avatar mstimberg commented on May 22, 2024

I'll reopen this issue since I ran into it again... For variables like not_refractory we can mostly work around this problem, but we need a general solution. An example use case that currently fails (in Python): The user defines a boolean parameter channel_active in the model and uses this as part of the equations. During the equation rewriting done by sympy for the state update step, the expression -channel_active might appear which will not work as expected. I think we need to fix this in the numpy language by always loading boolean variables as 1 * variable.

from brian2.

mstimberg avatar mstimberg commented on May 22, 2024

I've dealt with this by explicitly introducing an int_ function (it was easier not calling it int, we can change this later if we want to) that should be used whenever a boolean variable or expression has to be interpreted in a 0/1 sense (i.e. in particular in model equations). The refractory variable is used in the correct way now.

from brian2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.