-
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 DCSource in Brian when value changing values on the fly #451
Comments
This can be rectified by incorporating the below mentioned changes in https://github.com/NeuralEnsemble/PyNN/blob/master/pyNN/brian/standardmodels/electrodes.py.
def _reset(self):
self.i = 0
self.running = True
if self._is_computed:
self._generate() to def _reset(self):
if not hasattr(self, 'running') or self.running == False:
self.i = 0
self.running = True
if self._is_computed:
self._generate()
def _generate(self):
if self.start == 0:
self.times = [self.start, self.stop]
self.amplitudes = [self.amplitude, 0.0]
else:
self.times = [0.0, self.start, self.stop]
self.amplitudes = [0.0, self.amplitude, 0.0] to def _generate(self):
if self.start == 0:
self.times = [self.start, self.stop]
self.amplitudes = [self.amplitude, 0.0]
else:
self.times = [0.0, self.start, self.stop]
self.amplitudes = [0.0, self.amplitude, 0.0]
if self.start < simulator.state.t*1e-3 < self.stop:
self.times.insert(-1, simulator.state.t*1e-3)
self.amplitudes.insert(-1, self.amplitude)
if (self.start==0 and self.i==2) or (self.start!=0 and self.i==3):
self.i -= 1 These changes were tested against various start/stop combos for the DCSource described in this file. The earlier test file was not used owing to problems arising from issue #452 . Just for the record, the Brian output after this fix (in context to figures in the initial post): |
@appukuttan-shailesh thanks for investigating this. Can you create a pull request with these changes (and a test), please? |
Fixed in #467 |
The code here attempts to change the values of the DCSource on the fly. The amplitude is 0 for the first 100 ms, and thereafter changed for t > 100 ms. But as the start and stop times are specified less than 100 ms, there should be no effect on the membrane potential. As seen below the output in Brian shows an erroneous value at the transition.
Brian output (incorrect):


NEURON output (correct):
The text was updated successfully, but these errors were encountered: