Skip to content

Commit

Permalink
Made Synapses check sources are SpikeSource rather than check for
Browse files Browse the repository at this point in the history
.spikes attribute
  • Loading branch information
thesamovar committed Sep 24, 2013
1 parent 8a81ce8 commit 00cc1d4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions brian2/synapses/synapses.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from brian2.utils.logger import get_logger
from brian2.utils.stringtools import get_identifiers
from brian2.core.namespace import get_local_namespace
from brian2.core.spikesource import SpikeSource

from .spikequeue import SpikeQueue

Expand Down Expand Up @@ -805,12 +806,12 @@ def _add_updater(self, code, prepost, objname=None):
if prepost == 'pre':
spike_group, group_name = self.source, 'Source'
elif prepost == 'post':
spike_group = self.target, 'Target'
spike_group, group_name = self.target, 'Target'
else:
raise ValueError(('"prepost" argument has to be "pre" or "post", '
'is "%s".') % prepost)

if not hasattr(spike_group, 'spikes') and hasattr(spike_group, 'clock'):
if not isinstance(spike_group, SpikeSource) or not hasattr(spike_group, 'clock'):
raise TypeError(('%s has to be a SpikeSource with spikes and'
' clock attribute. Is type %r instead')
% (group_name, type(spike_group)))
Expand Down

0 comments on commit 00cc1d4

Please sign in to comment.