plotting with SpikeTrainList
Christian-B opened this issue · comments
In previous neo versions
segment.spiketrains was a list of Spiketrain objects
Now
segment.spiketrains is a SpikeTrainsList
The SpikeTrainsList implements the list functions so all should work the same
The one exception is in plotting.
https://github.com/NeuralEnsemble/PyNN/blob/master/pyNN/utility/plotting.py
The panel init
Line 239 in 435aded
has an args/star variable *data so is passed in a tuple
Therefor the line
self.data = list(data)
results in self.data being a list of SpikeTrainsList objects and not as expected a list of SpikeTrain Objects
The Plot method can not handle Objects of type SpikeTrainList
An ugly but working fix is to replace in Panel.init
self.data = list(data[0])
with
if len(data) == 0 and isinstance(data[0], SpikeTrainList):
self.data = list(data[0])
else:
self.data = list(data)
(needs an import of SpikeTrainList of course)
A much UGLIER and I hope temporary hack we have had to do is
segment = neo.Segment(...
segment.spiketrains = []
if anyone know of a better fix either permanent or even temporary I am open to better suggestions.
Correction:
A much better fix in Plotting is to replace the line
Line 257 in 435aded
elif isinstance(datum, list) and len(datum) > 0 and isinstance(datum[0], SpikeTrain):
with
elif isinstance(datum, SpikeTrainList) and len(datum) > 0 and isinstance(datum[0], SpikeTrain):
again with
from neo.core.spiketrainlist import SpikeTrainList