Skip to content

Commit 5f1ddb1

Browse files
committed
Simplify and remove hashes
1 parent 10f3887 commit 5f1ddb1

File tree

4 files changed

+18
-42
lines changed

4 files changed

+18
-42
lines changed

derotation/sample_data.py

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,18 @@
1010
import pooch
1111

1212
# URL to the remote data repository on GIN
13-
DATA_URL = "https://gin.g-node.org/l.porta/derotation_examples/src/master/"
13+
DATA_URL = "https://gin.g-node.org/l.porta/derotation_examples/raw/master/"
1414

1515
# Save data in ~/.derotation/data
1616
DATA_DIR = Path("~", ".derotation", "data").expanduser()
1717
DATA_DIR.mkdir(parents=True, exist_ok=True)
1818

19-
# File registry with SHA-256 checksums
19+
# File registry without checksums (just for file validation)
2020
REGISTRY = {
21-
"angles_per_line.npy": ( # noqa: E501
22-
"sha256:0a5dab081acdfb47ebd5cdda4094cc622b1ff708c63f6fadc1e7898d30789896"
23-
),
24-
"rotation_sample.tif": ( # noqa: E501
25-
"sha256:ad8aae61cda9495d9006fb37a1f87be8b6dd6477318b1e8a409417cace208f56"
26-
),
27-
"analog_signals.npy": ( # noqa: E501
28-
"sha256:e04437f86d07db8077c256f912e2bcca75794712d66715f301b99cd9a8d66d95"
29-
),
30-
"stimulus_randperm.csv": ( # noqa: E501
31-
"sha256:214617992d786ee210a7d2f22dbe7420997016846a79c673979913a5b77f0a11"
32-
),
21+
"angles_per_line.npy": None,
22+
"rotation_sample.tif": None,
23+
"analog_signals.npy": None,
24+
"stimulus_randperm.csv": None,
3325
}
3426

3527
# Create a download manager
@@ -55,24 +47,8 @@ def fetch_data(filename: str) -> Path:
5547
"""
5648
if filename not in REGISTRY:
5749
raise ValueError(
58-
f"File '{filename}' not found in registry."
50+
f"File '{filename}' not found in registry. "
5951
f"Available files: {list(REGISTRY.keys())}"
6052
)
6153

6254
return Path(SAMPLE_DATA.fetch(filename, progressbar=True))
63-
64-
65-
def get_data_path(filename: str) -> Path:
66-
"""Get the path to a sample data file, downloading it if necessary.
67-
68-
Parameters
69-
----------
70-
filename : str
71-
Name of the file to get.
72-
73-
Returns
74-
-------
75-
Path
76-
Path to the data file.
77-
"""
78-
return fetch_data(filename)

examples/core_function.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@
2626
import tifffile
2727

2828
from derotation.derotate_by_line import derotate_an_image_array_line_by_line
29-
from derotation.sample_data import get_data_path
29+
from derotation.sample_data import fetch_data
3030

3131
# %%
3232
# Load per-line rotation angles
3333

34-
angles_path = get_data_path("angles_per_line.npy")
34+
angles_path = fetch_data("angles_per_line.npy")
3535
print(f"Loading per-line rotation angles from {angles_path}")
3636
angles_per_line = np.load(angles_path) # Shape: (height,)
3737

3838
# %%
3939
# Load the TIFF stack (shape: num_frames × height × width)
4040

41-
tif_path = get_data_path("rotation_sample.tif")
41+
tif_path = fetch_data("rotation_sample.tif")
4242
print(f"Loading image stack from {tif_path}")
4343
image_stack = tifffile.imread(tif_path)
4444

examples/pipeline_with_real_data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
from derotation.analysis.full_derotation_pipeline import FullPipeline
3838
from derotation.config.load_config import load_config, update_config_paths
39-
from derotation.sample_data import get_data_path
39+
from derotation.sample_data import fetch_data
4040

4141
# %%
4242
# Load and update configuration
@@ -47,9 +47,9 @@
4747
config = load_config()
4848
config = update_config_paths(
4949
config=config,
50-
tif_path=str(get_data_path("rotation_sample.tif")),
51-
aux_path=str(get_data_path("analog_signals.npy")),
52-
stim_randperm_path=str(get_data_path("stimulus_randperm.csv")),
50+
tif_path=str(fetch_data("rotation_sample.tif")),
51+
aux_path=str(fetch_data("analog_signals.npy")),
52+
stim_randperm_path=str(fetch_data("stimulus_randperm.csv")),
5353
output_folder=str(current_module_path),
5454
)
5555

examples/use_plotting_hooks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
from derotation.analysis.full_derotation_pipeline import FullPipeline
4040
from derotation.config.load_config import load_config, update_config_paths
41-
from derotation.sample_data import get_data_path
41+
from derotation.sample_data import fetch_data
4242

4343
# %%
4444
# Load and configure paths
@@ -50,9 +50,9 @@
5050
config = load_config()
5151
config = update_config_paths(
5252
config=config,
53-
tif_path=str(get_data_path("rotation_sample.tif")),
54-
aux_path=str(get_data_path("analog_signals.npy")),
55-
stim_randperm_path=str(get_data_path("stimulus_randperm.csv")),
53+
tif_path=str(fetch_data("rotation_sample.tif")),
54+
aux_path=str(fetch_data("analog_signals.npy")),
55+
stim_randperm_path=str(fetch_data("stimulus_randperm.csv")),
5656
output_folder=str(output_folder),
5757
)
5858

0 commit comments

Comments
 (0)