Skip to content

Commit

Permalink
add dandi CLI examples to ndrh notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
stephprince committed Jul 8, 2024
1 parent 7f2f442 commit 8dd9b8b
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions HCK21_2024_Janelia_NDRH/notebooks/read_basics_and_stream.ipynb
Original file line number Diff line number Diff line change
@@ -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": {},

0 comments on commit 8dd9b8b

Please sign in to comment.