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
Currently, when upsampling images with interpolation_stage="data", upsampled pixels are set to nan ifany of the underlying data points is nan. This leads to much wider "nan-propagation" than interpolation_stage="rgba".
Note how the blank area is much wider in the bilinear, data-stage interpolation case.
Expected outcome
Although I'm not sure the choice is objective, I think a blurred boundary (similarly to the bottom right case) would make sense.
Implementation-wise, I suspect this arises from a similar issue as #29711 (comment): it should indeed be possible to interpolate in data space even with nans if we interpret the data array as a single-channel image with an additional alpha channel (0-1, depending on whether the data is nan) and correctly weighting the data by the alpha channel (similarly to the premultiplied alpha filtering suggested in the comment). Without setting a zero weight on the nans, it becomes of course impossible to upsample pixels for which any underlying data points are nan (so setting the upsampled pixel to nan is the only reasonable choice).
Additional information
No response
Operating system
No response
Matplotlib Version
3.11.0.dev525+g9f7b3dd205
Matplotlib Backend
No response
Python version
3.13
Jupyter version
No response
Installation
git checkout
The text was updated successfully, but these errors were encountered:
To be checked: Under which circumstances does this happen when the user does not or little customization through kwargs? It's critical if this happens without the user being aware, because we're misrepresenting the data - looks like there's no information in these pixels.
Bug summary
Currently, when upsampling images with interpolation_stage="data", upsampled pixels are set to nan ifany of the underlying data points is nan. This leads to much wider "nan-propagation" than interpolation_stage="rgba".
Code for reproduction
Actual outcome
Note how the blank area is much wider in the bilinear, data-stage interpolation case.
Expected outcome
Although I'm not sure the choice is objective, I think a blurred boundary (similarly to the bottom right case) would make sense.
Implementation-wise, I suspect this arises from a similar issue as #29711 (comment): it should indeed be possible to interpolate in data space even with nans if we interpret the data array as a single-channel image with an additional alpha channel (0-1, depending on whether the data is nan) and correctly weighting the data by the alpha channel (similarly to the premultiplied alpha filtering suggested in the comment). Without setting a zero weight on the nans, it becomes of course impossible to upsample pixels for which any underlying data points are nan (so setting the upsampled pixel to nan is the only reasonable choice).
Additional information
No response
Operating system
No response
Matplotlib Version
3.11.0.dev525+g9f7b3dd205
Matplotlib Backend
No response
Python version
3.13
Jupyter version
No response
Installation
git checkout
The text was updated successfully, but these errors were encountered: