Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rebuild models/08-spiking_neural_systems.jmd #327

Merged
merged 1 commit into from
Sep 18, 2020
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
173 changes: 110 additions & 63 deletions html/models/08-spiking_neural_systems.html

Large diffs are not rendered by default.

238 changes: 138 additions & 100 deletions markdown/models/08-spiking_neural_systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,21 @@ cb = CallbackSet(current_step,threshold)
````
DiffEqBase.CallbackSet{Tuple{},Tuple{DiffEqBase.DiscreteCallback{DiffEqCall
backs.var"#61#64"{Array{Int64,1}},DiffEqCallbacks.var"#62#65"{Main.##WeaveS
andBox#309.var"#1#2"},DiffEqCallbacks.var"#63#66"{typeof(DiffEqBase.INITIAL
IZE_DEFAULT),Bool,Array{Int64,1},Main.##WeaveSandBox#309.var"#1#2"}},DiffEq
Base.DiscreteCallback{typeof(Main.##WeaveSandBox#309.thr),typeof(Main.##Wea
veSandBox#309.reset!),typeof(DiffEqBase.INITIALIZE_DEFAULT)}}}((), (DiffEqB
andBox#337.var"#1#2"},DiffEqCallbacks.var"#63#66"{typeof(DiffEqBase.INITIAL
IZE_DEFAULT),Bool,Array{Int64,1},Main.##WeaveSandBox#337.var"#1#2"}},DiffEq
Base.DiscreteCallback{typeof(Main.##WeaveSandBox#337.thr),typeof(Main.##Wea
veSandBox#337.reset!),typeof(DiffEqBase.INITIALIZE_DEFAULT)}}}((), (DiffEqB
ase.DiscreteCallback{DiffEqCallbacks.var"#61#64"{Array{Int64,1}},DiffEqCall
backs.var"#62#65"{Main.##WeaveSandBox#309.var"#1#2"},DiffEqCallbacks.var"#6
backs.var"#62#65"{Main.##WeaveSandBox#337.var"#1#2"},DiffEqCallbacks.var"#6
3#66"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,Array{Int64,1},Main.##Weav
eSandBox#309.var"#1#2"}}(DiffEqCallbacks.var"#61#64"{Array{Int64,1}}([2, 15
]), DiffEqCallbacks.var"#62#65"{Main.##WeaveSandBox#309.var"#1#2"}(Main.##W
eaveSandBox#309.var"#1#2"()), DiffEqCallbacks.var"#63#66"{typeof(DiffEqBase
.INITIALIZE_DEFAULT),Bool,Array{Int64,1},Main.##WeaveSandBox#309.var"#1#2"}
(DiffEqBase.INITIALIZE_DEFAULT, true, [2, 15], Main.##WeaveSandBox#309.var"
eSandBox#337.var"#1#2"}}(DiffEqCallbacks.var"#61#64"{Array{Int64,1}}([2, 15
]), DiffEqCallbacks.var"#62#65"{Main.##WeaveSandBox#337.var"#1#2"}(Main.##W
eaveSandBox#337.var"#1#2"()), DiffEqCallbacks.var"#63#66"{typeof(DiffEqBase
.INITIALIZE_DEFAULT),Bool,Array{Int64,1},Main.##WeaveSandBox#337.var"#1#2"}
(DiffEqBase.INITIALIZE_DEFAULT, true, [2, 15], Main.##WeaveSandBox#337.var"
#1#2"()), Bool[1, 1]), DiffEqBase.DiscreteCallback{typeof(Main.##WeaveSandB
ox#309.thr),typeof(Main.##WeaveSandBox#309.reset!),typeof(DiffEqBase.INITIA
LIZE_DEFAULT)}(Main.##WeaveSandBox#309.thr, Main.##WeaveSandBox#309.reset!,
ox#337.thr),typeof(Main.##WeaveSandBox#337.reset!),typeof(DiffEqBase.INITIA
LIZE_DEFAULT)}(Main.##WeaveSandBox#337.thr, Main.##WeaveSandBox#337.reset!,
DiffEqBase.INITIALIZE_DEFAULT, Bool[1, 1])))
````

Expand Down Expand Up @@ -139,7 +139,50 @@ sol = solve(prob)


````
Error: UndefVarError: top not defined
retcode: Success
Interpolation: automatic order switching interpolation
t: 153-element Array{Float64,1}:
0.0
9.999999999999999e-5
0.0010999999999999998
0.011099999999999997
0.11109999999999996
1.1110999999999995
2.0
2.0
2.6300346673750097
2.9226049547524595
38.34157935968204
38.78215179003683
38.78215179003683
39.222724173706894
39.222724173706894
39.6632965982261
39.6632965982261
40.0
40.0
u: 153-element Array{Float64,1}:
-75.0
-75.0
-75.0
-75.0
-75.0
-75.0
-75.0
-75.0
-59.978080111690375
-57.32999167299642
-75.0
-50.40489310815222
-75.0
-50.404894730067554
-75.0
-50.404893310891545
-75.0
-54.419318668318546
-75.0
````


Expand All @@ -154,11 +197,7 @@ plot(sol)
````


````
Error: UndefVarError: sol not defined
````


![](figures/08-spiking_neural_systems_5_1.png)



Expand Down Expand Up @@ -211,22 +250,22 @@ cb = CallbackSet(current_step,threshold)

````
DiffEqBase.CallbackSet{Tuple{},Tuple{DiffEqBase.DiscreteCallback{DiffEqCall
backs.var"#61#64"{Int64},DiffEqCallbacks.var"#62#65"{Main.##WeaveSandBox#30
9.var"#3#4"},DiffEqCallbacks.var"#63#66"{typeof(DiffEqBase.INITIALIZE_DEFAU
LT),Bool,Int64,Main.##WeaveSandBox#309.var"#3#4"}},DiffEqBase.DiscreteCallb
ack{typeof(Main.##WeaveSandBox#309.thr),typeof(Main.##WeaveSandBox#309.rese
backs.var"#61#64"{Int64},DiffEqCallbacks.var"#62#65"{Main.##WeaveSandBox#33
7.var"#3#4"},DiffEqCallbacks.var"#63#66"{typeof(DiffEqBase.INITIALIZE_DEFAU
LT),Bool,Int64,Main.##WeaveSandBox#337.var"#3#4"}},DiffEqBase.DiscreteCallb
ack{typeof(Main.##WeaveSandBox#337.thr),typeof(Main.##WeaveSandBox#337.rese
t!),typeof(DiffEqBase.INITIALIZE_DEFAULT)}}}((), (DiffEqBase.DiscreteCallba
ck{DiffEqCallbacks.var"#61#64"{Int64},DiffEqCallbacks.var"#62#65"{Main.##We
aveSandBox#309.var"#3#4"},DiffEqCallbacks.var"#63#66"{typeof(DiffEqBase.INI
TIALIZE_DEFAULT),Bool,Int64,Main.##WeaveSandBox#309.var"#3#4"}}(DiffEqCallb
aveSandBox#337.var"#3#4"},DiffEqCallbacks.var"#63#66"{typeof(DiffEqBase.INI
TIALIZE_DEFAULT),Bool,Int64,Main.##WeaveSandBox#337.var"#3#4"}}(DiffEqCallb
acks.var"#61#64"{Int64}(50), DiffEqCallbacks.var"#62#65"{Main.##WeaveSandBo
x#309.var"#3#4"}(Main.##WeaveSandBox#309.var"#3#4"()), DiffEqCallbacks.var"
x#337.var"#3#4"}(Main.##WeaveSandBox#337.var"#3#4"()), DiffEqCallbacks.var"
#63#66"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,Int64,Main.##WeaveSandBo
x#309.var"#3#4"}(DiffEqBase.INITIALIZE_DEFAULT, true, 50, Main.##WeaveSandB
ox#309.var"#3#4"()), Bool[1, 1]), DiffEqBase.DiscreteCallback{typeof(Main.#
#WeaveSandBox#309.thr),typeof(Main.##WeaveSandBox#309.reset!),typeof(DiffEq
Base.INITIALIZE_DEFAULT)}(Main.##WeaveSandBox#309.thr, Main.##WeaveSandBox#
309.reset!, DiffEqBase.INITIALIZE_DEFAULT, Bool[1, 1])))
x#337.var"#3#4"}(DiffEqBase.INITIALIZE_DEFAULT, true, 50, Main.##WeaveSandB
ox#337.var"#3#4"()), Bool[1, 1]), DiffEqBase.DiscreteCallback{typeof(Main.#
#WeaveSandBox#337.thr),typeof(Main.##WeaveSandBox#337.reset!),typeof(DiffEq
Base.INITIALIZE_DEFAULT)}(Main.##WeaveSandBox#337.thr, Main.##WeaveSandBox#
337.reset!, DiffEqBase.INITIALIZE_DEFAULT, Bool[1, 1])))
````


Expand Down Expand Up @@ -260,11 +299,7 @@ plot(sol, vars=1)
````


````
Error: UndefVarError: top not defined
````


![](figures/08-spiking_neural_systems_9_1.png)



Expand All @@ -276,11 +311,7 @@ plot(sol, vars=2)
````


````
Error: UndefVarError: sol not defined
````


![](figures/08-spiking_neural_systems_10_1.png)



Expand All @@ -298,11 +329,7 @@ plot(sol, vars=1)
````


````
Error: UndefVarError: top not defined
````


![](figures/08-spiking_neural_systems_11_1.png)



Expand Down Expand Up @@ -388,11 +415,7 @@ plot(sol, vars=1)
````


````
Error: UndefVarError: top not defined
````


![](figures/08-spiking_neural_systems_14_1.png)



Expand All @@ -404,11 +427,7 @@ plot(sol, vars=[2,3,4], tspan=(105.0,130.0))
````


````
Error: UndefVarError: sol not defined
````


![](figures/08-spiking_neural_systems_15_1.png)



Expand Down Expand Up @@ -466,11 +485,7 @@ plot(sol, vars=1)
````


````
Error: UndefVarError: top not defined
````


![](figures/08-spiking_neural_systems_17_1.png)



Expand All @@ -486,11 +501,7 @@ plot!(sol, vars=1)
````


````
Error: UndefVarError: top not defined
````


![](figures/08-spiking_neural_systems_18_1.png)



Expand Down Expand Up @@ -534,23 +545,15 @@ plot(sol, vars=1)
````


````
Error: UndefVarError: top not defined
````


![](figures/08-spiking_neural_systems_19_1.png)

````julia

plot(sol, vars=7)
````


````
Error: UndefVarError: sol not defined
````


![](figures/08-spiking_neural_systems_20_1.png)



Expand All @@ -562,11 +565,7 @@ plot(sol, vars=[5,6])
````


````
Error: UndefVarError: sol not defined
````


![](figures/08-spiking_neural_systems_21_1.png)



Expand All @@ -585,23 +584,15 @@ plot(sol, vars=7)
````


````
Error: UndefVarError: top not defined
````


![](figures/08-spiking_neural_systems_22_1.png)

````julia

plot(sol, vars=[5,6])
````


````
Error: UndefVarError: sol not defined
````


![](figures/08-spiking_neural_systems_23_1.png)



Expand All @@ -620,27 +611,74 @@ plot(sol, vars=7)
````


````
Error: UndefVarError: top not defined
````


![](figures/08-spiking_neural_systems_24_1.png)

````julia

plot(sol, vars=[5,6])
````


````
Error: UndefVarError: sol not defined
````


![](figures/08-spiking_neural_systems_25_1.png)



Just changing those two time constants has changed the dynamics to short-term depression. This is still frequency dependent. Changing these parameters can generate a variety of different short-term dynamics.

## Summary
That's it for now. Thanks for making it this far. If you want to learn more about neuronal dynamics, [this is a great resource](https://neuronaldynamics.epfl.ch/online/index.html). If you want to learn more about Julia check out the [official website](https://julialang.org/) and to learn more about the DifferentialEquations package you are in the right place, because this chapter is part of a [larger tutorial series about just that](https://github.com/SciML/SciMLTutorials.jl).


## Appendix

This tutorial is part of the SciMLTutorials.jl repository, found at: <https://github.com/SciML/SciMLTutorials.jl>.
For more information on doing scientific machine learning (SciML) with open source software, check out <https://sciml.ai/>.

To locally run this tutorial, do the following commands:
```
using SciMLTutorials
SciMLTutorials.weave_file("models","08-spiking_neural_systems.jmd")
```

Computer Information:
```
Julia Version 1.4.2
Commit 44fa15b150* (2020-05-23 18:35 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
JULIA_LOAD_PATH = /builds/JuliaGPU/DiffEqTutorials.jl:
JULIA_DEPOT_PATH = /builds/JuliaGPU/DiffEqTutorials.jl/.julia
JULIA_CUDA_MEMORY_LIMIT = 2147483648
JULIA_NUM_THREADS = 8

```

Package Information:

```
Status `/builds/JuliaGPU/DiffEqTutorials.jl/tutorials/models/Project.toml`
[479239e8-5488-4da2-87a7-35f2df7eef83] Catalyst 5.0.0
[459566f4-90b8-5000-8ac3-15dfb0a30def] DiffEqCallbacks 2.14.1
[f3b72e0c-5b89-59e1-b016-84e28bfd966d] DiffEqDevTools 2.27.0
[055956cb-9e8b-5191-98cc-73ae4a59e68a] DiffEqPhysics 3.6.0
[0c46a032-eb83-5123-abaf-570d42b7fbaa] DifferentialEquations 6.15.0
[31c24e10-a181-5473-b8eb-7969acd0382f] Distributions 0.23.12
[587475ba-b771-5e3f-ad9e-33799f191a9c] Flux 0.11.1
[f6369f11-7733-5829-9624-2563aa707210] ForwardDiff 0.10.12
[23fbe1c1-3f47-55db-b15f-69d7ec21a316] Latexify 0.14.0
[961ee093-0014-501f-94e3-6117800e7a78] ModelingToolkit 3.20.0
[2774e3e8-f4cf-5e23-947b-6d7e65073b56] NLsolve 4.4.1
[315f7962-48a3-4962-8226-d0f33b1235f0] NeuralPDE 2.3.0
[429524aa-4258-5aef-a3af-852621145aeb] Optim 1.2.0
[1dea7af3-3e70-54e6-95c3-0bf5283fa5ed] OrdinaryDiffEq 5.42.8
[91a5bcdd-55d7-5caf-9e0b-520d859cae80] Plots 1.6.5
[731186ca-8d62-57ce-b412-fbd966d074cd] RecursiveArrayTools 2.7.0
[789caeaf-c7a9-5a7d-9973-96adeb23e2a0] StochasticDiffEq 6.26.0
[37e2e46d-f89d-539d-b4ee-838fcccc9c8e] LinearAlgebra
[2f01184e-e22b-5df5-ae63-d93ebab69eaf] SparseArrays
```
Binary file modified markdown/models/figures/08-spiking_neural_systems_10_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified markdown/models/figures/08-spiking_neural_systems_11_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified markdown/models/figures/08-spiking_neural_systems_14_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified markdown/models/figures/08-spiking_neural_systems_15_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified markdown/models/figures/08-spiking_neural_systems_5_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified markdown/models/figures/08-spiking_neural_systems_9_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading