|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": 1, |
| 5 | + "execution_count": null, |
6 | 6 | "id": "abc49392-0615-46f4-9ae6-0f2808c16a09", |
7 | 7 | "metadata": {}, |
8 | 8 | "outputs": [], |
9 | 9 | "source": [ |
10 | | - "import json\n", |
11 | 10 | "import lindi\n", |
12 | 11 | "from pathlib import Path\n", |
13 | 12 | "\n", |
14 | | - "max_chunks_to_cache = int(1e9)" |
| 13 | + "max_chunks_to_cache = None # int(1e9)" |
15 | 14 | ] |
16 | 15 | }, |
17 | 16 | { |
18 | 17 | "cell_type": "code", |
19 | 18 | "execution_count": null, |
20 | 19 | "id": "527e3697-9dc9-4ee7-8e62-3397ca754914", |
21 | 20 | "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": [], |
31 | 22 | "source": [ |
32 | 23 | "# ICEPHYS\n", |
33 | 24 | "# DANDI:000717\n", |
|
51 | 42 | "execution_count": null, |
52 | 43 | "id": "faa14c01-3940-4057-87e0-74b97fd0427f", |
53 | 44 | "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": [], |
63 | 46 | "source": [ |
64 | 47 | "# ECEPHYS\n", |
65 | 48 | "# DANDI:000717\n", |
|
109 | 92 | "execution_count": null, |
110 | 93 | "id": "da3c2d01-4824-4742-90b3-7be00b2410f7", |
111 | 94 | "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": [], |
121 | 96 | "source": [ |
| 97 | + "# Run on Perlmutter\n", |
122 | 98 | "# 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", |
130 | 100 | "\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", |
133 | 107 | "\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", |
146 | 111 | "\n", |
147 | 112 | "# 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()" |
149 | 115 | ] |
150 | 116 | }, |
151 | 117 | { |
|
199 | 165 | ], |
200 | 166 | "metadata": { |
201 | 167 | "kernelspec": { |
202 | | - "display_name": "Python 3 (ipykernel)", |
| 168 | + "display_name": "test", |
203 | 169 | "language": "python", |
204 | 170 | "name": "python3" |
205 | 171 | }, |
|
213 | 179 | "name": "python", |
214 | 180 | "nbconvert_exporter": "python", |
215 | 181 | "pygments_lexer": "ipython3", |
216 | | - "version": "3.11.9" |
| 182 | + "version": "3.13.9" |
217 | 183 | } |
218 | 184 | }, |
219 | 185 | "nbformat": 4, |
|
0 commit comments