From 8dd9b8b61d3d8ca56a5367f61dcf2f4f4bfe576c Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Sun, 7 Jul 2024 23:49:41 -0400 Subject: [PATCH] add dandi CLI examples to ndrh notebook --- .../notebooks/read_basics_and_stream.ipynb | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/HCK21_2024_Janelia_NDRH/notebooks/read_basics_and_stream.ipynb b/HCK21_2024_Janelia_NDRH/notebooks/read_basics_and_stream.ipynb index 54b201f6d..256c554d9 100644 --- a/HCK21_2024_Janelia_NDRH/notebooks/read_basics_and_stream.ipynb +++ b/HCK21_2024_Janelia_NDRH/notebooks/read_basics_and_stream.ipynb @@ -76,9 +76,10 @@ "while they performed a recognition memory task. This data can be found on the [DANDI Archive](https://gui.dandiarchive.org/) in [Dandiset 000004](https://gui.dandiarchive.org/dandiset/000004).\n", "\n", "\n", - "There are multiple ways to download data from DANDI:\n", - "1. Downloading data using the DANDI Web UI\n", - "2. Downloading data programmatically" + "There are multiple ways to download data from DANDI and you do not need an account to download data:\n", + "1. Downloading data with the DANDI Web UI\n", + "2. Downloading data with the DANDI CLI\n", + "3. Downloading data with the DANDI Python API" ] }, { @@ -109,7 +110,31 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 2. Downloading data programmatically\n", + "## 2. Downloading data with the DANDI CLI\n", + "In many cases, you may want to download multiple files or an entire dataset. To do so, you can use the DANDI CLI.\n", + "\n", + "To download an entire Dandiset:\n", + "\n", + "`dandi download DANDI:000004`\n", + "\n", + "To download a single subject from a Dandiset: \n", + "\n", + "`dandi download \"https://api.dandiarchive.org/api/dandisets/000004/versions/0.220126.1852/assets/?path=sub-P14HMH\"`\n", + "\n", + "You can use the url from the web application:\n", + "\n", + "`dandi download \"https://dandiarchive.org/dandiset/000004/0.220126.1852/files?location=sub-P10HMH\"`\n", + "\n", + "To download a specific file:\n", + "\n", + "`dandi download \"https://api.dandiarchive.org/api/dandisets/000004/versions/0.220126.1852/assets/82b0a4b9-a544-49c7-9807-2166fe84b07c/download\"`\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 3. Downloading data with the DANDI Python API\n", "Alternatively, you can download data using the `DandiAPIClient` from the `dandi` Python package. Using the dandiset id and file path, we can use the dandi api to download the NWB file.\n", "\n", "You can learn more about the dandi API in the [DANDI Python API docs](https://dandi.readthedocs.io/en/stable/modref/index.html)." @@ -129,15 +154,6 @@ " download(asset.download_url, '.')" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "asset.download_url" - ] - }, { "cell_type": "markdown", "metadata": {},