Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dandi CLI examples to ndrh notebook #323

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Expand Up @@ -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"
]
},
{
Expand Down Expand Up @@ -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)."
Expand All @@ -129,15 +154,6 @@
" download(asset.download_url, '.')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"asset.download_url"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Loading