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

Explictly import Na,K,Leak from pospischil #552

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
98 changes: 49 additions & 49 deletions docs/tutorials/00_jaxley_api.ipynb

Large diffs are not rendered by default.

94 changes: 47 additions & 47 deletions docs/tutorials/01_morph_neurons.ipynb

Large diffs are not rendered by default.

78 changes: 39 additions & 39 deletions docs/tutorials/02_small_network.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"cells": [
{
"cell_type": "markdown",
"id": "2ec9dafe",
"id": "b81099a7",
"metadata": {},
"source": [
"# Network simulations in Jaxley"
]
},
{
"cell_type": "markdown",
"id": "55ee1cd1",
"id": "db86d64f",
"metadata": {},
"source": [
"In this tutorial, you will learn how to:\n",
Expand Down Expand Up @@ -48,7 +48,7 @@
},
{
"cell_type": "markdown",
"id": "8523c3de",
"id": "0d06fdbf",
"metadata": {},
"source": [
"In the previous tutorial, you learned how to build single cells with morphological detail, how to insert stimuli and recordings, and how to run a first simulation. In this tutorial, we will define networks of multiple cells and connect them with synapses. Let's get started:"
Expand All @@ -57,7 +57,7 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "de136490",
"id": "6be2c63c",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -71,14 +71,14 @@
"from jax import jit\n",
"\n",
"import jaxley as jx\n",
"from jaxley.channels import Na, K, Leak\n",
"from jaxley.channels.pospischil import Na, K, Leak\n",
"from jaxley.synapses import IonotropicSynapse\n",
"from jaxley.connect import fully_connect, connect"
]
},
{
"cell_type": "markdown",
"id": "cf137e23",
"id": "d1d8cbcb",
"metadata": {},
"source": [
"### Define the network\n",
Expand All @@ -89,7 +89,7 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "35258917",
"id": "86658cc6",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -100,7 +100,7 @@
},
{
"cell_type": "markdown",
"id": "fe0920be",
"id": "de32deb1",
"metadata": {},
"source": [
"We can assemble multiple cells into a network by using `jx.Network`, which takes a list of `jx.Cell`s. Here, we assemble 11 cells into a network:"
Expand All @@ -109,7 +109,7 @@
{
"cell_type": "code",
"execution_count": 3,
"id": "6a3c676e",
"id": "9d6687b5",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -119,7 +119,7 @@
},
{
"cell_type": "markdown",
"id": "90445c64",
"id": "47430928",
"metadata": {},
"source": [
"At this point, we can already visualize this network:"
Expand All @@ -128,7 +128,7 @@
{
"cell_type": "code",
"execution_count": 5,
"id": "86ea234a",
"id": "b8544018",
"metadata": {},
"outputs": [
{
Expand All @@ -153,15 +153,15 @@
},
{
"cell_type": "markdown",
"id": "d7d9fc7d",
"id": "3974b1f6",
"metadata": {},
"source": [
"_Note: you can use `move_to` to have more control over the location of cells, e.g.: `network.cell(i).move_to(x=0, y=200)`._"
]
},
{
"cell_type": "markdown",
"id": "7201bb0d",
"id": "add93e88",
"metadata": {},
"source": [
"As you can see, the neurons are not connected yet. Let's fix this by connecting neurons with synapses. We will build a network consisting of two layers: 10 neurons in the input layer and 1 neuron in the output layer.\n",
Expand All @@ -172,7 +172,7 @@
{
"cell_type": "code",
"execution_count": 6,
"id": "429054e3",
"id": "bd2d4fe2",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -183,7 +183,7 @@
},
{
"cell_type": "markdown",
"id": "99ea65dd",
"id": "d81cf79c",
"metadata": {},
"source": [
"Let's visualize this again:"
Expand All @@ -192,7 +192,7 @@
{
"cell_type": "code",
"execution_count": 9,
"id": "28f133ed",
"id": "b41bef87",
"metadata": {},
"outputs": [
{
Expand All @@ -213,7 +213,7 @@
},
{
"cell_type": "markdown",
"id": "843ffa0b",
"id": "624549bf",
"metadata": {},
"source": [
"As you can see, the `full_connect` method inserted one synapse (in blue) from every neuron in the first layer to the output neuron. The `fully_connect` method builds this synapse from the zero-eth compartment and zero-eth branch of the presynaptic neuron onto a random branch of the postsynaptic neuron. If you want more control over the pre- and post-synaptic branches, you can use the `connect` method:"
Expand All @@ -222,7 +222,7 @@
{
"cell_type": "code",
"execution_count": 10,
"id": "2508510c",
"id": "63a8b1b3",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -234,7 +234,7 @@
{
"cell_type": "code",
"execution_count": 11,
"id": "60790ead",
"id": "19bcadcc",
"metadata": {},
"outputs": [
{
Expand All @@ -255,15 +255,15 @@
},
{
"cell_type": "markdown",
"id": "08422604",
"id": "79841345",
"metadata": {},
"source": [
"### Inspecting and changing synaptic parameters"
]
},
{
"cell_type": "markdown",
"id": "8515ca40",
"id": "bfa8b06d",
"metadata": {},
"source": [
"You can inspect synaptic parameters via the `.edges` attribute:"
Expand All @@ -272,7 +272,7 @@
{
"cell_type": "code",
"execution_count": 12,
"id": "b8f05aa0",
"id": "0b2c4040",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -545,7 +545,7 @@
},
{
"cell_type": "markdown",
"id": "4c57d8f2",
"id": "791c9ca9",
"metadata": {},
"source": [
"To modify a parameter of all synapses you can again use `.set()`:"
Expand All @@ -554,7 +554,7 @@
{
"cell_type": "code",
"execution_count": 13,
"id": "7d295f14",
"id": "a83d92a5",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -563,7 +563,7 @@
},
{
"cell_type": "markdown",
"id": "d74dafa0",
"id": "799a169b",
"metadata": {},
"source": [
"To modify individual syanptic parameters, use the `.select()` method. Below, we change the values of the first two synapses:"
Expand All @@ -572,7 +572,7 @@
{
"cell_type": "code",
"execution_count": 14,
"id": "f7ba4d28",
"id": "ca7e2ec9",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -581,23 +581,23 @@
},
{
"cell_type": "markdown",
"id": "a9d4f9fc",
"id": "652f56b4",
"metadata": {},
"source": [
"For more details on how to flexibly set synaptic parameters (e.g., by cell type, or by pre-synaptic cell index,...), see [this tutorial](https://jaxley.readthedocs.io/en/latest/tutorials/09_advanced_indexing.html)."
]
},
{
"cell_type": "markdown",
"id": "fa3826a7",
"id": "447b23fa",
"metadata": {},
"source": [
"### Stimulating, recording, and simulating the network"
]
},
{
"cell_type": "markdown",
"id": "4cdff397",
"id": "3a084fd7",
"metadata": {},
"source": [
"We will now set up a simulation of the network. This works exactly as it does for single neurons:"
Expand All @@ -606,7 +606,7 @@
{
"cell_type": "code",
"execution_count": 15,
"id": "70d3f34a",
"id": "b937dc28",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -623,7 +623,7 @@
{
"cell_type": "code",
"execution_count": 16,
"id": "4eeb188d",
"id": "69f7e3ba",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -632,7 +632,7 @@
},
{
"cell_type": "markdown",
"id": "544cdeef",
"id": "53f074d1",
"metadata": {},
"source": [
"As a simple example, we insert sodium, potassium, and leak into every compartment of every cell of the network."
Expand All @@ -641,7 +641,7 @@
{
"cell_type": "code",
"execution_count": 17,
"id": "22a17a74",
"id": "4d1a2844",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -652,7 +652,7 @@
},
{
"cell_type": "markdown",
"id": "e969f523",
"id": "f06115d7",
"metadata": {},
"source": [
"We stimulate every neuron in the input layer and record the voltage from the output neuron:"
Expand All @@ -661,7 +661,7 @@
{
"cell_type": "code",
"execution_count": 18,
"id": "e66b5f02",
"id": "7a0f4924",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -694,7 +694,7 @@
},
{
"cell_type": "markdown",
"id": "e8ae006c",
"id": "0e72be62",
"metadata": {},
"source": [
"Finally, we can again run the network simulation and plot the result:"
Expand All @@ -703,7 +703,7 @@
{
"cell_type": "code",
"execution_count": 19,
"id": "71146fc4",
"id": "9ebd5787",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -713,7 +713,7 @@
{
"cell_type": "code",
"execution_count": 20,
"id": "b6905f50",
"id": "fee2609d",
"metadata": {},
"outputs": [
{
Expand All @@ -734,7 +734,7 @@
},
{
"cell_type": "markdown",
"id": "57faa9ca",
"id": "262493ff",
"metadata": {},
"source": [
"That's it! You now know how to simulate networks of morphologically detailed neurons. We recommend that you now have a look at how you can [speed up your simulation](https://jaxley.readthedocs.io/en/latest/tutorials/04_jit_and_vmap.html). To learn more about handling synaptic parameters, we recommend to check out [this tutorial](https://jaxley.readthedocs.io/en/latest/tutorials/09_advanced_indexing.html)."
Expand Down
Loading