Skip to content
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

Handle .ndim and [:, np.newaxis] on VariableView #1412

Merged
merged 1 commit into from
May 18, 2022

Conversation

mstimberg
Copy link
Member

These are used when handing a VariableView directly to matplotlib, e.g. for spike_mon.i (an expression like spike_mon.t/ms directly results in an ndarray and is therefore not concerned). This problem was introduced with matplotlib 3.5.2, previous versions converted VariableView along the way with a call to np.asanyarray.

The fix is a minimal workaround, but we have plenty of examples, including the tutorials, that will fail plotting, so fixing this is urgent. For a proper fix I'd like to think a bit more about how (and whether) to support features like adding array dimensions, in particular for synaptic variables which support a form of 2d-indexing which is not the same as for a 2d ndarray.

Fixes #1409

These are used when handing a VariableView directly to matplotlib, e.g.
for spike_mon.i (an expression like spike_mon.t/ms directly results in
an ndarray and is therefore not concerned). This problem was introduced
with matplotlib 3.5.2, previous versions converted VariableView along
the way with a call to np.asanyarray.

Fixes #1409
@mstimberg
Copy link
Member Author

I am going ahead merging this, even though it is a bit of an ugly workaround, but I keep running into this issue when running Brian's development version. I opened #1422 to keep track of this issue.

@mstimberg mstimberg merged commit 45e3190 into master May 18, 2022
@mstimberg mstimberg deleted the fix_variables_matplotlib branch May 18, 2022 07:39
@schmitts
Copy link
Contributor

Can we have a patch release that includes the fix?

@mstimberg
Copy link
Member Author

I'm out of office until end of May, so I can't do it before then. Note that you can install the development package from TestPyPi though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] error while plotting spikes with SpikeMonitor
2 participants