Skip to content

Commit f70e5f2

Browse files
authored
Merge branch 'main' into add-figure-script
2 parents 037e394 + 27ff4c0 commit f70e5f2

File tree

3 files changed

+24
-58
lines changed

3 files changed

+24
-58
lines changed

src/nwb_benchmarks/benchmarks/params_remote_download.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
name="OphysTestCase",
1616
https_url=get_https_url(
1717
dandiset_id="000717",
18-
dandi_path="sub-R6_ses-20200206T210000_behavior+ophys/sub-R6_ses-20200206T210000_behavior+ophys.nwb",
18+
dandi_path="sub-R6/sub-R6_behavior+ophys.nwb",
1919
follow_redirects=False,
2020
),
2121
),
@@ -69,7 +69,7 @@
6969
name="OphysTestCase",
7070
https_url=get_https_url(
7171
dandiset_id="213889",
72-
dandi_path="sub-R6_ses-20200206T210000_behavior+ophys/sub-R6_ses-20200206T210000_behavior+ophys.lindi.json",
72+
dandi_path="sub-R6/sub-R6_behavior+ophys.nwb.lindi.json",
7373
follow_redirects=False,
7474
),
7575
),

src/nwb_benchmarks/benchmarks/params_remote_file_reading.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
name="OphysTestCase",
1313
https_url=get_https_url(
1414
dandiset_id="000717",
15-
dandi_path="sub-R6_ses-20200206T210000_behavior+ophys/sub-R6_ses-20200206T210000_behavior+ophys.nwb",
15+
dandi_path="sub-R6/sub-R6_behavior+ophys.nwb",
1616
),
1717
),
1818
dict(
@@ -54,7 +54,7 @@
5454
name="OphysTestCase",
5555
https_url=get_https_url(
5656
dandiset_id="213889",
57-
dandi_path="sub-R6_ses-20200206T210000_behavior+ophys/sub-R6_ses-20200206T210000_behavior+ophys.lindi.json",
57+
dandi_path="sub-R6/sub-R6_behavior+ophys.nwb.lindi.json",
5858
),
5959
),
6060
dict(

src/nwb_benchmarks/scripts/generate_lindi_from_remote.ipynb

Lines changed: 20 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,23 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": null,
66
"id": "abc49392-0615-46f4-9ae6-0f2808c16a09",
77
"metadata": {},
88
"outputs": [],
99
"source": [
10-
"import json\n",
1110
"import lindi\n",
1211
"from pathlib import Path\n",
1312
"\n",
14-
"max_chunks_to_cache = int(1e9)"
13+
"max_chunks_to_cache = None # int(1e9)"
1514
]
1615
},
1716
{
1817
"cell_type": "code",
1918
"execution_count": null,
2019
"id": "527e3697-9dc9-4ee7-8e62-3397ca754914",
2120
"metadata": {},
22-
"outputs": [
23-
{
24-
"name": "stderr",
25-
"output_type": "stream",
26-
"text": [
27-
"Writing chunk info for acquisition/data_00002_AD0/data: 100%|█████████| 1502/1502 [00:02<00:00, 639.30it/s]\n"
28-
]
29-
}
30-
],
21+
"outputs": [],
3122
"source": [
3223
"# ICEPHYS\n",
3324
"# DANDI:000717\n",
@@ -51,15 +42,7 @@
5142
"execution_count": null,
5243
"id": "faa14c01-3940-4057-87e0-74b97fd0427f",
5344
"metadata": {},
54-
"outputs": [
55-
{
56-
"name": "stderr",
57-
"output_type": "stream",
58-
"text": [
59-
"Writing chunk info for acquisition/ElectricalSeriesAp/data: 100%|█████| 1319/1319 [00:03<00:00, 399.32it/s]\n"
60-
]
61-
}
62-
],
45+
"outputs": [],
6346
"source": [
6447
"# ECEPHYS\n",
6548
"# DANDI:000717\n",
@@ -109,43 +92,26 @@
10992
"execution_count": null,
11093
"id": "da3c2d01-4824-4742-90b3-7be00b2410f7",
11194
"metadata": {},
112-
"outputs": [
113-
{
114-
"name": "stderr",
115-
"output_type": "stream",
116-
"text": [
117-
"Writing chunk info for acquisition/TwoPhotonSeries/data: 100%|█| 1333568/1333568 [00:08<00:00, 163375.64it/\n"
118-
]
119-
}
120-
],
95+
"outputs": [],
12196
"source": [
97+
"# Run on Perlmutter\n",
12298
"# OPHYS (local)\n",
123-
"# DANDI:000717\n",
124-
"# path and URL copied from asset page:\n",
125-
"# https://api.dandiarchive.org/api/dandisets/000717/versions/draft/assets/a6951f6e-b67e-4df3-a14f-07b7854b821c/\n",
126-
"orig_path = Path(\"sub-R6_ses-20200206T210000_behavior+ophys/sub-R6_ses-20200206T210000_behavior+ophys.nwb\")\n",
127-
"orig_path.parent.mkdir(parents=True, exist_ok=True)\n",
128-
"lindi_path = orig_path.with_suffix(\".lindi.json\")\n",
129-
"h5_url = \"https://api.dandiarchive.org/api/assets/a6951f6e-b67e-4df3-a14f-07b7854b821c/download/\"\n",
99+
"# import lindi\n",
130100
"\n",
131-
"# Create the h5py-like client\n",
132-
"zarr_store_opts = lindi.LindiH5ZarrStoreOpts(num_dataset_chunks_threshold=max_chunks_to_cache)\n",
101+
"# DANDI:000717 sub-R6/sub-R6_behavior+ophys.nwb\n",
102+
"# https://api.dandiarchive.org/api/dandisets/000717/versions/draft/assets/c15b3e06-f443-4964-a6b0-c44c367d830b/\n",
103+
"remote_url = \"https://api.dandiarchive.org/api/assets/c15b3e06-f443-4964-a6b0-c44c367d830b/download/\"\n",
104+
"local_path = \"/pscratch/sd/r/rly/nwb_bench/finished_conversions/sub-R6_ses-20200206T210000_behavior+ophys_rechunk.nwb\"\n",
105+
"out_path = local_path + \".lindi.json\"\n",
106+
"max_chunks_to_cache = None\n",
133107
"\n",
134-
"# Use local refs\n",
135-
"url_or_path = \"/Users/rly/Downloads/sub-R6_ses-20200206T210000_behavior+ophys.nwb\"\n",
136-
"url = h5_url\n",
137-
"local_cache = None\n",
138-
"mode = \"r\"\n",
139-
"\n",
140-
"zarr_store = lindi.LindiH5ZarrStore.from_file(url_or_path, local_cache=local_cache, opts=zarr_store_opts, url=url)\n",
141-
"client = lindi.LindiH5pyFile.from_zarr_store(\n",
142-
" zarr_store=zarr_store,\n",
143-
" mode=mode,\n",
144-
" local_cache=local_cache\n",
145-
")\n",
108+
"zarr_store_opts = lindi.LindiH5ZarrStoreOpts(num_dataset_chunks_threshold=max_chunks_to_cache)\n",
109+
"zarr_store = lindi.LindiH5ZarrStore.from_file(local_path, url=remote_url, opts=zarr_store_opts)\n",
110+
"client = lindi.LindiH5pyFile.from_zarr_store(zarr_store=zarr_store, mode=\"r\")\n",
146111
"\n",
147112
"# Generate a reference file system and write to JSON file\n",
148-
"client.write_lindi_file(str(lindi_path))"
113+
"client.write_lindi_file(str(out_path))\n",
114+
"client.close()"
149115
]
150116
},
151117
{
@@ -199,7 +165,7 @@
199165
],
200166
"metadata": {
201167
"kernelspec": {
202-
"display_name": "Python 3 (ipykernel)",
168+
"display_name": "test",
203169
"language": "python",
204170
"name": "python3"
205171
},
@@ -213,7 +179,7 @@
213179
"name": "python",
214180
"nbconvert_exporter": "python",
215181
"pygments_lexer": "ipython3",
216-
"version": "3.11.9"
182+
"version": "3.13.9"
217183
}
218184
},
219185
"nbformat": 4,

0 commit comments

Comments
 (0)