-
Notifications
You must be signed in to change notification settings - Fork 130
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
Issue with current injection via ACSource in Brian #442
Comments
The problems here are similar to those described in issue #437. The solution for ensuring that current injection stops at t_stop is same as that discussed there. Brian requires time to be specified with units of seconds. Most of the required conversion is done, except for simulator.state.dt which is still specified in ms, and the frequency which is converted to 1/ms. To fix this, we need to update the following: i) method _generate() in line https://github.com/NeuralEnsemble/PyNN/blob/master/pyNN/brian/standardmodels/electrodes.py#L114 self.times = numpy.arange(self.start, self.stop, simulator.state.dt) to: self.times = numpy.arange(self.start, self.stop, simulator.state.dt * 1e-3) ii) method _compute() in line https://github.com/NeuralEnsemble/PyNN/blob/master/pyNN/brian/standardmodels/electrodes.py#L117 return self.amplitude * numpy.sin(time * 2 * numpy.pi * self.frequency / 1000. + 2 * numpy.pi * self.phase / 360) to: return self.amplitude * numpy.sin(time * 2 * numpy.pi * self.frequency + 2 * numpy.pi * self.phase / 360) Brian output with above fixes: |
If the alternative fix for problem 1 in issue #437 is adopted, then the method '_generate' in line https://github.com/NeuralEnsemble/PyNN/blob/master/pyNN/brian/standardmodels/electrodes.py#L114 should be changed from: def _generate(self):
self.times = numpy.arange(self.start, self.stop, simulator.state.dt) to def _generate(self):
self.times = numpy.arange(self.start, self.stop, simulator.state.dt * 1e-3)
self.times = numpy.append(self.times, self.stop) Note: Issue #445 would need to be fixed for this to work properly. |
Found two more issues with current injection via AC source, as seen in the below outputs: The issues are:
Combined fix for all of the aboveMethods _generate() and _compute() for the class ACSource in file https://github.com/NeuralEnsemble/PyNN/blob/master/pyNN/brian/standardmodels/electrodes.py def _generate(self):
self.times = numpy.arange(self.start, self.stop + simulator.state.dt * 1e-3, simulator.state.dt * 1e-3)
def _compute(self, time):
return self.offset + self.amplitude * numpy.sin((time-self.start) * 2 * numpy.pi * self.frequency + 2 * numpy.pi * self.phase / 360) |
Fixed in #467 |
There is a problem with the output of current injection via ACSource in Brian. The current profile is incorrect (as can be inferred from the voltage trace in below figure), and also the current injection fails to cease at t_stop.
The figure below illustrates this (for this source code):
Brian Output:

NEURON Output:

The text was updated successfully, but these errors were encountered: