Docs | Build Status |
---|---|
- Numerical simulations of one- and two-dimensional stochastic neural field equations with delay
- Master's thesis
The numerical method implemented in NeuralFieldEq.jl
was developed within the scope of the thesis Sequeira 2021 under the supervision of professor Pedro M. Lima. The method combined the novel numerical scheme published originally by Hutt & Rougier 2013 for delayed NFE in the context of the stochastic scenario presented by Kuehn & Riedler 2014 where the convergence of spectral methods was proved in stochastic neural fields with additive white noise and spatial correlation.
Hence, this package aims to numerically approximate solutions of Neural Field Equations in one- or two-dimensional spaces, with or without delay and in the deterministic or stochastic scenarios described below.
NeuralFieldEq.jl
requires Julia version 1.5 or greater. You can install Julia here. Once installation is complete, open a Julia REPL and run the following code to install the package:
using Pkg
Pkg.add("NeuralFieldEq")
The package will install the following dependencies FFTW.jl
, Distributions.jl
, ProgressMeter.jl
and LinearAlgebra.jl
.
Please check the documentation to get started with neural field equations and with the solver itself
The solver is divided into three steps:
- Introduce the parameters and functions using the structures
Input1D
orInput2D
; - Pre-process the NFE using the function
probNFE
; - Solve the equation using the function
solveNFE
at time instants chosen by the user, with or without noise.
With respect to the structures Input1D
and Input2D
, they are needed to wrap the inputs needed to define our NFE. They have the following order:
α :: AbstractFloat
: Decay ratev :: AbstractFloat
: Axonal speedV0 :: fV0
: Initial condition (constant or a function)L :: Number
: Domain's lengthN :: Integer
: Number of spatial nodesT :: AbstractFloat
: Time spann :: Integer
: Number of time nodesI :: fI
: External input functionK :: fK
: Connectivity functionS :: fS
: Firing rate function
Remark 1: The function I
, depending on the domain dimension, has to have x
,t
or x
,y
,t
as its arguments. Function K
has x
or x
,y
. Function S
with V
.
Once we define our input structure, we can now pass as input to function probNFE
, where the NFE is prepared to be solved using the function solveNFE
.
Remark 2: Currently, to work with the non-delayed problem, the velocity to insert must satisfy the condition: v>L/(sqrt(2)*Δt)
in 2D and v>L/(2*Δt)
in 1D, meaning that in practice the user must specify a big velocity (ex.: 999999.0
)
The solver has the following generic structure:
nfe = Input1D(α,v,V0,L,N,T,n,I,K,S); # Wrap the inputs in structure Input1D
prob = probNFE(nfe) # Pre-process the NFE to be computed
# Solve the deterministic 1D problem
Vdet = solveNFE(prob,[t1,t2,t3]) # solution saved at t1, t2, and t3
# Solve the stochastic 1D problem np times
# ϵ level of additive noise, spatial correlation (0.1 default value)
Vsto = solveNFE(prob,[t1,t2,t3],ϵ,np,ξ=0.1)
Vsto2 = solveNFE(prob,[t1,t2,t3],ϵ,np,0.15) # solution w/ xi=0.15 spatial corr
using NeuralFieldEq, Plots
# Define functions
I(x,y,t) = (5.0/(32.0*pi))*exp(-(x^2+y^2)/32.0)
function K(x,y)
A = 20.0/(10.0*pi)
B = 14.0/(18.0*pi)
return A*exp(-sqrt(x^2+y^2)) - B*exp(-sqrt(x^2+y^2)/3.0)
end
S(V) = V <=0.005 ? 0.0 : 1.0 # heaviside function H(V-0.005)
# Define parameters
a = 1.0
V0 = 0.0
L = 20
N = 256
T = 80.0
n = 1600
tj = 0:0.2:T; # Instants to save the solution
# Wrap inputs and prepare the NFEs to be computed
nfe_v5 = Input2D(a,5.0,V0,L,N,T,n,I,K,S); # Solution with v=5
nfe_v3 = Input2D(a,3.0,V0,L,N,T,n,I,K,S); # Solution with v=3
prob_v5 = probNFE(nfe_v5)
prob_v3 = probNFE(nfe_v3)
# Solve NFEs
V_v5 = solveNFE(prob_v5,tj)
V_v3 = solveNFE(prob_v3,tj)
Check the for the animated solutions of these problems and other examples.
Check the Example section of the documentation, for the animated solutions to these problems and many other examples.
The software in this repository was developed as part of academic research carried out in the context of the master's thesis Numerical Simulations of One- and Two-dimensional Stochastic Neural Field Equations with Delay. If you would like to help support it, please star the repository, consider to use the solver in your research, give your valuable feedback, and feel free to contribute to the package. Improving the documentation, giving ideas and suggestions, contributing lines of code, etc.
Any issues that you find, please, report here.
- Define a new FFT implementation in this module (as indicated in the readme of AbstractFFTs.jl)
- Refactor the code in order to handle the 1D and 2D cases generically (so, no longer the need to have 1D and 2D versions of the same function)
- Write the non-delayed case
$v=\infty$ of the solver - Add the possibility of handling single-precision floats (Float32). Currently it only supports double-precision floats
- Add new numerical schemes with higher order of convergence in time (such as the Milstein method)
- Add new numerical methods with higher order of convergence in space (in this case the advantage of the speed of FFTs will be lost)
- Better solution handling