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

Improve introductory pages in docs #460

Merged
merged 3 commits into from
Oct 14, 2024
Merged
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
1 change: 1 addition & 0 deletions docs/pages.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Put in a separate page so it can be used by SciMLDocs.jl

pages = ["index.md",
"How to install" => "install.md",
"Getting Started" => "getting_started.md",
"Tutorials" => Any[
"tutorials/resting_state.md",
Expand Down
24 changes: 16 additions & 8 deletions docs/src/getting_started.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# # Getting Started with Neuroblox
# # Getting Started

# This tutorial will introduce you to simulating brain dynamics using Neuroblox.
# In this example, we'll create a simple oscillating circuit using two Wilson-Cowan neural mass models [1]. The Wilson-Cowan model is one of the most influential models in computational neuroscience [2], describing the dynamics of interactions between populations of excitatory and inhibitory neurons.
# ## Getting Started with Julia

# ## The Wilson-Cowan Model
# Here we would like to summarize some resources for people that are interested in learning more about the Julia language before or while exploring Neuroblox. Please follow the links below for introductory material on the language that is inclusive to all users; people familiar with programming or not, people with a mathematics, engineering, or science background :
# - [Introduction to Julia](https://youtu.be/7hVV5uoEo-0?si=JdMSCh3R4w2cl5uT) by Matt Bauman at the JuliaCon 2024
# - [Julia Tutorials & Workshops](https://julialang.org/learning/tutorials/), a collection of training materials from the official Julia website.
# - [Modern Julia Workflows](https://modernjuliaworkflows.org/), an introduction to how to write and share your Julia code effectively with tips & tricks.

# ## Getting Started with Neuroblox

# This example will introduce you to simulating brain dynamics using Neuroblox. We will create a simple oscillating circuit using two Wilson-Cowan neural mass models [1]. The Wilson-Cowan model is one of the most influential models in computational neuroscience [2], describing the dynamics of interactions between populations of excitatory and inhibitory neurons.

# ### The Wilson-Cowan Model

# Each Wilson-Cowan neural mass is described by the following equations:

Expand All @@ -24,7 +32,7 @@

# where $a_k$ and $\theta_k$ determine the steepness and threshold of the response, respectively.

# ## Building the Circuit
# ### Building the Circuit

# Let's create an oscillating circuit by connecting two Wilson-Cowan neural masses:

Expand Down Expand Up @@ -53,22 +61,22 @@ add_edge!(g, WC2 => WC2; weight = -1) ## recurrent connection from WC2 to itself

# By default, the output of each Wilson-Cowan blox is its excitatory activity (E). The negative self-connections (-1) provide inhibitory feedback, while the positive inter-blox connections (6) provide strong excitatory coupling. This setup creates an oscillatory dynamic between the two Wilson-Cowan units.

# ## Creating the Model
# ### Creating the Model

# Now, let's build the complete model:

@named sys = system_from_graph(g)

# This creates a differential equations system from our graph representation using ModelingToolkit and symbolically simplifies it for efficient computation.

# ## Simulating the Model
# ### Simulating the Model

# We are now ready to simulate our model. The following code creates and solves an `ODEProblem` for our system, simulating 100 time units of activity. In Neuroblox, the default time unit is milliseconds. We use `Rodas4`, a solver efficient for stiff problems. The solution is saved every 0.1 ms, allowing us to observe the detailed evolution of the system's behavior.

prob = ODEProblem(sys, [], (0.0, 100), [])
sol = solve(prob, Rodas4(), saveat=0.1)

# ## Plotting simulation results
# ### Plotting simulation results

# Finally, let us plot the `E` and `I` states of the first component, `WC1`.

Expand Down
13 changes: 0 additions & 13 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,6 @@ Neuroblox.jl is designed for computational neuroscience and psychiatry applicati
Neuroblox.jl is based on a library of modular computational building blocks (“blox”) in the form of systems of symbolic dynamic differential equations that can be combined to describe large-scale brain dynamics. Once a model is built, it can be simulated efficiently and fit electrophysiological and neuroimaging data. Moreover, the circuit behavior of multiple model variants can be investigated to aid in distinguishing between competing hypotheses.
We employ ModelingToolkit.jl to describe the dynamical behavior of blox as symbolic (stochastic/delay) differential equations. Our libraries of modular blox consist of individual neurons (Hodgkin-Huxley, IF, QIF, LIF, etc.), neural mass models (Jansen-Rit, Wilson-Cowan, Lauter-Breakspear, Next Generation, microcanonical circuits etc.) and biomimetically-constrained control circuit elements. A GUI designed to be intuitive to neuroscientists allows researchers to build models that automatically generate high-performance systems of numerical ordinary/stochastic differential equations from which one can run stimulations with parameters fit to experimental data. Our benchmarks show that the increase in speed for simulation often exceeds a factor of 100 as compared to neural mass model implementation by the Virtual Brain (python) and similar packages in MATLAB. For parameter fitting of brain circuit dynamical models, we use Turing.jl to perform probabilistic modeling, including Hamilton-Monte-Carlo sampling and Automated Differentiation Variational Inference.

## Installation

To install Neuroblox.jl, first add the JuliaHubRegistry and then use the Julia package manager:

```julia
using Pkg
Pkg.add("PkgAuthentication")
using PkgAuthentication
PkgAuthentication.install("juliahub.com")
Pkg.Registry.add()
Pkg.add("Neuroblox")
```

## Licensing

Neuroblox is free for non-commerical and academic use. For full details of the license, please see
Expand Down
29 changes: 29 additions & 0 deletions docs/src/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Installing Neuroblox

To install Neuroblox.jl, you need to first add the JuliaHubRegistry your list of registries that julia checks for available package

```julia
using Pkg
Pkg.add("PkgAuthentication")
using PkgAuthentication
PkgAuthentication.install("juliahub.com")
Pkg.Registry.add()
```

The next step is to install Neuroblox from the JuliaHubRegistry. It is also useful to install some other packages that are commonly used with Neuroblox. These packages are used in the tutorials of the next section. We have included Neuroblox and these other packages into a single `Project.toml` file which you can download and then use it to activate a new environment where all the necessary packages will be installed. To do this first choose a folder where you want this environment to be generated in and then run

``` julia
using Downloads

Downloads.download( , joinpath(@__DIR__, "Project.toml"))
Pkg.activate(@__DIR__)
Pkg.instantiate()
```

Please note that after running these commands `Neuroblox` will also be installed along with all other packages that are used in the tutorials.

> **_NOTE_:**
> If you want to install only Neuroblox and not the other packages used in the tutorials you can run
> ```julia
> Pkg.add("Neuroblox")
> ```
Loading