You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Weird behavior with pint.Quantity + masked array #8908
So, how would we feel about replacing the isinstance(self._xorig, np.ma.MaskedArray) with something more duck-type-y, like hasattr(self._xorig, 'mask')? Other suggestions?
The more I stare at that, I wonder at the wisdom of using np.ma.asarray(xconv, float).filled(np.nan) rather than xconv.astype(float).filled(np.nan), since implicitly xconv has to already be some kind of masked array, since that's where the mask to be filled comes from. If we use the latter form, we could replace isinstance with a try...except AttributeError block.
Activity
dopplershift commentedon Jul 18, 2017
It's possible the problem lies outside matplotlib, but need to track down what matplotlib is doing exactly to evoke this behavior.
dopplershift commentedon Aug 17, 2017
So the behavior in the leftmost panel is just reflecting the behavior of:
The reason this line runs is because there's an
isintancecheck, which fails with aQuantitythat holds a masked array, here:matplotlib/lib/matplotlib/lines.py
Lines 648 to 655 in 5fd199c
So, how would we feel about replacing the
isinstance(self._xorig, np.ma.MaskedArray)with something more duck-type-y, likehasattr(self._xorig, 'mask')? Other suggestions?dopplershift commentedon Aug 17, 2017
The more I stare at that, I wonder at the wisdom of using
np.ma.asarray(xconv, float).filled(np.nan)rather thanxconv.astype(float).filled(np.nan), since implicitlyxconvhas to already be some kind of masked array, since that's where the mask to befilledcomes from. If we use the latter form, we could replaceisinstancewith atry...except AttributeErrorblock.BUG: Fix weird behavior with mask and units (Fixes matplotlib#8908)
BUG: Fix weird behavior with mask and units (Fixes matplotlib#8908)
BUG: Fix weird behavior with mask and units (Fixes matplotlib#8908)
Merge pull request #9049 from dopplershift/fix-8908