-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Fix and improvements to ImageStack #5961
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5961 +/- ##
==========================================
- Coverage 88.58% 88.55% -0.03%
==========================================
Files 315 315
Lines 65500 65545 +45
==========================================
+ Hits 58020 58046 +26
- Misses 7480 7499 +19
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Added conversion of different inputs: import holoviews as hv
import numpy as np
hv.extension("bokeh")
np.random.seed(42)
data = np.random.random((10, 15, 3))
p0 = hv.ImageStack(data)
p1 = hv.ImageStack([data[:, :, i] for i in range(3)])
p2 = hv.ImageStack({str(i): data[:, :, i] for i in range(3)})
p0 + p1 + p2 |
I'm not sure about the transposing, needs to think more about it. With the following code: import xarray as xr
import holoviews as hv
import numpy as np
hv.extension("bokeh")
x = np.arange(0, 3)
y = np.arange(5, 8)
a = np.array([[np.nan, np.nan, 1], [np.nan] * 3, [np.nan] * 3])
b = np.array([[np.nan] * 3, [1, 1, np.nan], [np.nan] * 3])
c = np.array([[np.nan] * 3, [np.nan] * 3, [1, 1, 1]])
ds = (x, y, a, b, c)
im_tuple = hv.ImageStack(ds).opts(title="Tuple")
ds = {"x": x, "y": y, "a": a, "b": b, "c": c}
im_dict = hv.ImageStack(ds).opts(title="Dict")
ds = xr.Dataset(
{"a": (["x", "y"], a), "b": (["x", "y"], b), "c": (["x", "y"], c)},
coords={"x": x, "y": y},
)
im_xr = hv.ImageStack(ds).opts(title="xarray")
im_tuple + im_dict + im_xr |
This work on the current branch but not on main: import xarray as xr
import holoviews as hv
import numpy as np
hv.extension("bokeh")
x = np.arange(0, 3)
y = np.arange(5, 9)
a = np.array([[np.nan, np.nan, 1, np.nan], [np.nan] * 4, [np.nan] * 4])
b = np.array([[np.nan] * 4, [1, 1, np.nan, np.nan], [np.nan] * 4])
c = np.array([[np.nan] * 4, [np.nan] * 4, [1, 1, 1, np.nan]])
ds = {"x": x, "y": y, "a": a, "b": b, "c": c}
im_dict = hv.ImageStack(ds).opts(title="Dict")
ds = xr.Dataset(
{"a": (["x", "y"], a), "b": (["x", "y"], b), "c": (["x", "y"], c)},
coords={"x": x, "y": y},
)
im_xr = hv.ImageStack(ds).opts(title="xarray")
im_dict + im_xr |
279527d
to
f802149
Compare
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes #5959 and fixes #5960
TODO:
Think about the transpose problemThe main problem is that a 2D Numpy array shape is defined as (y, x), not (x, y)hv.ImageStack