diff --git a/doc/gui/tutorial_erp.ipynb b/doc/gui/tutorial_erp.ipynb index ab1e67b0d0..c11f584aa1 100644 --- a/doc/gui/tutorial_erp.ipynb +++ b/doc/gui/tutorial_erp.ipynb @@ -439,11 +439,11 @@ ], "metadata": { "finalized": { - "timestamp": 1659128328299, - "trusted": true + "timestamp": 1659922241581, + "trusted": false }, "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -457,7 +457,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.7.4" }, "require": { "paths": { diff --git a/doc/gui/tutorial_gamma.ipynb b/doc/gui/tutorial_gamma.ipynb new file mode 100644 index 0000000000..9898214529 --- /dev/null +++ b/doc/gui/tutorial_gamma.ipynb @@ -0,0 +1,496 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "e12a66a7", + "metadata": {}, + "outputs": [], + "source": [ + "%load_ext autoreload\n", + "%autoreload 2" + ] + }, + { + "cell_type": "markdown", + "id": "2b8ad740", + "metadata": {}, + "source": [ + "# Gamma rhythms (30-80 Hz)" + ] + }, + { + "cell_type": "markdown", + "id": "7369753b", + "metadata": {}, + "source": [ + "## Getting Started\n", + "\n", + "In order to understand the workflow and initial parameter sets provided with this tutorial, we must first briefly describe prior studies on the mechanistic origin of gamma rhythms, including our prior modeling work that led to the creation of the parameter sets you will work with [1].\n", + "\n", + "Gamma rhythms can encompass a wide band of frequencies from 30-150 Hz. Here, we will focus on the generation of so called low gamma rhythms in the 30-80 Hz range. It has been well established through experiments and computational modeling that these rhythms can emerge in local spiking networks through interactions of excitatory cell and inhibitory cell interactions, with the period of the oscillation set by the time constant of decay of GABAA-mediated inhibitory currents [2–4], a mechanism that has been referred to as pyramidal-interneuronal gamma (PING). In normal regimes, the decay time constant of GABAA-mediated synapses (around 25 ms) bounds oscillations to the low gamma frequency band (around 40 Hz).\n", + "\n", + "In general, PING rhythms are initiated by “excitation” to the excitatory (E) cells that causes spiking, which in turn synaptically activates a spiking population of inhibitory (I) cells. In turn, these I cells inhibit the E cells, preventing further E cell activity until the E cells can overcome the effects of the inhibition (~25 ms later). The pattern is repeated, creating a gamma frequency oscillation (around 40 Hz, 40 spikes/second). This general principle is schematically described in Figure 1 below. The frequency of the rhythm is paced by this time constant of decay of inhibition, which is mediated by strong GABA-A currents, as well as the excitability of the E cells (if the E cells are very excitable, they can fire before the inhibition has completely worn off, and the oscillation will be faster).\n", + "\n", + "\n", + "![](https://raw.githubusercontent.com/jonescompneurolab/hnn-tutorials/master/gamma/images/image19.png)\n", + "
Schematic illustration of the circuit mechanisms underlying PING rhythms.
\n", + "\n", + "In this tutorial, we will explore the generation of PING rhythms in the HNN model. We will provide example parameter files and walk through simulations that generate low-frequency gamma activity in both Layers 2/3 and Layer 5, as in [1]. This tutorial relies on a different type of exogenous drive to “activate” the local network than the other tutorials. Here, the necessary excitation to generate spiking in the pyramidal neurons (E cells) that initiates the rhythm (see PING description above) is provided by a continuous train of action potentials with a Poisson distribution (Poisson Input) that activate post-synaptic excitatory AMPA synapses on the pyramidal neurons. This Poisson drive causes the pyramidal neurons to fire, dependent on the chosen conductance of the AMPA currents. The inhibition in the network is strong enough to overcome the Poisson drive and entrain the network spiking into a gamma frequency rhythm.\n", + "\n", + "Of note, gamma rhythms can be generated by circuit mechanisms other than PING, including subthreshold rhythmic exogenous drive. Lee and Jones (2013) examined various mechanisms of generation of gamma activity and described ways to distinguish the mechanisms of generation based on features of current dipole signal [1]. After completing this tutorial, we encourage you to explore alternate mechanisms of gamma generation and to compare to your own gamma data." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "2eba55b1-2ab7-4f07-a76c-34f5a184da4d", + "metadata": {}, + "outputs": [], + "source": [ + "import time\n", + "from hnn_core.gui.gui import HNNGUI\n", + "from ipywidgets import Output\n", + "from IPython.display import Javascript\n", + "\n", + "# do not mix this with GUI operations\n", + "gui = HNNGUI()" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "norwegian-angola", + "metadata": { + "require": [ + "html2canvas" + ], + "scrolled": true + }, + "outputs": [], + "source": [ + "# In practice, set return_layout to false to show the dashboard\n", + "# gui.compose()\n", + "gui.compose(return_layout=False)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "612eb831", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "gui.capture()" + ] + }, + { + "cell_type": "markdown", + "id": "b2f48fa3", + "metadata": {}, + "source": [ + "\n", + "\n", + "## Load/view parameters to define network structure & to “activate” the network\n", + "\n", + "An initial parameter set that will simulate PING rhythms as described in the Getting Started section above can be downloaded via the following hyperlink: [gamma_L5weak_L2weak.param](https://github.com/jonescompneurolab/hnn/blob/master/param/gamma_L5weak_L2weak.param). This file can also be found in the HNN param subfolder.\n", + "\n", + "The template cortical column networks structure for this simulation is described in the Overview and What’s Under the Hood sections of the HNN webpage. Several of the network parameter (i.e., local excitatory and inhibitory connection strengths) will be adjusted in this tutorial, but we will begin by describing the inputs the “activate” the network.\n", + "\n", + "To load the initial parameter set, navigate to the HNN GUI and click::\n", + "\n", + " Load network" + ] + }, + { + "cell_type": "markdown", + "id": "061faff2", + "metadata": {}, + "source": [ + "Once you have this param file downloaded and existing drive deleted, upload the file to the GUI through the `Load network` button." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "9e078bf6", + "metadata": {}, + "outputs": [], + "source": [ + "gui._simulate_upload_file(\"https://raw.githubusercontent.com/jonescompneurolab/hnn/master/param/ERPYes100Trials.param\")" + ] + }, + { + "cell_type": "markdown", + "id": "0039c446", + "metadata": {}, + "source": [ + "In this simulation, the network will be “activated” with excitatory AMPA synaptic input, distributed in time as a Poisson process and given to somas of the pyramidal neurons in Layer 2/3 and Layer 5. This noisy input will generate spiking activity in the pyramidal neurons that can initiate the PING rhythm.\n", + "\n", + "To view the parameters that “activate” the network and initiate a gamma rhythm, return to the main GUI window and click:\n", + "\n", + " Drives" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "27f3897d", + "metadata": {}, + "outputs": [], + "source": [ + "gui._simulate_left_tab_click(\"Drives\")" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "95462496", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "gui.capture()" + ] + }, + { + "cell_type": "markdown", + "id": "a30315d3", + "metadata": {}, + "source": [ + "In this parameter file, all synaptic connections within the network are turned off (weight = 0 ), except for reciprocal connections between the excitatory (AMPA only) and inhibitory (GABAA only) cells within the same layer. In other words, the Layer 2/3 and Layer 5 networks are not connected to each other (see the Under the Hood section of the HNN website for further details on connectivity structure). This is not biologically realistic, but was done for illustration purposes and to prevent pyramidal-to-pyramidal interactions from disrupting the gamma rhythm.\n", + "\n", + "To view the local network connection parameters, click::\n", + "\n", + " Cell connectivity" + ] + }, + { + "cell_type": "markdown", + "id": "05021d92", + "metadata": {}, + "source": [ + "You should see the values of adjustable parameters displayed as in the dialog boxes below. Notice that the Layer 2/3 and Layer 5 are not connected to each other, the inhibitory conductance weights within layers are stronger than the excitatory conductances, and there are also strong inhibitory-to-inhibitory connections (i.e., basket-to-basket). This strong autonomous inhibition will cause synchrony among the basket cells, and hence strong inhibition onto the pyramidal neurons (note: this synapse was not depicted in Figure 1)." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "8a5db7b5", + "metadata": {}, + "outputs": [], + "source": [ + "gui._simulate_left_tab_click(\"Cell connectivity\")" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "cb8b6a74", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "gui.capture()" + ] + }, + { + "cell_type": "markdown", + "id": "1863124e", + "metadata": {}, + "source": [ + "## 2. Run the simulation and visualize net current dipole" + ] + }, + { + "cell_type": "markdown", + "id": "9f00474c", + "metadata": {}, + "source": [ + "To run this simulation, click \"Run\":" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "66448a54", + "metadata": {}, + "outputs": [], + "source": [ + "gui.run_button.click()" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "8e73e1df", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "gui.capture()" + ] + }, + { + "cell_type": "markdown", + "id": "94114ab2", + "metadata": {}, + "source": [ + "In this simulation, a single histogram displaying the Poisson drive to the excitatory cells is shown in the top panel, displaying no clear rhythmicity at the gamma frequency. The Poisson drive provided causes pyramidal cells to fire, which in-turn cause the inhibitory neurons to fire, and feedback inhibition from the interneurons to the pyramidal cells generates a regular gamma rhythm via the PING mechanism described above (the process to view the spiking activity is described in Section 3 below). In this example, the rhythmic dipole displays sharp downward deflections, reflective of the strong inhibition onto the pyramidal neuron somas, which pulls current flow down the dendrites. The corresponding spectrogram confirms that, for this parameter set, the dipole signal contains strong oscillatory components in the gamma range (~50 Hz)." + ] + }, + { + "cell_type": "markdown", + "id": "9fb70da1", + "metadata": {}, + "source": [ + "## 3. Calculating and Viewing Spiking Activity and Power Spectral Density (PSD)" + ] + }, + { + "cell_type": "markdown", + "id": "bd675179", + "metadata": {}, + "source": [ + "To view the spiking activity generated by the different neuron populations in the network, from the navigation bar of the main GUI window, select \"spikes\" from the dropdown menu in the visualization window:" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "67a08b9d", + "metadata": {}, + "outputs": [], + "source": [ + "gui._simulate_switch_plot_type(1, \"spikes\")" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "93c58948", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "gui.capture()" + ] + }, + { + "cell_type": "markdown", + "id": "1157f067", + "metadata": {}, + "source": [ + "Notice that the excitatory pyramidal neurons in each layer (green and red dots / lines) fire before the inhibitory basket cells in each layer (white, blue dots / lines). The pyramidal neuron firing drives the basket cells to fire. The basket cells are highly synchronous due to the strong inhibitory-to-inhibitory connections. The basket cells then prevent the pyramidal neurons from firing for ~25 ms, generating the PING rhythms. The line-plots, which show spike counts over time, also demonstrate rhythmicity. The pyramidal neurons are firing periodically, but with lower synchrony due to the Poisson drive (orange histogram at top), which creates randomized spike times across the populations (once the inhibition sufficiently wears off). This type of dispersed pyramidal neuron firing is considered “weak” PING - hence the parameter file name including weak.\n", + "\n", + "We can further confirm that this oscillation is in the gamma frequency range by viewing the power spectral density of the current dipole signal (average spectrogram across time)." + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "d35b38b7", + "metadata": {}, + "outputs": [], + "source": [ + "gui._simulate_switch_plot_type(1, \"PSD\")" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "e539bbf4", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "gui.capture()" + ] + }, + { + "cell_type": "markdown", + "id": "d6efb437", + "metadata": {}, + "source": [ + "Notice that the power in the gamma band is much smaller in Layer 2/3 than in Layer 5. This is reflective, in part, of the fact that the length of the Layer 2/3 pyramidal neurons is smaller than Layer 5, and hence Layer 2/3 cells produce smaller current dipole moments that can be masked by activity in Layer 5 (see [1] for further discussion)." + ] + }, + { + "cell_type": "markdown", + "id": "4872802a", + "metadata": {}, + "source": [ + "## 4. Adjusting parameters\n", + "\n", + "In the following simulations, we explore parameter alterations influencing the generation of gamma rhythms.\n", + "\n", + "Also note that before running/loading new simulations, we first remove the prior simulation by pressing the “Remove Simulation” button at the bottom of the GUI. If we do not do this, both simulation dipoles are displayed (old simulation with dotted line, new simulation with solid line; see “Tour of the GUI” for more details on simulation control)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b69240c5", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "finalized": { + "timestamp": 1659923297915, + "trusted": false + }, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.4" + }, + "require": { + "paths": { + "html2canvas": "https://html2canvas.hertzen.com/dist/html2canvas" + }, + "shim": {} + }, + "vscode": { + "interpreter": { + "hash": "43b52e66020a3206304124443c3dbfb478b19fdebbaacdf952e81bd31b11f0ba" + } + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}