-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Weird behavior with pint.Quantity + masked array #8908
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
Comments
It's possible the problem lies outside matplotlib, but need to track down what matplotlib is doing exactly to evoke this behavior. |
So the behavior in the leftmost panel is just reflecting the behavior of: >>> np.asarray(data_masked_units)
array([ 9.01813386e-02, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 7.39062957e-01, 1.00000000e+00,
1.00000000e+00, 2.99023902e-01, 7.01311229e-04,
1.05263214e+00, 1.88309697e+00, 1.75411405e-01,
1.12874122e+00, 3.08208814e-01, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 7.67253492e-01,
1.43523599e-01, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.86541911e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.08489593e+00, 1.00000000e+00]) The reason this line runs is because there's an matplotlib/lib/matplotlib/lines.py Lines 648 to 655 in 5fd199c
So, how would we feel about replacing the |
The more I stare at that, I wonder at the wisdom of using |
Refactor many places that check for masked arrays, and fill the masked values with nans, with a helper to accomplish that. In the helper, replace the isinstance check with a attribute check for 'mask'. This allows libraries, like pint, that wrap mask arrays to pass the check and be converted appropriately. Also fix one spot using atleast_1d with _check_1d.
Refactor many places that check for masked arrays, and fill the masked values with nans, with a helper to accomplish that. In the helper, replace the isinstance check with a attribute check for 'mask'. This allows libraries, like pint, that wrap mask arrays to pass the check and be converted appropriately. Also fix one spot using atleast_1d with _check_1d.
BUG: Fix weird behavior with mask and units (Fixes #8908)
From my SciPy 2017 talk, the combination of pint.Quantity for unit support with masked arrays produces problems not seen with either individually:
produces:
The text was updated successfully, but these errors were encountered: