Skip to content
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

get_extent switches x and y #335

Closed
Sonja-Stockhaus opened this issue Aug 9, 2023 · 1 comment · Fixed by #318
Closed

get_extent switches x and y #335

Sonja-Stockhaus opened this issue Aug 9, 2023 · 1 comment · Fixed by #318
Labels
bug 🚨 Something isn't working

Comments

@Sonja-Stockhaus
Copy link
Collaborator

Sonja-Stockhaus commented Aug 9, 2023

Hey @timtreis , @LucaMarconato ,

So in the branch feature/get_extent there is the new get_extent function which should be outsourced from spatialdata-plot.
I just compared it to the _get_extent function from spatialdata-plot and it looks like both compute the same numbers but the spatialdata output has the x and y coordinates switched which seems to be a bug. I added code to hopefully reproduce the issue.

Would be cool if you could have a look at it :)

import spatialdata as sd
import spatialdata_plot

# This example doesn't really work with blobs (bc it has identical x and y extents), so I used the example data from https://s3.embl.de/spatialdata/spatialdata-sandbox/visium_associated_xenium_io.zip
visium_sdata = sd.read_zarr("visium_associated_xenium_io.zarr")

print("Old function (from spatialdata-plot):")
print(spatialdata_plot.pl.utils._get_extent(visium_sdata))
# output format is [xmin, xmax, ymin, ymax], so for "global" I get xmax = 19505

image

print("New function (from spatialdata):")
print(sd._core.data_extent.get_extent(visium_sdata, coordinate_system="global"))
# This would imply ymax = 19505

image

print("Ground truth:")
print(visium_sdata.images)
# (c: 3, y: 21571, x: 19505) would mean the spatialdata output is incorrect because x and y are swapped

image

@timtreis timtreis added the bug 🚨 Something isn't working label Aug 9, 2023
@LucaMarconato
Copy link
Member

Great catch Sonja, thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🚨 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants