Skip to content

Commit

Permalink
clearer wording for some tutorials (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldeistler authored Nov 14, 2024
1 parent ab50924 commit 99a73a3
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 203 deletions.
90 changes: 45 additions & 45 deletions docs/tutorials/01_morph_neurons.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"cells": [
{
"cell_type": "markdown",
"id": "3cb59f08",
"id": "23de17f3",
"metadata": {},
"source": [
"# Basics of Jaxley"
]
},
{
"cell_type": "markdown",
"id": "9cab6953",
"id": "f3ec2d4a",
"metadata": {},
"source": [
"In this tutorial, you will learn how to:\n",
Expand Down Expand Up @@ -61,7 +61,7 @@
},
{
"cell_type": "markdown",
"id": "031ce290",
"id": "811381aa",
"metadata": {},
"source": [
"First, we import the relevant libraries:"
Expand All @@ -70,7 +70,7 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "e1f3cf24",
"id": "f7b6139b",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -91,15 +91,15 @@
},
{
"cell_type": "markdown",
"id": "010e823e",
"id": "80c1db84",
"metadata": {},
"source": [
"We will now build our first cell in `Jaxley`. You have two options to do this: you can either build a cell bottom-up by defining the morphology yourselve, or you can [load cells from SWC files](https://jaxley.readthedocs.io/en/latest/tutorials/08_importing_morphologies.html).\n"
]
},
{
"cell_type": "markdown",
"id": "22c43455",
"id": "b26c95af",
"metadata": {},
"source": [
"### Define the cell from scratch\n",
Expand All @@ -110,7 +110,7 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "145ff540",
"id": "e0209d33",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -120,7 +120,7 @@
},
{
"cell_type": "markdown",
"id": "bb109c89",
"id": "a29cbb32",
"metadata": {},
"source": [
"Next, we can assemble branches into a cell. To do so, we have to define for each branch what its parent branch is. A `-1` entry means that this branch does not have a parent."
Expand All @@ -129,7 +129,7 @@
{
"cell_type": "code",
"execution_count": 3,
"id": "a069d64b",
"id": "ebcf5e9f",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -139,15 +139,15 @@
},
{
"cell_type": "markdown",
"id": "f621d887",
"id": "3c674521",
"metadata": {},
"source": [
"To learn more about `Compartment`s, `Branch`es, and `Cell`s, see [this tutorial](https://jaxley.readthedocs.io/en/latest/tutorials/00_jaxley_api.html)."
]
},
{
"cell_type": "markdown",
"id": "21af5a58",
"id": "c697cd51",
"metadata": {},
"source": [
"### Read the cell from an SWC file\n",
Expand All @@ -161,15 +161,15 @@
},
{
"cell_type": "markdown",
"id": "6f23848c",
"id": "1a7fb15c",
"metadata": {},
"source": [
"### Visualize the cells"
]
},
{
"cell_type": "markdown",
"id": "533c3adb",
"id": "3cd044a6",
"metadata": {},
"source": [
"Cells can be visualized as follows:"
Expand All @@ -178,7 +178,7 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "eeb15b15",
"id": "eadf3c25",
"metadata": {},
"outputs": [
{
Expand All @@ -201,7 +201,7 @@
},
{
"cell_type": "markdown",
"id": "13f7151d",
"id": "833e4597",
"metadata": {},
"source": [
"### Insert mechanisms\n",
Expand All @@ -212,7 +212,7 @@
{
"cell_type": "code",
"execution_count": 5,
"id": "802b59c4",
"id": "728984f3",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -223,7 +223,7 @@
},
{
"cell_type": "markdown",
"id": "ffbeb0a8",
"id": "c750def0",
"metadata": {},
"source": [
"Once the cell is created, we can inspect its `.nodes` attribute which lists all properties of the cell:"
Expand All @@ -232,7 +232,7 @@
{
"cell_type": "code",
"execution_count": 6,
"id": "255e0e70",
"id": "b147d551",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -588,7 +588,7 @@
},
{
"cell_type": "markdown",
"id": "650a2692",
"id": "09315df3",
"metadata": {},
"source": [
"_Note that `Jaxley` uses the same units as the `NEURON` simulator, which are listed [here](https://www.neuron.yale.edu/neuron/static/docs/units/unitchart.html)._\n",
Expand All @@ -599,7 +599,7 @@
{
"cell_type": "code",
"execution_count": 7,
"id": "e2ef065e",
"id": "54bd54f1",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -731,7 +731,7 @@
},
{
"cell_type": "markdown",
"id": "825fb9ce",
"id": "04a85440",
"metadata": {},
"source": [
"The easiest way to know which branch is the 1st branch (or, e.g., the zero-eth compartment of the 1st branch) is to plot it in a different color:"
Expand All @@ -740,7 +740,7 @@
{
"cell_type": "code",
"execution_count": 8,
"id": "e6d9f62b",
"id": "643ea991",
"metadata": {},
"outputs": [
{
Expand All @@ -763,15 +763,15 @@
},
{
"cell_type": "markdown",
"id": "415a0534",
"id": "b1cb9b9b",
"metadata": {},
"source": [
"More background and features on indexing as `cell.branch(0)` is in [this tutorial](https://jaxley.readthedocs.io/en/latest/tutorials/00_jaxley_api.html)."
]
},
{
"cell_type": "markdown",
"id": "d2c05ca5",
"id": "fea0d9ea",
"metadata": {},
"source": [
"### Change parameters of the cell\n",
Expand All @@ -782,7 +782,7 @@
{
"cell_type": "code",
"execution_count": 9,
"id": "1b2df394",
"id": "d34cf35c",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -791,7 +791,7 @@
},
{
"cell_type": "markdown",
"id": "17104361",
"id": "e25971ab",
"metadata": {},
"source": [
"And we can again inspect the `.nodes` to make sure that the axial resistivity indeed changed:"
Expand All @@ -800,7 +800,7 @@
{
"cell_type": "code",
"execution_count": 10,
"id": "130c13e5",
"id": "16b25603",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -932,16 +932,16 @@
},
{
"cell_type": "markdown",
"id": "9967ca4c",
"id": "b37a14b7",
"metadata": {},
"source": [
"In a similar way, you can modify channel properties or initial states (all units are the same as for the `NEURON` simulator, which are listed [here](https://www.neuron.yale.edu/neuron/static/docs/units/unitchart.html)):"
"In a similar way, you can modify channel properties or initial states (units are again [here](https://www.neuron.yale.edu/neuron/static/docs/units/unitchart.html)):"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "b4da8cba",
"id": "bb0bb6b9",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -951,7 +951,7 @@
},
{
"cell_type": "markdown",
"id": "d559f3e9",
"id": "6bc4c09f",
"metadata": {},
"source": [
"### Stimulate the cell\n",
Expand All @@ -962,7 +962,7 @@
{
"cell_type": "code",
"execution_count": 12,
"id": "7655a254",
"id": "e3f56a7a",
"metadata": {},
"outputs": [
{
Expand All @@ -988,7 +988,7 @@
},
{
"cell_type": "markdown",
"id": "e367d928",
"id": "6e5cc5a0",
"metadata": {},
"source": [
"We then stimulate one of the compartments of the cell with this step current:"
Expand All @@ -997,7 +997,7 @@
{
"cell_type": "code",
"execution_count": 13,
"id": "9c7ec374",
"id": "24582568",
"metadata": {},
"outputs": [
{
Expand All @@ -1015,15 +1015,15 @@
},
{
"cell_type": "markdown",
"id": "fd0fbd52",
"id": "cf4723f6",
"metadata": {},
"source": [
"### Define recordings"
]
},
{
"cell_type": "markdown",
"id": "a3a04360",
"id": "a7ef6084",
"metadata": {},
"source": [
"Next, you have to define where to record the voltage. In this case, we will record the voltage at two locations:"
Expand All @@ -1032,7 +1032,7 @@
{
"cell_type": "code",
"execution_count": 14,
"id": "790ab537",
"id": "a03a5b85",
"metadata": {},
"outputs": [
{
Expand All @@ -1052,7 +1052,7 @@
},
{
"cell_type": "markdown",
"id": "362531bc",
"id": "c054ef72",
"metadata": {},
"source": [
"We can again visualize these locations to understand where we inserted recordings:"
Expand All @@ -1061,7 +1061,7 @@
{
"cell_type": "code",
"execution_count": 15,
"id": "97b38d8e",
"id": "0d76ecdc",
"metadata": {},
"outputs": [
{
Expand All @@ -1084,7 +1084,7 @@
},
{
"cell_type": "markdown",
"id": "61bbea8a",
"id": "19a01ad4",
"metadata": {},
"source": [
"### Simulate the cell response\n",
Expand All @@ -1095,7 +1095,7 @@
{
"cell_type": "code",
"execution_count": 16,
"id": "6c08054b",
"id": "dca9f6f8",
"metadata": {},
"outputs": [
{
Expand All @@ -1113,7 +1113,7 @@
},
{
"cell_type": "markdown",
"id": "36a05bb6",
"id": "658889d6",
"metadata": {},
"source": [
"The `jx.integrate` function returns an array of shape `(num_recordings, num_timepoints)`. In our case, we inserted `2` recordings and we simulated for 10ms at a 0.025 time step, which leads to 402 time steps.\n",
Expand All @@ -1124,7 +1124,7 @@
{
"cell_type": "code",
"execution_count": 17,
"id": "7c605c24",
"id": "809514e3",
"metadata": {},
"outputs": [
{
Expand All @@ -1146,15 +1146,15 @@
},
{
"cell_type": "markdown",
"id": "507752b4",
"id": "3cf92844",
"metadata": {},
"source": [
"At the location of the first recording (in blue) the cell spiked, whereas at the second recording, it did not. This makes sense because we only inserted sodium and potassium channels into the first branch, but not in the entire cell."
]
},
{
"cell_type": "markdown",
"id": "558fdda4",
"id": "2ed34987",
"metadata": {},
"source": [
"Congrats! You have just run your first morphologically detailed neuron simulation in `Jaxley`. We suggest to continue by learning how to [build networks](https://jaxley.readthedocs.io/en/latest/tutorials/02_small_network.html). If you are only interested in single cell simulations, you can directly jump to learning how to [speed up simulations](https://jaxley.readthedocs.io/en/latest/tutorials/04_jit_and_vmap.html). If you want to simulate detailed morphologies from SWC files, checkout our tutorial on [working with detailed morphologies](https://jaxley.readthedocs.io/en/latest/tutorials/08_importing_morphologies.html)."
Expand Down
Loading

0 comments on commit 99a73a3

Please sign in to comment.