Skip to content

util to convert the masks to bool + ruff bump - #319

Merged
TeunHuijben merged 4 commits into
royerlab:mainfrom
TeunHuijben:mask-bool-conversion-util
Jul 27, 2026
Merged

util to convert the masks to bool + ruff bump#319
TeunHuijben merged 4 commits into
royerlab:mainfrom
TeunHuijben:mask-bool-conversion-util

Conversation

@TeunHuijben

@TeunHuijben TeunHuijben commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

The latest version of tracksdata stores masks as booleans in a GEFF. But previously exported GEFFs are saved as uint64, which causes memory to explode upon loading.

This PR implements a utility that converts the mask elements to booleans, either duplicating the geff or doing so in place.

Sorry for doing the ruff stuff as well in this PR, but GitHub CI takes the latest ruff, so I had to be compliant.

@TeunHuijben TeunHuijben changed the title util to convert the masks from uint64 to bool util to convert the masks to bool + ruff bump Jul 24, 2026
@TeunHuijben
TeunHuijben requested a review from JoOkuma July 24, 2026 21:47

@JoOkuma JoOkuma left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @TeunHuijben , thanks for the PR, I left a few comments to make it a bit more general

Comment thread src/tracksdata/io/_geff_masks.py Outdated
Comment thread src/tracksdata/io/_geff_masks.py Outdated
Comment thread src/tracksdata/io/_test/test_geff_masks.py Outdated
Comment thread src/tracksdata/io/_geff_masks.py Outdated
Comment on lines +129 to +139
def _copy_geff(geff_store: StoreLike, output_path: StoreLike) -> Path:
"""Copy a geff directory to ``output_path`` and return the new path."""
try:
src = Path(os.fspath(geff_store))
dst = Path(os.fspath(output_path))
except TypeError as e:
raise TypeError("output_path is only supported for filesystem-path geff stores.") from e
if dst.exists():
raise FileExistsError(f"output_path already exists: {dst}")
shutil.copytree(src, dst)
return dst

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a zarr copy function that processes the storelike objects?
I'm thinking of the case where it cannot be loaded as a os.fspath

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zarr.copy_store doesn't exist for zarr3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this implementation?

@TeunHuijben
TeunHuijben merged commit 80d94cc into royerlab:main Jul 27, 2026
7 checks passed
@TeunHuijben
TeunHuijben deleted the mask-bool-conversion-util branch July 27, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants