astropy: RTD failure due to plots involving convolution Kernels
Description
There are RTD failures due to a missing ndim
in latest PRs, see:
- https://readthedocs.org/projects/astropy/builds/16812769/
- https://readthedocs.org/projects/astropy/builds/16812180/
I believe this may have to do with the latest version of matplotlib
(https://github.com/matplotlib/matplotlib/releases/tag/v3.5.2) interacting poorly with how plots for Box1DKernel
, Gaussian1DKernel
, RickerWavelet1DKernel
, and Trapezoid1DKernel
are coded.
Note that a simple attempt at fixing this was tried in #13205; however, I think the fix will be more involved than this.
This is related to matplotlib/matplotlib#22973
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (15 by maintainers)
This has now been fixed by matplotlib/matplotlib#22975 so the next release of matplotlib should contain the needed fix.
@mhvk you are exactly correct. See https://github.com/matplotlib/matplotlib/issues/22973#issuecomment-1117845296 where I just posted a better minimal reproducer. My above comment was me doing a first quick attempt.
@WilliamJamieson - the difference from your minimal example and the real problem is, I think, that
Kernel
has a.shape
defined and matplotlib sees this and treats the object as “sufficiently array-like”; without the shape, the object gets coerced tondarray
, and that works because of the__array__
method.I think this is due to https://github.com/matplotlib/matplotlib/pull/22141 (before that
_check_1d
was converting the input to a Numpy array withnp.atleast_1d(x)
). Probably worth a bug report.https://github.com/astropy/astropy/blob/5ddd6a39a1228da7599e75a71f402b08588dbd67/astropy/convolution/kernels.py#L75-L78
and the similar portions of each of the other kernels.
The
__array__
magic is only a concern if it points at some sort of broken API on our end.