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

Initialize state variables and access buffer information #334

Closed
AliceGem opened this issue Dec 23, 2016 · 7 comments
Closed

Initialize state variables and access buffer information #334

AliceGem opened this issue Dec 23, 2016 · 7 comments

Comments

@AliceGem
Copy link

Dear NESTML community,
I have 2 questions on NESTML use:

  1. Is there any possibility to initialize a state variable to a parameter value so that I can modify the initialization value in NEST for different types of neurons? For example, I have the threshold potential as a state variable and the initialization value is different for different neuron types, but if I define it as a parameter and use it in the state block (e.g.: in the 'state' block: 'V_th mV = V_th_init'; in the 'parameters' block: V_th_init mV = -70.0mV), I receive an error.

  2. Is there any built-in function to check if a buffer is empty? For example, how can I check if the currents' buffer is empty to use it as a condition?

Thanks a lot!

@PTraeder
Copy link
Contributor

Hello,
1: That should be valid. In fact, my tests with this setup do not result in errors. Could you maybe detail the error you encounter or link your model?

2: What do you mean exactly? You should, with the latest versions, be able to check buffers for their value in standard if constructs. Current buffers are effectively typed as pA and spike buffers as real. @DimitriPlotnikov might have more insight into this.

@ingablundell
Copy link
Contributor

@AliceGem Could you elaborate on how and why you use the fact that a current buffer is empty or not as a condition, so that we can make sure this is implemented sensibly in NESTML?

@AliceGem
Copy link
Author

AliceGem commented Jan 4, 2017

@PTraeder Thank you, the problem with the first question is solved, it works now and the error I got was not linked with the initialization.
@PTraeder and @ingablundell thanks for your answer! I'll explain more in detail: I need to add a condition in the update block related to the external current (which is saved in the current buffer right?), so that if there has been an external input in the last simulation steps, I execute different operations. For example:
update: if currents.isEmpty(): # I would need a function here to check the content of the buffer I_shape = 0 else: I_shape *= R end
where currents is the current buffer, I_shape is a state variable, and R a parameter. I want the I_shape variable to be zero if there has not been any external input current for the last 50 simulation steps e.g..
And related to this, the current buffer saves the values of current for a certain interval of simulation steps? Or it is updated at each spike?

@DimitriPlotnikov
Copy link
Contributor

DimitriPlotnikov commented Jan 4, 2017

@AliceGem
I'm a bit confused. I_shape is not a shape (an explicit function which is defined in equations and describes the postsynaptic current), but a state variable which accidentally called shape?

Regarding your actual question:
What you can do know:

if current > 0: # interpret this as if there is incoming events greater then 0
  I_shape = 0
else:
  I_shape *= R
end

@AliceGem
Copy link
Author

AliceGem commented Jan 4, 2017

@DimitriPlotnikov @ingablundell R is a constant defined in the parameters block and I_shape is a spike-triggered current which gets updated at each spike and decays exponentially at each time step. It is called shape because at the beginning I defined it as a shape but I got an error when updating it in the update block (Shapes may only be used as parameters to either 'curr_sum()' or 'cond_sum()'.. Code generation was canceled). So now I defined it as a state variable without changing the name. Then I_shape is provided as an input to the neuron as an external current, not a synaptic one for which we would need the convolution with spikes. I'll try your solution if current > 0: for the incoming current and let you know! Thanks a lot!

@ingablundell
Copy link
Contributor

@AliceGem I still don't quite understand what you are trying to do. Is I_shape supposed to be your synaptic current. Is R some kind of constant or does it have something to do with the current.

What we would normaly do is declare some kind of "shape" function which is time dependent. For instance the "alpha" function and then define synaptic input as the convolution of the shape function with the values in the current buffer. I am not quite sure if your "I_shape" refers to what our shape function is or to what our convolution of the shape function with the values in the current buffer.

@clinssen
Copy link
Contributor

Closing as this will be covered by #588.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants