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

Problem injecting one DC_Source into 2 different cells in Brian #648

Closed
AndreiMoise111 opened this issue Jul 11, 2019 · 0 comments · Fixed by #737
Closed

Problem injecting one DC_Source into 2 different cells in Brian #648

AndreiMoise111 opened this issue Jul 11, 2019 · 0 comments · Fixed by #737

Comments

@AndreiMoise111
Copy link
Contributor

AndreiMoise111 commented Jul 11, 2019

Consider the code :

import sys
from pyNN.utility import get_script_args
import pdb
import matplotlib.pyplot as plt
simulator_name = get_script_args(1)[0]
exec("from pyNN.%s import *" % simulator_name)

setup(min_delay=0.1)

cells = Population(2, IF_curr_exp(v_rest = -65.0, v_thresh=-55.0, tau_refrac=5.0, i_offset=-1.0))
dc_source = DCSource(amplitude=0.5, start=25, stop=50)
cells[0].inject(dc_source)
cells[1].inject(dc_source)
cells.record(['v'])
run(100)

plt.subplot(2,1,1)
vm = cells.get_data().segments[0].filter(name="v")[0]
plt.plot(vm.times, vm[:, 0], 'r')
plt.xlabel("time (ms)")
plt.ylabel("Vm (mV)")

plt.subplot(2,1,2)
plt.plot(vm.times, vm[:, 1], 'r')
plt.xlabel("time (ms)")
plt.ylabel("Vm (mV)")
    
plt.show(block=True) 
end()

When I try to inject the same dc_source into cells[0] and cells[1]
I get and error :

/PyNN/pyNN/brian/standardmodels/electrodes.py", line 109, in _update_current
cell.parent.brian_group.i_inj[idx] += self.amplitudes[self.i] - self.prev_amp_dict[idx] #* ampere
KeyError: 0

However if I create another dc_source and inject it in cells[1], it works just fine.
This code works with neuron.

@AndreiMoise111 AndreiMoise111 changed the title Problem injecting one DC_Source into 2 different cells Problem injecting one DC_Source into 2 different cells in Brian Jul 11, 2019
@apdavison apdavison added this to the future milestone Nov 14, 2019
@apdavison apdavison modified the milestones: future, 0.10.0 Nov 9, 2021
apdavison added a commit to apdavison/PyNN that referenced this issue Nov 9, 2021
@apdavison apdavison linked a pull request Nov 9, 2021 that will close this issue
apdavison added a commit that referenced this issue Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants