Commit 3f328cf
committed
An exception is raised when calling pyplot.plot(sig.times, sig) if the signal has array annotations. This fixes that.
The traceback was:
```
File "/Users/andrew/dev/simulation/PyNN/pyNN/utility/plotting.py", line 89, in plot_signals
ax.plot(signal.times.rescale(ms), signal, label=label, **options)
File "/Users/andrew/.conda/envs/simulation/lib/python3.9/site-packages/matplotlib/axes/_axes.py", line 1743, in plot
lines = [*self._get_lines(*args, data=data, **kwargs)]
File "/Users/andrew/.conda/envs/simulation/lib/python3.9/site-packages/matplotlib/axes/_base.py", line 273, in __call__
yield from self._plot_args(this, kwargs)
File "/Users/andrew/.conda/envs/simulation/lib/python3.9/site-packages/matplotlib/axes/_base.py", line 389, in _plot_args
y = _check_1d(tup[-1])
File "/Users/andrew/.conda/envs/simulation/lib/python3.9/site-packages/matplotlib/cbook/__init__.py", line 1318, in _check_1d
ndim = x[:, None].ndim
File "/Users/andrew/dev/analysis/neo/neo/core/analogsignal.py", line 270, in __getitem__
obj.array_annotate(**deepcopy(self.array_annotations_at_index(k)))
File "/Users/andrew/dev/analysis/neo/neo/core/dataobject.py", line 188, in array_annotate
self.array_annotations.update(array_annotations)
File "/Users/andrew/dev/analysis/neo/neo/core/dataobject.py", line 400, in update
self[key] = other[key]
File "/Users/andrew/dev/analysis/neo/neo/core/dataobject.py", line 389, in __setitem__
value = self.check_function({key: value}, self.length)[key]
File "/Users/andrew/dev/analysis/neo/neo/core/dataobject.py", line 39, in _normalize_array_annotations
value[key] = _normalize_array_annotations(value[key], length)
File "/Users/andrew/dev/analysis/neo/neo/core/dataobject.py", line 98, in _normalize_array_annotations
_check_single_elem(value[0])
File "/Users/andrew/dev/analysis/neo/neo/core/dataobject.py", line 81, in _check_single_elem
raise ValueError("Array annotations should only be 1-dimensional")
ValueError: Array annotations should only be 1-dimensional
```1 parent 61b6545 commit 3f328cf
2 files changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
| 268 | + | |
| 269 | + | |
269 | 270 | | |
270 | 271 | | |
271 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
639 | 639 | | |
640 | 640 | | |
641 | 641 | | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
642 | 646 | | |
643 | 647 | | |
644 | 648 | | |
| |||
0 commit comments