From a10bde96d90305fb6e65e33f1252a916f5355719 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Fri, 12 Apr 2024 10:32:06 -0700 Subject: [PATCH] move pynapple seaborn install to start of notebook --- Workshop_2024_BCM/houston-analysis-demo.ipynb | 92 ++++--------------- 1 file changed, 20 insertions(+), 72 deletions(-) diff --git a/Workshop_2024_BCM/houston-analysis-demo.ipynb b/Workshop_2024_BCM/houston-analysis-demo.ipynb index 41c2d9a86..80f829e93 100644 --- a/Workshop_2024_BCM/houston-analysis-demo.ipynb +++ b/Workshop_2024_BCM/houston-analysis-demo.ipynb @@ -15,7 +15,7 @@ "source": [ "First, let's import a few classes. If you are *not* running this notebook on DANDI Hub, you will need to install these packages using `pip` or your favorite Python package manager. For example:\n", "```\n", - "pip install dandi pynwb fsspec requests aiohttp matplotlib\n", + "pip install dandi pynwb fsspec requests aiohttp matplotlib pynapple seaborn\n", "```" ] }, @@ -85,7 +85,7 @@ "id": "91a4a7b1-3f61-4f04-9df0-5a8b7d2642c2", "metadata": {}, "source": [ - "There are multiple methods to stream data from NWB files. We currently recommend fsspec, but additional options are described in the [pynwb streaming tutorial](https://pynwb.readthedocs.io/en/stable/tutorials/advanced_io/streaming.html)." + "There are multiple methods to stream NWB files. We currently recommend fsspec, but additional options are described in the [pynwb streaming tutorial](https://pynwb.readthedocs.io/en/stable/tutorials/advanced_io/streaming.html)." ] }, { @@ -188,7 +188,7 @@ " \n", " 0\n", " MEC\n", - " ElectrodeGroup pynwb.ecephys.ElectrodeGroup at 0x5313095072\\nFields:\\n description: The name of the ElectrodeGroup this electrode is a part of.\\n device: EEG pynwb.device.Device at 0x5313095312\\nFields:\\n description: The device used to record EEG signals.\\n\\n location: MEC\\n\n", + " ElectrodeGroup pynwb.ecephys.ElectrodeGroup at 0x6080627152\\nFields:\\n description: The name of the ElectrodeGroup this electrode is a part of.\\n device: EEG pynwb.device.Device at 0x6080626864\\nFields:\\n description: The device used to record EEG signals.\\n\\n location: MEC\\n\n", " ElectrodeGroup\n", " \n", " \n", @@ -211,7 +211,7 @@ " \n", " 0\n", " MEC\n", - " ElectrodeGroup pynwb.ecephys.ElectrodeGroup at 0x5313095072\\nFields:\\n description: The name of the ElectrodeGroup this electrode is a part of.\\n device: EEG pynwb.device.Device at 0x5313095312\\nFields:\\n description: The device used to record EEG signals.\\n\\n location: MEC\\n\n", + " ElectrodeGroup pynwb.ecephys.ElectrodeGroup at 0x6080627152\\nFields:\\n description: The name of the ElectrodeGroup this electrode is a part of.\\n device: EEG pynwb.device.Device at 0x6080626864\\nFields:\\n description: The device used to record EEG signals.\\n\\n location: MEC\\n\n", " ElectrodeGroup\n", " \n", " \n", @@ -234,7 +234,7 @@ " \n", " 0\n", " MEC\n", - " ElectrodeGroup pynwb.ecephys.ElectrodeGroup at 0x5313095072\\nFields:\\n description: The name of the ElectrodeGroup this electrode is a part of.\\n device: EEG pynwb.device.Device at 0x5313095312\\nFields:\\n description: The device used to record EEG signals.\\n\\n location: MEC\\n\n", + " ElectrodeGroup pynwb.ecephys.ElectrodeGroup at 0x6080627152\\nFields:\\n description: The name of the ElectrodeGroup this electrode is a part of.\\n device: EEG pynwb.device.Device at 0x6080626864\\nFields:\\n description: The device used to record EEG signals.\\n\\n location: MEC\\n\n", " ElectrodeGroup\n", " \n", " \n", @@ -294,7 +294,7 @@ "

... and 4 more rows.

experiment_description: The sample includes conjunctive cells and head direction cells from layers III and V of medial entorhinal cortex and have been published in Sargolini et al. (Science, 2006).
session_id: 17010302
lab: Moser
institution: Centre for the Biology of Memory, Norwegian University of Science and Technology
" ], "text/plain": [ - "root pynwb.file.NWBFile at 0x5311550752\n", + "root pynwb.file.NWBFile at 0x6062620448\n", "Fields:\n", " acquisition: {\n", " ElectricalSeries \n", @@ -321,7 +321,7 @@ " session_description: This session includes spike and position times for recorded cells from a Long Evans rat that was running in a 1 x 1 meter enclosure. The cells were recorded in the dorsocaudal 25% portion of the medial entorhinal cortex (MEC).Position is given for two LEDs to enable calculation of head direction.\n", " session_id: 17010302\n", " session_start_time: 1900-01-01 00:00:00+01:00\n", - " subject: subject pynwb.file.Subject at 0x5312899136\n", + " subject: subject pynwb.file.Subject at 0x6051471456\n", "Fields:\n", " age: P3M/P5M\n", " age__reference: birth\n", @@ -400,7 +400,7 @@ "

subject (Subject)

age: P3M/P5M
age__reference: birth
description: A Long Evans rat.
sex: M
species: Rattus norvegicus
subject_id: 10073
weight: 0.35/0.45
" ], "text/plain": [ - "subject pynwb.file.Subject at 0x5312899136\n", + "subject pynwb.file.Subject at 0x6051471456\n", "Fields:\n", " age: P3M/P5M\n", " age__reference: birth\n", @@ -476,7 +476,7 @@ "

SpatialSeriesLED1 (SpatialSeries)

resolution: -1.0
comments: no comments
description: Position (x, y) for the first tracking LED.
conversion: 0.01
offset: 0.0
unit: meters
data
timestamps
timestamps_unit: seconds
interval: 1
reference_frame: (0,0) is not known.
" ], "text/plain": [ - "SpatialSeriesLED1 pynwb.behavior.SpatialSeries at 0x5309434624\n", + "SpatialSeriesLED1 pynwb.behavior.SpatialSeries at 0x6058780640\n", "Fields:\n", " comments: no comments\n", " conversion: 0.01\n", @@ -804,7 +804,7 @@ "

... and 4 more rows.

" ], "text/plain": [ - "units pynwb.misc.Units at 0x5313096848\n", + "units pynwb.misc.Units at 0x6062849200\n", "Fields:\n", " colnames: ['unit_name' 'spike_times' 'histology' 'hemisphere' 'depth']\n", " columns: (\n", @@ -1086,59 +1086,7 @@ "id": "1eb0cc7d-87cb-4919-a4d7-b7478614477e", "metadata": {}, "source": [ - "[Pynapple](https://pynapple-org.github.io/pynapple/) is a light-weight python library for neurophysiological data analysis that accepts NWB files as input. Let's install pynapple and a plotting package, seaborn, using `pip`." - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "a758f310-dc9b-41b8-8abd-7abd3b5d8558", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: pynapple in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (0.6.1)\n", - "Requirement already satisfied: seaborn in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (0.13.2)\n", - "Requirement already satisfied: pandas>1.0.3 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from pynapple) (2.2.1)\n", - "Requirement already satisfied: numpy>=1.17.4 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from pynapple) (1.26.4)\n", - "Requirement already satisfied: scipy>=1.3.2 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from pynapple) (1.13.0)\n", - "Requirement already satisfied: numba>=0.46.0 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from pynapple) (0.59.1)\n", - "Requirement already satisfied: pynwb>=2.0.0 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from pynapple) (2.6.0)\n", - "Requirement already satisfied: tabulate in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from pynapple) (0.9.0)\n", - "Requirement already satisfied: h5py in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from pynapple) (3.10.0)\n", - "Requirement already satisfied: rich in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from pynapple) (13.7.1)\n", - "Requirement already satisfied: matplotlib!=3.6.1,>=3.4 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from seaborn) (3.8.4)\n", - "Requirement already satisfied: contourpy>=1.0.1 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (1.2.1)\n", - "Requirement already satisfied: cycler>=0.10 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (0.12.1)\n", - "Requirement already satisfied: fonttools>=4.22.0 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (4.50.0)\n", - "Requirement already satisfied: kiwisolver>=1.3.1 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (1.4.5)\n", - "Requirement already satisfied: packaging>=20.0 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (24.0)\n", - "Requirement already satisfied: pillow>=8 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (10.3.0)\n", - "Requirement already satisfied: pyparsing>=2.3.1 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (3.1.2)\n", - "Requirement already satisfied: python-dateutil>=2.7 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (2.9.0.post0)\n", - "Requirement already satisfied: llvmlite<0.43,>=0.42.0dev0 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from numba>=0.46.0->pynapple) (0.42.0)\n", - "Requirement already satisfied: pytz>=2020.1 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from pandas>1.0.3->pynapple) (2024.1)\n", - "Requirement already satisfied: tzdata>=2022.7 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from pandas>1.0.3->pynapple) (2024.1)\n", - "Requirement already satisfied: hdmf>=3.12.2 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from pynwb>=2.0.0->pynapple) (3.13.0)\n", - "Requirement already satisfied: setuptools in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from pynwb>=2.0.0->pynapple) (68.2.2)\n", - "Requirement already satisfied: markdown-it-py>=2.2.0 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from rich->pynapple) (3.0.0)\n", - "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from rich->pynapple) (2.17.2)\n", - "Requirement already satisfied: jsonschema>=2.6.0 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from hdmf>=3.12.2->pynwb>=2.0.0->pynapple) (4.21.1)\n", - "Requirement already satisfied: ruamel-yaml>=0.16 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from hdmf>=3.12.2->pynwb>=2.0.0->pynapple) (0.18.6)\n", - "Requirement already satisfied: mdurl~=0.1 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from markdown-it-py>=2.2.0->rich->pynapple) (0.1.2)\n", - "Requirement already satisfied: six>=1.5 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from python-dateutil>=2.7->matplotlib!=3.6.1,>=3.4->seaborn) (1.16.0)\n", - "Requirement already satisfied: attrs>=22.2.0 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from jsonschema>=2.6.0->hdmf>=3.12.2->pynwb>=2.0.0->pynapple) (23.2.0)\n", - "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from jsonschema>=2.6.0->hdmf>=3.12.2->pynwb>=2.0.0->pynapple) (2023.12.1)\n", - "Requirement already satisfied: referencing>=0.28.4 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from jsonschema>=2.6.0->hdmf>=3.12.2->pynwb>=2.0.0->pynapple) (0.34.0)\n", - "Requirement already satisfied: rpds-py>=0.7.1 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from jsonschema>=2.6.0->hdmf>=3.12.2->pynwb>=2.0.0->pynapple) (0.18.0)\n", - "Requirement already satisfied: ruamel.yaml.clib>=0.2.7 in /Users/smprince/anaconda3/envs/houston-workshop/lib/python3.12/site-packages (from ruamel-yaml>=0.16->hdmf>=3.12.2->pynwb>=2.0.0->pynapple) (0.2.8)\n" - ] - } - ], - "source": [ - "!pip install pynapple seaborn" + "[Pynapple](https://pynapple-org.github.io/pynapple/) is a light-weight python library for neurophysiological data analysis that accepts NWB files as input." ] }, { @@ -1151,7 +1099,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 20, "id": "61cd613d-db4d-4608-b71f-2d97a37fb802", "metadata": {}, "outputs": [ @@ -1169,7 +1117,7 @@ "┕━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━┙" ] }, - "execution_count": 21, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -1196,7 +1144,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 21, "id": "b4957059-c4c0-4c53-99c9-e1855c91d665", "metadata": {}, "outputs": [ @@ -1215,7 +1163,7 @@ " 7 1.47 t4c1 MEC LII 0.0024" ] }, - "execution_count": 22, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -1235,7 +1183,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 22, "id": "4e24caa5-a4f7-4b2e-87a7-aa085295ae41", "metadata": {}, "outputs": [ @@ -1258,7 +1206,7 @@ "dtype: float64, shape: (30000, 2)" ] }, - "execution_count": 23, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -1278,7 +1226,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 23, "id": "ff2fedad-370e-4bca-a000-6268d8fca444", "metadata": {}, "outputs": [ @@ -1330,7 +1278,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 24, "id": "24c52805-0a0a-4354-a60c-cef9ab539728", "metadata": {}, "outputs": [ @@ -1372,7 +1320,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 25, "id": "ecaa28a4-f9d6-466d-ba76-53e690bfdedc", "metadata": {}, "outputs": [],