Fix bwm notebook: brainglobe atlas download (correct GIN version, validate tarball) - #177
Open
bendichter wants to merge 1 commit into
Open
Fix bwm notebook: brainglobe atlas download (correct GIN version, validate tarball)#177bendichter wants to merge 1 commit into
bendichter wants to merge 1 commit into
Conversation
…-atlasapi 2.3.1 The previous workaround pre-seeded brainglobe's version cache from the new S3 catalog, which lists allen_mouse_25um = 3.0. brainglobe-atlasapi 2.3.1 (the latest release) downloads atlases from GIN, where this atlas is v1.2, so it requested a nonexistent allen_mouse_25um_v3.0.tar.gz and saved GIN's HTML error page as the archive -> 'ReadError: not a gzip file'. Seed GIN's version (1.2), overwrite any stale cache, and download + validate the tarball ourselves (gzip magic-byte check) before unpacking into ~/.brainglobe, so BrainGlobeAtlas() loads locally and a 403/404 page can never masquerade as a corrupt atlas. Verified end-to-end against brainglobe-atlasapi 2.3.1 with a clean cache. Fixes #176 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Contributor
Index page previewA preview of the generated Last updated: commit |
Member
|
PR lengthy description talks (only?!) about some version seeding etc but diff seems just unicode character replacements -- do not correspond to each other or relevant change is too burried??? |
Member
Author
|
I'm working on fixing this at the source. I think the issue is that the Colab IP is blocked by the archive storage source |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
bwm_usage_notebook.ipynbfails on Colab at theBrainGlobeAtlas("allen_mouse_25um")cell with:(reported in #176).
Root cause
brainglobe-atlasapi==2.3.1— the latest release, and what the notebook pins — downloads atlases from GIN (gin.g-node.org/brainglobe/atlases), whereallen_mouse_25umis version 1.2. brainglobe has since stood up a separate S3 catalog (OME-Zarr,atlas-rc2/) with renumbered versions where the same atlas is 3.0; no released atlasapi uses that bucket yet.The previous workaround (added in #160) pre-seeded brainglobe's version cache from the S3 catalog, so on Colab — where atlasapi's live GIN manifest fetch gets a 403 and falls back to that cache — atlasapi read version
3.0and requestedallen_mouse_25um_v3.0.tar.gzfrom GIN, where it doesn't exist. GIN returned an HTML 404/403 page, and atlasapi's downloader (which never checks the HTTP status) saved it as the "tarball" →not a gzip file.So updating the package can't help — 2.3.1 is already newest and is GIN-based. The bug is the version the workaround injected.
Fix
Rewrite the workaround in the affected cell to:
1.2), not the S3 catalog's3.0, and overwrite any stale cache (the old code skipped writing if a file already existed, leaving a wrong3.0across re-runs).~/.brainglobe, so a 403/404 HTML page can never masquerade as a corrupt atlas.BrainGlobeAtlas()then loads the already-unpacked atlas locally and never hits its (status-blind) downloader.If a Colab IP is ever fully blocked by GIN (not just the manifest endpoint), the cell now fails with an explicit message instead of the cryptic
ReadError.Verification
End-to-end against
brainglobe-atlasapi==2.3.1with a clean~/.brainglobe:atlas.resolutionandatlas.reference(the only attributes the figure cell uses) load correctly. Only cell 34's workaround changed; the notebook still validates as nbformat v4.Fixes #176
🤖 Generated with Claude Code