diff --git a/docs/pages.jl b/docs/pages.jl index 2fa424bc..b804c223 100644 --- a/docs/pages.jl +++ b/docs/pages.jl @@ -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", diff --git a/docs/src/getting_started.jl b/docs/src/getting_started.jl index 8151aa87..4872e583 100644 --- a/docs/src/getting_started.jl +++ b/docs/src/getting_started.jl @@ -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: @@ -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: @@ -53,7 +61,7 @@ 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: @@ -61,14 +69,14 @@ add_edge!(g, WC2 => WC2; weight = -1) ## recurrent connection from WC2 to itself # 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`. diff --git a/docs/src/index.md b/docs/src/index.md index af03c67f..ecc2dd32 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -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 diff --git a/docs/src/install.md b/docs/src/install.md new file mode 100644 index 00000000..582d498d --- /dev/null +++ b/docs/src/install.md @@ -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") +> ```