From 230e516bbbd885825b63eb3dd17df8b3af0b2a8d Mon Sep 17 00:00:00 2001 From: Benjamin Dichter Date: Wed, 11 Nov 2026 22:13:23 -0500 Subject: [PATCH] Pin notebooks to published dandiset versions Notebooks that read a dandiset's draft (or its latest published version implicitly) now name a published version, so re-uploads to the draft or a new release cannot change the data under them. Each pin is the dandiset's most recent published version. Notebooks with a dandiset ID variable get a matching dandiset_version/DANDISET_VERSION variable; the shared stream_nwbfile helpers take the version as an argument. For 000971 and 001550 the draft files changed after the last release, so these notebooks now read the published files; the rest read files identical to their draft. Co-Authored-By: Claude Opus 5.5 --- 000039/AllenInstitute/Contrast_analysis.ipynb | 3 ++- 000039/AllenInstitute/Create_manifest.ipynb | 5 +++-- .../peterson21/Fig_coarse_labels.ipynb | 2 +- .../BruntonLab/peterson21/compute_cont_spec.py | 6 +++--- 000055/BruntonLab/peterson21/dashboard.ipynb | 2 +- 000055/BruntonLab/peterson21/plot_utils.py | 16 ++++++++-------- .../230905_NeuroDataReHack_2023_CEBRA.ipynb | 2 +- 000363/MAP/demo/browse_map_ephys_data.ipynb | 3 ++- .../MICrONS/coregistration/microns_nwb_coreg.py | 2 +- .../microns_nwb_coreg_notebook.ipynb | 3 ++- 000402/MICrONS/demo/000402_microns_demo.ipynb | 9 +++++---- 000409/IBL/bwm_usage_notebook.ipynb | 3 ++- 000458/AllenInstitute/reanalysis.ipynb | 7 ++++--- .../000_lindi_vs_fsspec_streaming.ipynb | 5 +++-- .../001_summarize_contents.ipynb | 3 ++- .../FlatironInstitute/helpers/stream_nwbfile.py | 6 ++++-- .../markowitz_gillis_nature_2023/read_avi.ipynb | 3 ++- .../reproduce_figure1d.ipynb | 3 ++- .../reproduce_figure_S1.ipynb | 3 ++- .../reproduce_figure_S3.ipynb | 3 ++- .../stream_nwbfile.py | 6 ++++-- .../000582_Sargolini2006_demo.ipynb | 2 +- 000718/CaiLab/zaki_2024/000718_demo.ipynb | 7 ++++--- .../simple_data_access/reading_data.ipynb | 3 ++- .../visual_coding_ophys_tutorial.ipynb | 3 ++- 000947/TurnerLab/public_demo/000947_demo.ipynb | 3 ++- .../fiber_photometry_example_notebook.ipynb | 3 ++- .../optogenetics_example_notebook.ipynb | 3 ++- 000971/lernerlab/seiler_2024/stream_nwbfile.py | 6 ++++-- 001038/DombeckLab/001038_demo.ipynb | 3 ++- 001075/utils_001075/_stream_nwbfile.py | 3 ++- 001084/HoweLab/001084_demo.ipynb | 3 ++- 001170/ReimerLab/public_demo/001170_demo.ipynb | 3 ++- 001172/HigleyLab/001172_demo.ipynb | 3 ++- 001550/PaganLab/01_behavior_demo.ipynb | 3 ++- 001550/PaganLab/02_optogenetics_demo.ipynb | 3 ++- 001933/DombeckLab/001933_demo.ipynb | 3 ++- tutorials/bcm_2024/analysis-demo.ipynb | 3 ++- .../cosyne_2023/advanced_asset_search.ipynb | 2 +- .../cosyne_2023/simple_dandiset_search.ipynb | 2 +- .../advanced_asset_search.ipynb | 2 +- .../simple_dandiset_search.ipynb | 2 +- .../Get-to-know-a-Dandiset.ipynb | 4 ++-- 43 files changed, 99 insertions(+), 65 deletions(-) diff --git a/000039/AllenInstitute/Contrast_analysis.ipynb b/000039/AllenInstitute/Contrast_analysis.ipynb index 70990990..dfc7b62d 100644 --- a/000039/AllenInstitute/Contrast_analysis.ipynb +++ b/000039/AllenInstitute/Contrast_analysis.ipynb @@ -69,9 +69,10 @@ "outputs": [], "source": [ "dandiset_id = '000039'\n", + "dandiset_version = \"0.230223.1216\"\n", "filepath = \"sub-699590236/sub-699590236_ses-724712005_behavior+ophys.nwb\"\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(filepath)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(filepath)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)" ] }, diff --git a/000039/AllenInstitute/Create_manifest.ipynb b/000039/AllenInstitute/Create_manifest.ipynb index 3d691a04..f7c64851 100644 --- a/000039/AllenInstitute/Create_manifest.ipynb +++ b/000039/AllenInstitute/Create_manifest.ipynb @@ -187,7 +187,8 @@ }, "outputs": [], "source": [ - "dandiset_id = '000039'" + "dandiset_id = '000039'", + "dandiset_version = \"0.230223.1216\"" ] }, { @@ -212,7 +213,7 @@ }, "outputs": [], "source": [ - "ds = client.get_dandiset(dandiset_id)" + "ds = client.get_dandiset(dandiset_id, dandiset_version)" ] }, { diff --git a/000055/BruntonLab/peterson21/Fig_coarse_labels.ipynb b/000055/BruntonLab/peterson21/Fig_coarse_labels.ipynb index 04bb5af6..120c3dc5 100644 --- a/000055/BruntonLab/peterson21/Fig_coarse_labels.ipynb +++ b/000055/BruntonLab/peterson21/Fig_coarse_labels.ipynb @@ -271,7 +271,7 @@ "outputs": [], "source": [ "with DandiAPIClient() as client:\n", - " asset = clieconnt.get_dandiset(\"000055\", \"draft\").get_asset_by_path(\n", + " asset = clieconnt.get_dandiset(\"000055\", \"0.220127.0436\").get_asset_by_path(\n", " \"sub-01/sub-01_ses-4_behavior+ecephys.nwb\"\n", " )\n", " s3_path = asset.get_content_url(follow_redirects=1, strip_query=True)\n", diff --git a/000055/BruntonLab/peterson21/compute_cont_spec.py b/000055/BruntonLab/peterson21/compute_cont_spec.py index 0b2ed0b3..0b8c40d3 100644 --- a/000055/BruntonLab/peterson21/compute_cont_spec.py +++ b/000055/BruntonLab/peterson21/compute_cont_spec.py @@ -21,7 +21,7 @@ # Determine all file paths with DandiAPIClient() as client: paths = [] - for file in client.get_dandiset("000055", "draft").get_assets_under_path(""): + for file in client.get_dandiset("000055", "0.220127.0436").get_assets_under_path(""): paths.append(file.path) paths = natsort.natsorted(paths) @@ -31,7 +31,7 @@ for s in range(n_parts): fid = [val for val in paths if "sub-" + str(s + 1).zfill(2) in val][0] with DandiAPIClient() as client: - asset = client.get_dandiset("000055", "draft").get_asset_by_path(fid) + asset = client.get_dandiset("000055", "0.220127.0436").get_asset_by_path(fid) s3_path = asset.get_content_url(follow_redirects=1, strip_query=True) with NWBHDF5IO(s3_path, mode="r", load_namespaces=True, driver="ros3") as io: @@ -77,7 +77,7 @@ pows_sbj = None for j, fid in enumerate(fids): with DandiAPIClient() as client: - asset = client.get_dandiset("000055", "draft").get_asset_by_path(fid) + asset = client.get_dandiset("000055", "0.220127.0436").get_asset_by_path(fid) s3_path = asset.get_content_url(follow_redirects=1, strip_query=True) with NWBHDF5IO(s3_path, mode="r", load_namespaces=True, driver="ros3") as io: diff --git a/000055/BruntonLab/peterson21/dashboard.ipynb b/000055/BruntonLab/peterson21/dashboard.ipynb index 3ed33a31..1bac56a5 100644 --- a/000055/BruntonLab/peterson21/dashboard.ipynb +++ b/000055/BruntonLab/peterson21/dashboard.ipynb @@ -238,7 +238,7 @@ "outputs": [], "source": [ "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(\"000055\", \"draft\").get_asset_by_path(\n", + " asset = client.get_dandiset(\"000055\", \"0.220127.0436\").get_asset_by_path(\n", " \"sub-01/sub-01_ses-4_behavior+ecephys.nwb\"\n", " )\n", " s3_path = asset.get_content_url(follow_redirects=1, strip_query=True)\n", diff --git a/000055/BruntonLab/peterson21/plot_utils.py b/000055/BruntonLab/peterson21/plot_utils.py index cdb2e027..6df78d41 100644 --- a/000055/BruntonLab/peterson21/plot_utils.py +++ b/000055/BruntonLab/peterson21/plot_utils.py @@ -140,7 +140,7 @@ def clabel_table_create( Labels to include in the table are specified by common_acts.""" with DandiAPIClient() as client: paths = [] - for file in client.get_dandiset("000055", "draft").get_assets_with_path_prefix(""): + for file in client.get_dandiset("000055", "0.220127.0436").get_assets_with_path_prefix(""): paths.append(file.path) paths = natsort.natsorted(paths) @@ -149,7 +149,7 @@ def clabel_table_create( fids = [val for val in paths if "sub-" + str(part_ind + 1).zfill(2) in val] for fid in fids: with DandiAPIClient() as client: - asset = client.get_dandiset("000055", "draft").get_asset_by_path(fid) + asset = client.get_dandiset("000055", "0.220127.0436").get_asset_by_path(fid) s3_path = asset.get_content_url(follow_redirects=1, strip_query=True) with NWBHDF5IO(s3_path, mode="r", driver="ros3") as io: nwb = io.read() @@ -208,7 +208,7 @@ def load_data_characteristics(nparts=12): and number of recording days for each participant.""" with DandiAPIClient() as client: paths = [] - for file in client.get_dandiset("000055", "draft").get_assets_with_path_prefix(""): + for file in client.get_dandiset("000055", "0.220127.0436").get_assets_with_path_prefix(""): paths.append(file.path) paths = natsort.natsorted(paths) @@ -220,7 +220,7 @@ def load_data_characteristics(nparts=12): rec_days.append(len(fids)) for fid in fids[:1]: with DandiAPIClient() as client: - asset = client.get_dandiset("000055", "draft").get_asset_by_path(fid) + asset = client.get_dandiset("000055", "0.220127.0436").get_asset_by_path(fid) s3_path = asset.get_content_url(follow_redirects=1, strip_query=True) with NWBHDF5IO(s3_path, mode="r", driver="ros3") as io: nwb = io.read() @@ -280,7 +280,7 @@ def plot_ecog_descript( electrodes side by side.""" with DandiAPIClient() as client: paths = [] - for file in client.get_dandiset("000055", "draft").get_assets_with_path_prefix(""): + for file in client.get_dandiset("000055", "0.220127.0436").get_assets_with_path_prefix(""): paths.append(file.path) paths = natsort.natsorted(paths) @@ -303,7 +303,7 @@ def plot_ecog_descript( # Load NWB data file fids = [val for val in paths if "sub-" + str(part_ind + 1).zfill(2) in val] with DandiAPIClient() as client: - asset = client.get_dandiset("000055", "draft").get_asset_by_path(fids[0]) + asset = client.get_dandiset("000055", "0.220127.0436").get_asset_by_path(fids[0]) s3_path = asset.get_content_url(follow_redirects=1, strip_query=True) with NWBHDF5IO(s3_path, mode="r", driver="ros3") as io: nwb = io.read() @@ -872,7 +872,7 @@ def _get_wrist_trajs( """Load in wrist trajectories around move onset events.""" with DandiAPIClient() as client: paths = [] - for file in client.get_dandiset("000055", "draft").get_assets_with_path_prefix(""): + for file in client.get_dandiset("000055", "0.220127.0436").get_assets_with_path_prefix(""): paths.append(file.path) paths = natsort.natsorted(paths) @@ -881,7 +881,7 @@ def _get_wrist_trajs( fids = [val for val in paths if "sub-" + str(pat + 1).zfill(2) in val] for i, fid in enumerate(fids): with DandiAPIClient() as client: - asset = client.get_dandiset("000055", "draft").get_asset_by_path(fid) + asset = client.get_dandiset("000055", "0.220127.0436").get_asset_by_path(fid) s3_path = asset.get_content_url(follow_redirects=1, strip_query=True) with NWBHDF5IO( s3_path, mode="r", driver="ros3" diff --git a/000129/MathisLab/Schneider2023_CEBRA/230905_NeuroDataReHack_2023_CEBRA.ipynb b/000129/MathisLab/Schneider2023_CEBRA/230905_NeuroDataReHack_2023_CEBRA.ipynb index 90f97d47..d02cbe19 100644 --- a/000129/MathisLab/Schneider2023_CEBRA/230905_NeuroDataReHack_2023_CEBRA.ipynb +++ b/000129/MathisLab/Schneider2023_CEBRA/230905_NeuroDataReHack_2023_CEBRA.ipynb @@ -149,7 +149,7 @@ { "cell_type": "code", "source": [ - "! dandi download https://dandiarchive.org/dandiset/000129/draft" + "! dandi download https://dandiarchive.org/dandiset/000129/0.241017.1444" ], "metadata": { "colab": { diff --git a/000363/MAP/demo/browse_map_ephys_data.ipynb b/000363/MAP/demo/browse_map_ephys_data.ipynb index 7b0d4c3f..f61715b5 100644 --- a/000363/MAP/demo/browse_map_ephys_data.ipynb +++ b/000363/MAP/demo/browse_map_ephys_data.ipynb @@ -1953,6 +1953,7 @@ "outputs": [], "source": [ "dandiset_id = \"000363\" \n", + "dandiset_version = \"0.231012.2129\"\n", "filepath = \"sub-440956/sub-440956_ses-20190207T120657_behavior+ecephys+ogen.nwb\"" ] }, @@ -1976,7 +1977,7 @@ ], "source": [ "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, \"draft\").get_asset_by_path(filepath)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(filepath)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)\n", "fs=fsspec.filesystem(\"http\")\n", "file = h5py.File(fs.open(s3_url, \"rb\"))\n", diff --git a/000402/MICrONS/coregistration/microns_nwb_coreg.py b/000402/MICrONS/coregistration/microns_nwb_coreg.py index 1ca7fe29..0f3bda54 100644 --- a/000402/MICrONS/coregistration/microns_nwb_coreg.py +++ b/000402/MICrONS/coregistration/microns_nwb_coreg.py @@ -53,7 +53,7 @@ def get_microns_nwb_file(session_no:int, scan_no:int): file_path = f"sub-17797/sub-17797_ses-{session_no}-scan-{scan_no}_behavior+image+ophys.nwb" with DandiAPIClient() as client: - asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path) + asset = client.get_dandiset(DANDISET_ID, "0.230307.2132").get_asset_by_path(file_path) s3_url = asset.get_content_url(follow_redirects=1, strip_query=True) # First, create a virtual filesystem based on the http protocol diff --git a/000402/MICrONS/coregistration/microns_nwb_coreg_notebook.ipynb b/000402/MICrONS/coregistration/microns_nwb_coreg_notebook.ipynb index de838851..76efe5de 100644 --- a/000402/MICrONS/coregistration/microns_nwb_coreg_notebook.ipynb +++ b/000402/MICrONS/coregistration/microns_nwb_coreg_notebook.ipynb @@ -671,6 +671,7 @@ "scan_unit_row = scan_units[(scan_units['session']==session_no)&(scan_units['scan_idx']==scan_no)&(scan_units['unit_id']==unit_id)]\n", "\n", "dandiset_id = \"000402\"\n", + "dandiset_version = \"0.230307.2132\"\n", "\n", "display((session_no, scan_no, unit_id))" ] @@ -709,7 +710,7 @@ "def get_NWBFile(session_no, scan_no):\n", " file_path = f\"sub-17797/sub-17797_ses-{session_no}-scan-{scan_no}_behavior+image+ophys.nwb\"\n", " with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(file_path)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(file_path)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)\n", "\n", " # First, create a virtual filesystem based on the http protocol\n", diff --git a/000402/MICrONS/demo/000402_microns_demo.ipynb b/000402/MICrONS/demo/000402_microns_demo.ipynb index 2b4c1ad8..6f18e97a 100644 --- a/000402/MICrONS/demo/000402_microns_demo.ipynb +++ b/000402/MICrONS/demo/000402_microns_demo.ipynb @@ -159,7 +159,7 @@ "source": [ "# MICrONS NWB tutorial\n", "\n", - "This tutorial demonstrates how to access the [MICrONS functional data](https://dandiarchive.org/dandiset/000402/draft) using `dandi`.\n", + "This tutorial demonstrates how to access the [MICrONS functional data](https://dandiarchive.org/dandiset/000402/0.230307.2132) using `dandi`.\n", "\n", "The functional data from the [MICrONS project](https://www.microns-explorer.org/cortical-mm3) contains calcium imaging recorded from multiple cortical visual areas and behavioral measurements while a mouse viewed natural movies and parametric stimuli.\n", "\n", @@ -205,11 +205,12 @@ "from dandi.dandiapi import DandiAPIClient\n", "\n", "dandiset_id = \"000402\"\n", + "dandiset_version = \"0.230307.2132\"\n", "file_path = \"sub-17797/sub-17797_ses-9-scan-4_behavior+image+ophys.nwb\" # file size ~67GB\n", "\n", "# Get the location of the file on DANDI\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(file_path)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(file_path)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)" ] }, @@ -2535,7 +2536,7 @@ "\n", "# The file path on DANDI\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(file_path)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(file_path)\n", " dandiset_url = asset.api_url\n", "\n", "# Download the file\n", @@ -2555,7 +2556,7 @@ "source": [ "# Downloading all NWB files for this dandiset\n", "\n", - "# dandiset_url = \"https://dandiarchive.org/dandiset/000402/draft\"\n", + "# dandiset_url = \"https://dandiarchive.org/dandiset/000402/0.230307.2132\"\n", "# dandi_download(urls=dandiset_url, output_dir=dandiset_folder_path, get_metadata=True, get_assets=True)" ] } diff --git a/000409/IBL/bwm_usage_notebook.ipynb b/000409/IBL/bwm_usage_notebook.ipynb index ab958b0f..ebc330ec 100644 --- a/000409/IBL/bwm_usage_notebook.ipynb +++ b/000409/IBL/bwm_usage_notebook.ipynb @@ -278,8 +278,9 @@ "\n", "# Connect to DANDI and get the dandiset\n", "dandiset_id = \"000409\"\n", + "dandiset_version = \"0.260309.1324\"\n", "client = DandiAPIClient()\n", - "dandiset = client.get_dandiset(dandiset_id, \"draft\")\n", + "dandiset = client.get_dandiset(dandiset_id, dandiset_version)\n", "\n", "# =============================================================================\n", "# Session EIDs for NEW format files (desc-raw / desc-processed)\n", diff --git a/000458/AllenInstitute/reanalysis.ipynb b/000458/AllenInstitute/reanalysis.ipynb index f304ff31..40f8c947 100644 --- a/000458/AllenInstitute/reanalysis.ipynb +++ b/000458/AllenInstitute/reanalysis.ipynb @@ -178,7 +178,7 @@ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", - "def stream_nwbfile(DANDISET_ID, file_path):\n", + "def stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION):\n", " '''Stream NWB file from DANDI archive.\n", " \n", " Parameters\n", @@ -200,7 +200,7 @@ " The io object must be closed after use.\n", " '''\n", " with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path)\n", + " asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(file_path)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)\n", " # remfile is tuned for HDF5 access patterns (many small scattered reads);\n", " # a generic HTTP file object over-fetches and makes opening large files\n", @@ -1075,8 +1075,9 @@ ], "source": [ "DANDISET_ID = \"000458\"\n", + "DANDISET_VERSION = \"0.230317.0039\"\n", "file_path = \"sub-586468/sub-586468_ses-20210819_behavior+ecephys.nwb\"\n", - "nwbfile, io = stream_nwbfile(DANDISET_ID, file_path)\n", + "nwbfile, io = stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION)\n", "# print() summarizes the file from metadata alone; the rich display() repr\n", "# pulls preview slices of every dataset over the network (minutes on a 22 GB file)\n", "print(nwbfile)" diff --git a/000458/FlatironInstitute/000_lindi_vs_fsspec_streaming.ipynb b/000458/FlatironInstitute/000_lindi_vs_fsspec_streaming.ipynb index 0f457955..099e2785 100644 --- a/000458/FlatironInstitute/000_lindi_vs_fsspec_streaming.ipynb +++ b/000458/FlatironInstitute/000_lindi_vs_fsspec_streaming.ipynb @@ -217,7 +217,7 @@ " The io object must be closed after use.\n", " '''\n", " with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path)\n", + " asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(file_path)\n", " asset_url = asset.get_content_url(follow_redirects=0, strip_query=True)\n", " file = lindi.LindiH5pyFile.from_hdf5_file(asset_url)\n", " io = NWBHDF5IO(file=file, load_namespaces=True)\n", @@ -247,7 +247,7 @@ " The io object must be closed after use.\n", " '''\n", " with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path)\n", + " asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(file_path)\n", " asset_url = asset.get_content_url(follow_redirects=0, strip_query=True)\n", " fs = filesystem(\"http\")\n", " file_system = fs.open(asset_url, \"rb\")\n", @@ -258,6 +258,7 @@ "\n", "\n", "DANDISET_ID = \"000458\"\n", + "DANDISET_VERSION = \"0.230317.0039\"\n", "file_path = \"sub-586468/sub-586468_ses-20210819_behavior+ecephys.nwb\"\n", "\n", "timer = time.time()\n", diff --git a/000458/FlatironInstitute/001_summarize_contents.ipynb b/000458/FlatironInstitute/001_summarize_contents.ipynb index c7e79f2c..ceef2ec3 100644 --- a/000458/FlatironInstitute/001_summarize_contents.ipynb +++ b/000458/FlatironInstitute/001_summarize_contents.ipynb @@ -966,6 +966,7 @@ "\n", "\n", "DANDISET_ID = \"000458\"\n", + "DANDISET_VERSION = \"0.230317.0039\"\n", "\n", "parsed_url = da.parse_dandi_url(f\"https://dandiarchive.org/dandiset/{DANDISET_ID}\")\n", "\n", @@ -991,7 +992,7 @@ " \"download_url\": asset_obj.download_url,\n", " \"dandiset_id\": DANDISET_ID,\n", " }\n", - " nwbfile, io = stream_nwbfile(DANDISET_ID, asset[\"path\"])\n", + " nwbfile, io = stream_nwbfile(DANDISET_ID, asset[\"path\"], DANDISET_VERSION)\n", " md = ''\n", " ns_url = f'https://neurosift.app/?p=/nwb&url={asset[\"download_url\"]}&dandisetId={DANDISET_ID}'\n", " md += f'**Asset {asset_index + 1}: [{asset[\"path\"]}]({ns_url})**\\n\\n'\n", diff --git a/000458/FlatironInstitute/helpers/stream_nwbfile.py b/000458/FlatironInstitute/helpers/stream_nwbfile.py index 2eacf7f5..e1c4a9ab 100644 --- a/000458/FlatironInstitute/helpers/stream_nwbfile.py +++ b/000458/FlatironInstitute/helpers/stream_nwbfile.py @@ -5,7 +5,7 @@ import lindi -def stream_nwbfile(DANDISET_ID, file_path): +def stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION="draft"): '''Stream NWB file from DANDI archive. Parameters @@ -14,6 +14,8 @@ def stream_nwbfile(DANDISET_ID, file_path): Dandiset ID file_path : str Path to NWB file in DANDI archive + DANDISET_VERSION : str + Dandiset version, e.g. a published version such as "0.230317.0039" Returns ------- @@ -27,7 +29,7 @@ def stream_nwbfile(DANDISET_ID, file_path): The io object must be closed after use. ''' with DandiAPIClient() as client: - asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path) + asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(file_path) asset_url = asset.get_content_url(follow_redirects=0, strip_query=True) file = lindi.LindiH5pyFile.from_hdf5_file(asset_url) io = NWBHDF5IO(file=file, load_namespaces=True) diff --git a/000559/dattalab/markowitz_gillis_nature_2023/read_avi.ipynb b/000559/dattalab/markowitz_gillis_nature_2023/read_avi.ipynb index 49917c2a..6cd89fa9 100644 --- a/000559/dattalab/markowitz_gillis_nature_2023/read_avi.ipynb +++ b/000559/dattalab/markowitz_gillis_nature_2023/read_avi.ipynb @@ -247,7 +247,7 @@ " Number of chunks to read from the file. If None, read the whole file.\n", " '''\n", " with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path)\n", + " asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(file_path)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)\n", " fs = filesystem(\"http\")\n", " file_system = fs.open(s3_url, \"rb\")\n", @@ -306,6 +306,7 @@ "outputs": [], "source": [ "DANDISET_ID = '000559'\n", + "DANDISET_VERSION = \"0.260528.0858\"\n", "avi_file_path = 'sub-10/sub-10_ses-reinforcement-0e0aca4f-6a99-46eb-9eb8-439f36e66c40_behavior+image+ogen/f9af8a18-7cab-471c-802f-6937edeaec68_external_file_0.avi'\n", "num_chunks = 10 # Use None to read the whole file\n", "\n", diff --git a/000559/dattalab/markowitz_gillis_nature_2023/reproduce_figure1d.ipynb b/000559/dattalab/markowitz_gillis_nature_2023/reproduce_figure1d.ipynb index 5a0b2c96..3ae02e5a 100644 --- a/000559/dattalab/markowitz_gillis_nature_2023/reproduce_figure1d.ipynb +++ b/000559/dattalab/markowitz_gillis_nature_2023/reproduce_figure1d.ipynb @@ -163,10 +163,11 @@ "source": [ "from stream_nwbfile import stream_nwbfile\n", "DANDISET_ID = '000559'\n", + "DANDISET_VERSION = \"0.260528.0858\"\n", "file_path = ('sub-dlight-chrimson-1/sub-dlight-chrimson-1_'\n", " 'ses-reinforcement-photometry-2891f649-4fbd-4119-a807-b8ef507edfab_behavior+image+ogen+ophys.nwb'\n", ")\n", - "nwbfile, io = stream_nwbfile(DANDISET_ID, file_path)" + "nwbfile, io = stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION)" ] }, { diff --git a/000559/dattalab/markowitz_gillis_nature_2023/reproduce_figure_S1.ipynb b/000559/dattalab/markowitz_gillis_nature_2023/reproduce_figure_S1.ipynb index b9c7a168..d704fe72 100644 --- a/000559/dattalab/markowitz_gillis_nature_2023/reproduce_figure_S1.ipynb +++ b/000559/dattalab/markowitz_gillis_nature_2023/reproduce_figure_S1.ipynb @@ -223,6 +223,7 @@ "from stream_nwbfile import stream_nwbfile\n", "\n", "DANDISET_ID = '000559'\n", + "DANDISET_VERSION = \"0.260528.0858\"\n", "hek_path = 'sub-HEK293'\n", "file_paths = [\n", " hek_path + '/sub-HEK293_ses-exp3_ophys.nwb',\n", @@ -231,7 +232,7 @@ "]\n", "\n", "\n", - "nwbfiles, ios = zip(*[stream_nwbfile(DANDISET_ID, file_path) for file_path in tqdm(file_paths)])" + "nwbfiles, ios = zip(*[stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION) for file_path in tqdm(file_paths)])" ] }, { diff --git a/000559/dattalab/markowitz_gillis_nature_2023/reproduce_figure_S3.ipynb b/000559/dattalab/markowitz_gillis_nature_2023/reproduce_figure_S3.ipynb index fd821e71..75cd57e4 100644 --- a/000559/dattalab/markowitz_gillis_nature_2023/reproduce_figure_S3.ipynb +++ b/000559/dattalab/markowitz_gillis_nature_2023/reproduce_figure_S3.ipynb @@ -54,6 +54,7 @@ "from stream_nwbfile import stream_nwbfile\n", "\n", "DANDISET_ID = '000559'\n", + "DANDISET_VERSION = \"0.260528.0858\"\n", "file_paths = [\n", " 'sub-dls-dlight-9/sub-dls-dlight-9_ses-keypoint-dls-dlight-9_image+ophys.nwb',\n", " 'sub-dls-dlight-10/sub-dls-dlight-10_ses-keypoint-dls-dlight-10_image+ophys.nwb',\n", @@ -63,7 +64,7 @@ "]\n", "\n", "\n", - "nwbfiles, ios = zip(*[stream_nwbfile(DANDISET_ID, file_path) for file_path in tqdm(file_paths)])" + "nwbfiles, ios = zip(*[stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION) for file_path in tqdm(file_paths)])" ] }, { diff --git a/000559/dattalab/markowitz_gillis_nature_2023/stream_nwbfile.py b/000559/dattalab/markowitz_gillis_nature_2023/stream_nwbfile.py index b5cff46e..5f2def61 100644 --- a/000559/dattalab/markowitz_gillis_nature_2023/stream_nwbfile.py +++ b/000559/dattalab/markowitz_gillis_nature_2023/stream_nwbfile.py @@ -3,7 +3,7 @@ from h5py import File from dandi.dandiapi import DandiAPIClient -def stream_nwbfile(DANDISET_ID, file_path): +def stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION="draft"): '''Stream NWB file from DANDI archive. Parameters @@ -12,6 +12,8 @@ def stream_nwbfile(DANDISET_ID, file_path): Dandiset ID file_path : str Path to NWB file in DANDI archive + DANDISET_VERSION : str + Dandiset version, e.g. a published version such as "0.230317.0039" Returns ------- @@ -25,7 +27,7 @@ def stream_nwbfile(DANDISET_ID, file_path): The io object must be closed after use. ''' with DandiAPIClient() as client: - asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path) + asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(file_path) s3_url = asset.get_content_url(follow_redirects=1, strip_query=True) fs = filesystem("http") file_system = fs.open(s3_url, "rb") diff --git a/000582/Sargolini2006/000582_Sargolini2006_demo.ipynb b/000582/Sargolini2006/000582_Sargolini2006_demo.ipynb index f933d514..2124162c 100644 --- a/000582/Sargolini2006/000582_Sargolini2006_demo.ipynb +++ b/000582/Sargolini2006/000582_Sargolini2006_demo.ipynb @@ -239,7 +239,7 @@ "\n", "# Get the location of the file on DANDI\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(nwbfile_path)\n", + " asset = client.get_dandiset(dandiset_id, \"0.251111.2151\").get_asset_by_path(nwbfile_path)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)" ] }, diff --git a/000718/CaiLab/zaki_2024/000718_demo.ipynb b/000718/CaiLab/zaki_2024/000718_demo.ipynb index 9abb76e6..fc455ad1 100644 --- a/000718/CaiLab/zaki_2024/000718_demo.ipynb +++ b/000718/CaiLab/zaki_2024/000718_demo.ipynb @@ -206,6 +206,7 @@ "outputs": [], "source": [ "dandiset_id = \"000718\"\n", + "dandiset_version = \"0.260825.1902\"\n", "subject_id = \"Ca-EEG3-4\"\n", "session_id = \"FC\"" ] @@ -241,7 +242,7 @@ "\n", "dandiset_id = \"000718\"\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(nwbfile_path)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(nwbfile_path)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=False)\n", "\n", "import h5py\n", @@ -2124,7 +2125,7 @@ "\n", "dandiset_id = \"000718\"\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(nwbfile_path)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(nwbfile_path)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=False)\n", "\n", "import h5py\n", @@ -3961,7 +3962,7 @@ "\n", "dandiset_id = \"000718\"\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(nwbfile_path)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(nwbfile_path)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=False)\n", "\n", "import h5py\n", diff --git a/000727/clandinin/simple_data_access/reading_data.ipynb b/000727/clandinin/simple_data_access/reading_data.ipynb index eae965eb..9be037d4 100644 --- a/000727/clandinin/simple_data_access/reading_data.ipynb +++ b/000727/clandinin/simple_data_access/reading_data.ipynb @@ -188,7 +188,8 @@ "client = DandiAPIClient.for_dandi_instance(\"dandi\")\n", "\n", "dandiset_id = \"000727\"\n", - "dandiset = client.get_dandiset(dandiset_id)\n", + "dandiset_version = \"0.240106.0043\"\n", + "dandiset = client.get_dandiset(dandiset_id, dandiset_version)\n", "asset_list = [asset for asset in dandiset.get_assets() if \"nwb\" in asset.path]\n", "# The paths are:\n", "[asset.path for asset in asset_list]" diff --git a/000728/AllenInstitute/visual_coding_ophys_tutorial.ipynb b/000728/AllenInstitute/visual_coding_ophys_tutorial.ipynb index 6ca3f099..82620388 100644 --- a/000728/AllenInstitute/visual_coding_ophys_tutorial.ipynb +++ b/000728/AllenInstitute/visual_coding_ophys_tutorial.ipynb @@ -991,9 +991,10 @@ "outputs": [], "source": [ "dandiset_id = \"000728\"\n", + "dandiset_version = \"0.240827.1809\"\n", "\n", "client = DandiAPIClient()\n", - "dandiset = client.get_dandiset(dandiset_id=dandiset_id)" + "dandiset = client.get_dandiset(dandiset_id=dandiset_id, version_id=dandiset_version)" ] }, { diff --git a/000947/TurnerLab/public_demo/000947_demo.ipynb b/000947/TurnerLab/public_demo/000947_demo.ipynb index d5115bff..bbbc8424 100644 --- a/000947/TurnerLab/public_demo/000947_demo.ipynb +++ b/000947/TurnerLab/public_demo/000947_demo.ipynb @@ -203,10 +203,11 @@ "client = DandiAPIClient.for_dandi_instance(\"dandi\")\n", "\n", "dandiset_id = \"000947\"\n", + "dandiset_version = \"0.240510.2211\"\n", "file_path = \"sub-Isis/sub-Isis_ses-post-MPTP-I-190118-6_ecephys.nwb\"\n", "\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(file_path)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(file_path)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)" ] }, diff --git a/000971/lernerlab/seiler_2024/fiber_photometry_example_notebook.ipynb b/000971/lernerlab/seiler_2024/fiber_photometry_example_notebook.ipynb index aa5bb95b..eb762499 100644 --- a/000971/lernerlab/seiler_2024/fiber_photometry_example_notebook.ipynb +++ b/000971/lernerlab/seiler_2024/fiber_photometry_example_notebook.ipynb @@ -463,8 +463,9 @@ ], "source": [ "DANDISET_ID = '000971'\n", + "DANDISET_VERSION = \"0.261013.1707\"\n", "file_path = 'sub-112-283/sub-112-283_ses-FP-PS-2019-06-20T09-32-04_behavior.nwb'\n", - "nwbfile, io = stream_nwbfile(DANDISET_ID, file_path)\n", + "nwbfile, io = stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION)\n", "display(nwbfile)" ] }, diff --git a/000971/lernerlab/seiler_2024/optogenetics_example_notebook.ipynb b/000971/lernerlab/seiler_2024/optogenetics_example_notebook.ipynb index cad6708d..69ad8fcd 100644 --- a/000971/lernerlab/seiler_2024/optogenetics_example_notebook.ipynb +++ b/000971/lernerlab/seiler_2024/optogenetics_example_notebook.ipynb @@ -288,8 +288,9 @@ ], "source": [ "DANDISET_ID = '000971'\n", + "DANDISET_VERSION = \"0.261013.1707\"\n", "file_path = 'sub-119-416/sub-119-416_ses-Opto-DMS-Excitatory-ChR2-2020-10-20T13-00-57_ogen.nwb'\n", - "nwbfile, io = stream_nwbfile(DANDISET_ID, file_path)\n", + "nwbfile, io = stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION)\n", "display(nwbfile)" ] }, diff --git a/000971/lernerlab/seiler_2024/stream_nwbfile.py b/000971/lernerlab/seiler_2024/stream_nwbfile.py index b5cff46e..5f2def61 100644 --- a/000971/lernerlab/seiler_2024/stream_nwbfile.py +++ b/000971/lernerlab/seiler_2024/stream_nwbfile.py @@ -3,7 +3,7 @@ from h5py import File from dandi.dandiapi import DandiAPIClient -def stream_nwbfile(DANDISET_ID, file_path): +def stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION="draft"): '''Stream NWB file from DANDI archive. Parameters @@ -12,6 +12,8 @@ def stream_nwbfile(DANDISET_ID, file_path): Dandiset ID file_path : str Path to NWB file in DANDI archive + DANDISET_VERSION : str + Dandiset version, e.g. a published version such as "0.230317.0039" Returns ------- @@ -25,7 +27,7 @@ def stream_nwbfile(DANDISET_ID, file_path): The io object must be closed after use. ''' with DandiAPIClient() as client: - asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path) + asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(file_path) s3_url = asset.get_content_url(follow_redirects=1, strip_query=True) fs = filesystem("http") file_system = fs.open(s3_url, "rb") diff --git a/001038/DombeckLab/001038_demo.ipynb b/001038/DombeckLab/001038_demo.ipynb index 72b69ced..c2d953ee 100644 --- a/001038/DombeckLab/001038_demo.ipynb +++ b/001038/DombeckLab/001038_demo.ipynb @@ -215,10 +215,11 @@ "client = DandiAPIClient.for_dandi_instance(\"dandi\")\n", "\n", "dandiset_id = \"001038\"\n", + "dandiset_version = \"0.241111.1719\"\n", "file_path = \"sub-VGlut-A997/sub-VGlut-A997_ses-20200205-0001.nwb\"\n", "\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(file_path)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(file_path)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)" ] }, diff --git a/001075/utils_001075/_stream_nwbfile.py b/001075/utils_001075/_stream_nwbfile.py index cc92a4c9..77b3f56d 100644 --- a/001075/utils_001075/_stream_nwbfile.py +++ b/001075/utils_001075/_stream_nwbfile.py @@ -7,10 +7,11 @@ def stream_nwbfile(subject_id: str, session_id: str, session_type: Literal["imaging", "segmentation"]) -> pynwb.NWBFile: dandiset_id = "001075" + dandiset_version = "0.240930.1859" dandifile_path = f"sub-{subject_id}/sub-{subject_id}_ses-{session_id}_desc-{session_type}_ophys+ogen.nwb" dandi_client = dandi.dandiapi.DandiAPIClient() - dandiset = dandi_client.get_dandiset(dandiset_id=dandiset_id) + dandiset = dandi_client.get_dandiset(dandiset_id=dandiset_id, version_id=dandiset_version) dandifile = dandiset.get_asset_by_path(path=dandifile_path) s3_url = dandifile.get_content_url() byte_stream = remfile.File(url=s3_url) diff --git a/001084/HoweLab/001084_demo.ipynb b/001084/HoweLab/001084_demo.ipynb index 67d94de3..bc94d867 100644 --- a/001084/HoweLab/001084_demo.ipynb +++ b/001084/HoweLab/001084_demo.ipynb @@ -197,10 +197,11 @@ "client = DandiAPIClient.for_dandi_instance(\"dandi\")\n", "\n", "dandiset_id = \"001084\"\n", + "dandiset_version = \"0.241023.2011\"\n", "file_path = \"sub-DL18/sub-DL18_ses-211110_image+ophys.nwb\"\n", "\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(file_path)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(file_path)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)\n" ] }, diff --git a/001170/ReimerLab/public_demo/001170_demo.ipynb b/001170/ReimerLab/public_demo/001170_demo.ipynb index df112cd9..4ed84014 100644 --- a/001170/ReimerLab/public_demo/001170_demo.ipynb +++ b/001170/ReimerLab/public_demo/001170_demo.ipynb @@ -221,9 +221,10 @@ "from dandi.dandiapi import DandiAPIClient\n", "\n", "dandiset_id = \"001170\"\n", + "dandiset_version = \"0.260528.1016\"\n", "\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(nwbfile_path)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(nwbfile_path)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=False)\n" ] }, diff --git a/001172/HigleyLab/001172_demo.ipynb b/001172/HigleyLab/001172_demo.ipynb index 25c4bc41..688c455f 100644 --- a/001172/HigleyLab/001172_demo.ipynb +++ b/001172/HigleyLab/001172_demo.ipynb @@ -224,9 +224,10 @@ "from dandi.dandiapi import DandiAPIClient\n", "\n", "dandiset_id = \"001172\"\n", + "dandiset_version = \"0.260129.0829\"\n", "\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(nwbfile_path)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(nwbfile_path)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=False)" ] }, diff --git a/001550/PaganLab/01_behavior_demo.ipynb b/001550/PaganLab/01_behavior_demo.ipynb index 7828c8b8..1c42d6b1 100644 --- a/001550/PaganLab/01_behavior_demo.ipynb +++ b/001550/PaganLab/01_behavior_demo.ipynb @@ -195,6 +195,7 @@ "import h5py\n", "\n", "DANDISET_ID = \"001550\"\n", + "DANDISET_VERSION = \"0.260916.0811\"\n", "ASSET_PATH = \"sub-P100/sub-P100_ses-TaskSwitch6-190423a.nwb\"" ] }, @@ -219,7 +220,7 @@ "outputs": [], "source": [ "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(DANDISET_ID, \"draft\").get_asset_by_path(ASSET_PATH)\n", + " asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(ASSET_PATH)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=False)\n", "\n", "file_system = remfile.File(s3_url)\n", diff --git a/001550/PaganLab/02_optogenetics_demo.ipynb b/001550/PaganLab/02_optogenetics_demo.ipynb index a168e1e0..f2b1f498 100644 --- a/001550/PaganLab/02_optogenetics_demo.ipynb +++ b/001550/PaganLab/02_optogenetics_demo.ipynb @@ -219,11 +219,12 @@ "from pynwb import NWBHDF5IO\n", "\n", "DANDISET_ID = \"001550\"\n", + "DANDISET_VERSION = \"0.260916.0811\"\n", "ASSET_PATH = \"sub-P131/sub-P131_ses-TaskSwitch6-190815a.nwb\"\n", "\n", "# Resolve the S3 streaming URL from the DANDI archive\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(DANDISET_ID, \"draft\").get_asset_by_path(ASSET_PATH)\n", + " asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(ASSET_PATH)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)\n", "\n", "print(f\"Streaming: {s3_url[:80]}...\")\n", diff --git a/001933/DombeckLab/001933_demo.ipynb b/001933/DombeckLab/001933_demo.ipynb index 055c6f51..0bbbeb26 100644 --- a/001933/DombeckLab/001933_demo.ipynb +++ b/001933/DombeckLab/001933_demo.ipynb @@ -216,11 +216,12 @@ "from pynwb import NWBHDF5IO\n", "\n", "DANDISET_ID = \"001933\"\n", + "DANDISET_VERSION = \"0.260825.1457\"\n", "ASSET_PATH = \"sub-4007-anxa-gs/sub-4007-anxa-gs_ses-2025-08-13-0005_behavior.nwb\"\n", "\n", "# Resolve the S3 streaming URL from the DANDI archive\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(DANDISET_ID, \"draft\").get_asset_by_path(ASSET_PATH)\n", + " asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(ASSET_PATH)\n", " s3_url = asset.get_content_url(follow_redirects=1)\n", "\n", "print(f\"Streaming: {s3_url[:80]}...\")\n", diff --git a/tutorials/bcm_2024/analysis-demo.ipynb b/tutorials/bcm_2024/analysis-demo.ipynb index a3666fdf..71db3b25 100644 --- a/tutorials/bcm_2024/analysis-demo.ipynb +++ b/tutorials/bcm_2024/analysis-demo.ipynb @@ -211,9 +211,10 @@ "outputs": [], "source": [ "dandiset_id = \"000582\"\n", + "dandiset_version = \"0.251111.2151\"\n", "filepath = \"sub-10073/sub-10073_ses-17010302_behavior+ecephys.nwb\"\n", "with DandiAPIClient() as client:\n", - " asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(filepath)\n", + " asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(filepath)\n", " s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)" ] }, diff --git a/tutorials/cosyne_2023/advanced_asset_search.ipynb b/tutorials/cosyne_2023/advanced_asset_search.ipynb index 7d9a1fc2..ffc2e9de 100644 --- a/tutorials/cosyne_2023/advanced_asset_search.ipynb +++ b/tutorials/cosyne_2023/advanced_asset_search.ipynb @@ -323,7 +323,7 @@ "\n", "all_subject_ages_in_days = []\n", "\n", - "dandiset = client.get_dandiset(\"000398\")\n", + "dandiset = client.get_dandiset(\"000398\", \"0.221208.1803\")\n", "assets = list(dandiset.get_assets())\n", "for asset in tqdm(assets):\n", " raw_metadata = asset.get_raw_metadata()\n", diff --git a/tutorials/cosyne_2023/simple_dandiset_search.ipynb b/tutorials/cosyne_2023/simple_dandiset_search.ipynb index 68a8a7d5..10fa3921 100644 --- a/tutorials/cosyne_2023/simple_dandiset_search.ipynb +++ b/tutorials/cosyne_2023/simple_dandiset_search.ipynb @@ -395,7 +395,7 @@ } ], "source": [ - "dandiset = client.get_dandiset(\"000005\")\n", + "dandiset = client.get_dandiset(\"000005\", \"0.220126.1853\")\n", "female_mouse_nwb_sessions = []\n", "\n", "assets = list(dandiset.get_assets())\n", diff --git a/tutorials/neurodatarehack_2024/advanced_asset_search.ipynb b/tutorials/neurodatarehack_2024/advanced_asset_search.ipynb index 3e4052ad..2b01faf4 100644 --- a/tutorials/neurodatarehack_2024/advanced_asset_search.ipynb +++ b/tutorials/neurodatarehack_2024/advanced_asset_search.ipynb @@ -362,7 +362,7 @@ "\n", "all_subject_ages_in_days = []\n", "\n", - "dandiset = client.get_dandiset(\"000398\")\n", + "dandiset = client.get_dandiset(\"000398\", \"0.221208.1803\")\n", "assets = list(dandiset.get_assets())\n", "for asset in tqdm(assets):\n", " raw_metadata = asset.get_raw_metadata()\n", diff --git a/tutorials/neurodatarehack_2024/simple_dandiset_search.ipynb b/tutorials/neurodatarehack_2024/simple_dandiset_search.ipynb index e201081c..9185c736 100644 --- a/tutorials/neurodatarehack_2024/simple_dandiset_search.ipynb +++ b/tutorials/neurodatarehack_2024/simple_dandiset_search.ipynb @@ -395,7 +395,7 @@ } ], "source": [ - "dandiset = client.get_dandiset(\"000005\")\n", + "dandiset = client.get_dandiset(\"000005\", \"0.220126.1853\")\n", "female_mouse_nwb_sessions = []\n", "\n", "assets = list(dandiset.get_assets())\n", diff --git a/tutorials/open_data_quick_start_2026/Get-to-know-a-Dandiset.ipynb b/tutorials/open_data_quick_start_2026/Get-to-know-a-Dandiset.ipynb index e0894667..fbd03644 100644 --- a/tutorials/open_data_quick_start_2026/Get-to-know-a-Dandiset.ipynb +++ b/tutorials/open_data_quick_start_2026/Get-to-know-a-Dandiset.ipynb @@ -445,7 +445,7 @@ "outputs": [], "source": [ "# Look up a specific file asset from a different Dandiset\n", - "dandiset = client.get_dandiset(dandiset_id=\"000728\")\n", + "dandiset = client.get_dandiset(dandiset_id=\"000728\", version_id=\"0.240827.1809\")\n", "dandi_filename = \"sub-495727015/sub-495727015_ses-501559087-StimB_behavior+image+ophys.nwb\"\n", "asset = dandiset.get_asset_by_path(path=dandi_filename)\n", "\n", @@ -781,7 +781,7 @@ "outputs": [], "source": [ "# Setup streaming like we did before\n", - "ecephys_dandiset = client.get_dandiset(\"000409\", \"draft\")\n", + "ecephys_dandiset = client.get_dandiset(\"000409\", \"0.260309.1324\")\n", "\n", "subject_id = \"sub-NYU-39\"\n", "session_id = \"ses-6ed57216-498d-48a6-b48b-a243a34710ea\"\n",