Replies: 1 comment
-
Thanks for reporting this issue! It turned out there were several bugs in the function for plotting vector fields. I fixed these in the latest version on the master branch and these fixes will be included in the next release of |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am following the tutorial and I get the following error. I am using python 3.7.
For scalar fields, I do not have any issues.
IndexError Traceback (most recent call last)
in
1 grid_per = pde.CartesianGrid([[0, 4np.pi], [0, 2np.pi]], [128, 32], periodic=True)
2 vector_field = pde.VectorField.from_expression(grid_per, ['1', 'cos(x)'])
----> 3 vector_field.plot();
/usr/local/lib/python3.7/dist-packages/pde/tools/plotting.py in wrapper(title, filename, action, ax_style, fig_style, ax, *args, **kwargs)
285
286 # call the actual plotting function
--> 287 reference = wrapped(*args, ax=ax, **kwargs)
288
289 # finishing touches...
/usr/local/lib/python3.7/dist-packages/pde/fields/base.py in plot(self, kind, **kwargs)
1862 reference = self._plot_line(**kwargs)
1863 elif kind == "vector":
-> 1864 reference = self._plot_vector(**kwargs)
1865 else:
1866 raise ValueError(
/usr/local/lib/python3.7/dist-packages/pde/fields/base.py in _plot_vector(self, ax, method, transpose, max_points, **kwargs)
1740 # do the plotting using the chosen method
1741 if method == "quiver":
-> 1742 data = self.get_vector_data(transpose=transpose, max_points=max_points)
1743 element = ax.quiver(
1744 data["x"], data["y"], data["data_x"].T, data["data_y"].T, **kwargs
/usr/local/lib/python3.7/dist-packages/pde/fields/vectorial.py in get_vector_data(self, transpose, max_points, **kwargs)
638 data["data_y"] = np.take(data["data_y"], idx_i, axis=axis)
639 if axis == 0:
--> 640 data["y"] = data["y"][idx_i]
641 elif axis == 1:
642 data["x"] = data["x"][idx_i]
IndexError: index 34 is out of bounds for axis 0 with size 32
Beta Was this translation helpful? Give feedback.
All reactions