Skip to content

Commit

Permalink
Deploying to gh-pages from @ b9390d9 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
harisorgn committed Jan 10, 2025
1 parent 71eb0ac commit b02c652
Show file tree
Hide file tree
Showing 26 changed files with 7,104 additions and 7,087 deletions.
6 changes: 2 additions & 4 deletions assets/literate/intro_diffeq.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,19 @@ Since `I` will change dynamically in time, it will be a time-dependent variable

````julia:ex9
@variables v(t)=-65 u(t)=-13 I(t)
# The following parameter values correspond to regular spiking.
@parameters a=0.02 b=0.2 c=-65 d=8
@parameters a=0.02 b=0.2 c=-65 d=8 ## These parameter values correspond to regular spiking.
eqs = [D(v) ~ 0.04 * v ^ 2 + 5 * v + 140 - u + I,
D(u) ~ a * (b * v - u),
I ~ 10*sin(0.5*t)]
event = (v > 30.0) => [u ~ u + d, v ~ c]
# Notice how `I` was moved from the parameter list to the variable list in the following call.
@named izh_system = ODESystem(eqs, t, [v, u, I], [a, b, c, d]; discrete_events = event)
izh_simple = structural_simplify(izh_system)
````

Let's display the equations of the original and the simplified system to see the effect of `structural_simplify`.
Notice how `I` was moved from the parameter list to the variable list above. Let's display the equations of the original and the simplified system to see the effect of `structural_simplify`.

````julia:ex10
equations(izh_system)
Expand Down
4 changes: 1 addition & 3 deletions assets/literate/intro_diffeq_script.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,14 @@ fig
save(joinpath(@OUTPUT, "mtk4.svg"), fig); # hide

@variables v(t)=-65 u(t)=-13 I(t)
# The following parameter values correspond to regular spiking.
@parameters a=0.02 b=0.2 c=-65 d=8
@parameters a=0.02 b=0.2 c=-65 d=8 ## These parameter values correspond to regular spiking.

eqs = [D(v) ~ 0.04 * v ^ 2 + 5 * v + 140 - u + I,
D(u) ~ a * (b * v - u),
I ~ 10*sin(0.5*t)]

event = (v > 30.0) => [u ~ u + d, v ~ c]

# Notice how `I` was moved from the parameter list to the variable list in the following call.
@named izh_system = ODESystem(eqs, t, [v, u, I], [a, b, c, d]; discrete_events = event)
izh_simple = structural_simplify(izh_system)

Expand Down
17 changes: 10 additions & 7 deletions assets/literate/intro_plot.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ When defining an `Axis` there are multiple options to affect its appearance and
We can also change an `Axis` after it has been constructed. For instance we could hide the x-axis label and ticks on the top plot above, since it is a duplicate of the x-axis of the bottom plot. We will keep the grid lines though, because it is easier to read the x-axis values this way.

````julia:ex2
# `grid=false` avoids hiding the x grid lines
hidexdecorations!(axs[1], grid=false)
hidexdecorations!(axs[1], grid=false) ## `grid=false` avoids hiding the x grid lines
# Now we can display the figure again with the updated axes
fig
Expand All @@ -65,8 +64,7 @@ using ModelingToolkit: t_nounits as t, D_nounits as D
using OrdinaryDiffEq
@variables v(t)=-65 u(t)=-13
# Parameters for fast spiking.
@parameters a=0.1 b=0.2 c=-65 d=2 I=10
@parameters a=0.1 b=0.2 c=-65 d=2 I=10 ## Parameters for fast spiking.
eqs = [D(v) ~ 0.04 * v ^ 2 + 5 * v + 140 - u + I,
D(u) ~ a * (b * v - u)]
Expand Down Expand Up @@ -96,12 +94,17 @@ t_window = 20
t_range = first(tspan):t_window:last(tspan)
# initialize an empty vector to hold the spike values.
spikes = zeros(length(t_range) - 1)
````

To find spikes we need to
- loop over the timepoints at which every time window begins
- find the indices of timepoints that fall within the current time window
- count the number of spikes within the same window

# loop over the timepoints at which every time window begins
````julia:ex4
for i in eachindex(t_range[1:end-1])
# find the indices of timepoints that fall within the current time window
idxs = findall(t -> t_range[i] <= t <= t_range[i+1], timepoints)
# count the number of spikes within the same window
spikes[i] = count(V_izh[idxs] .> spike_threshold) ## counts the number of True elements in a Boolean vector
end
Expand Down
10 changes: 3 additions & 7 deletions assets/literate/intro_plot_script.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ scatter!(axs[2], seconds, measurements)
fig
save(joinpath(@OUTPUT, "layout.svg"), fig); # hide

# `grid=false` avoids hiding the x grid lines
hidexdecorations!(axs[1], grid=false)
hidexdecorations!(axs[1], grid=false) ## `grid=false` avoids hiding the x grid lines

# Now we can display the figure again with the updated axes
fig
Expand All @@ -28,8 +27,7 @@ using ModelingToolkit: t_nounits as t, D_nounits as D
using OrdinaryDiffEq

@variables v(t)=-65 u(t)=-13
# Parameters for fast spiking.
@parameters a=0.1 b=0.2 c=-65 d=2 I=10
@parameters a=0.1 b=0.2 c=-65 d=2 I=10 ## Parameters for fast spiking.

eqs = [D(v) ~ 0.04 * v ^ 2 + 5 * v + 140 - u + I,
D(u) ~ a * (b * v - u)]
Expand Down Expand Up @@ -60,11 +58,9 @@ t_range = first(tspan):t_window:last(tspan)
# initialize an empty vector to hold the spike values.
spikes = zeros(length(t_range) - 1)

# loop over the timepoints at which every time window begins
for i in eachindex(t_range[1:end-1])
# find the indices of timepoints that fall within the current time window
idxs = findall(t -> t_range[i] <= t <= t_range[i+1], timepoints)
# count the number of spikes within the same window

spikes[i] = count(V_izh[idxs] .> spike_threshold) ## counts the number of True elements in a Boolean vector
end

Expand Down
Loading

0 comments on commit b02c652

Please sign in to comment.