Skip to content

Commit

Permalink
load data from pooch explicitly by path
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltyson committed May 16, 2024
1 parent e370bd2 commit c31da8a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
20 changes: 9 additions & 11 deletions examples/user_volumetric_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,21 @@

print(f"[{orange}]Running example: {Path(__file__).name}")

download_path = Path.home() / ".brainglobe" / "brainrender" / "example-data"
filename = "T_AVG_s356tTg.tif"
scene = Scene(atlas_name="mpin_zfish_1um")

retrieved_paths = pooch.retrieve(
# for some reason the list of returned by pooch does not seem to be
# in the same order every time
_ = pooch.retrieve(
url="https://api.mapzebrain.org/media/Lines/brn3cGFP/average_data/T_AVG_s356tTg.zip",
known_hash="54b59146ba08b4d7eea64456bcd67741db4b5395235290044545263f61453a61",
path=Path.home()
/ ".brainglobe"
/ "brainrender"
/ "example-data", # zip will be downloaded here
path=download_path,
progressbar=True,
processor=pooch.Unzip(
extract_dir=""
# path to unzipped dir,
# *relative* to the path set in 'path'
),
processor=pooch.Unzip(extract_dir="."),
)

datafile = Path(retrieved_paths[0]) # [0] is zip file
datafile = download_path / filename


# 1. load the data
Expand Down
22 changes: 11 additions & 11 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,23 +302,23 @@ def test_slice(scene):


def test_user_volumetric_data():
download_path = (
Path.home() / ".brainglobe" / "brainrender" / "example-data"
)
filename = "T_AVG_s356tTg.tif"
scene = Scene(atlas_name="mpin_zfish_1um")
retrieved_paths = pooch.retrieve(

# for some reason the list of returned by pooch does not seem to be
# in the same order every time
_ = pooch.retrieve(
url="https://api.mapzebrain.org/media/Lines/brn3cGFP/average_data/T_AVG_s356tTg.zip",
known_hash="54b59146ba08b4d7eea64456bcd67741db4b5395235290044545263f61453a61",
path=Path.home()
/ ".brainglobe"
/ "brainrender"
/ "example-data", # zip will be downloaded here
path=download_path,
progressbar=True,
processor=pooch.Unzip(
extract_dir=""
# path to unzipped dir,
# *relative* to the path set in 'path'
),
processor=pooch.Unzip(extract_dir="."),
)

datafile = Path(retrieved_paths[0])
datafile = download_path / filename
data = load_any(datafile)
source_space = AnatomicalSpace("ira")
target_space = scene.atlas.space
Expand Down

0 comments on commit c31da8a

Please sign in to comment.