Skip to content

Commit

Permalink
remove extra return by formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoming committed Aug 14, 2023
1 parent 8b46311 commit 3b40ce1
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ps = [1e-4, 1e-2]
# Model: non-Markovian part (delay reactions)
τ = 20.0
delay_trigger_affect! = function (integrator, rng)
return append!(integrator.de_chan[1], τ) # add a delay time τ to the first delay channel
append!(integrator.de_chan[1], τ) # add a delay time τ to the first delay channel
end
delay_trigger = Dict(1 => delay_trigger_affect!) # the first reaction S+I -> E+I will trigger a delay reaction: E --> I after τ time.
delay_complete = Dict(1 => [2 => 1, 3 => -1]) # E --> I after τ time: transfer from E (minus 1) to I (plus 1) after the completed delay reaction
Expand Down Expand Up @@ -111,7 +111,7 @@ ps = [0.0282, 3.46]
delay_trigger_affect! = []
for i in 1:burst_sup
push!(delay_trigger_affect!, function (integrator, rng)
return append!(integrator.de_chan[1], fill(τ, i))
append!(integrator.de_chan[1], fill(τ, i))
end)
end
delay_trigger = Dict([Pair(i, delay_trigger_affect![i]) for i in 1:burst_sup])
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/bursty.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Next, we define the non-Markovian part. Here we mainly need to consider the dela
delay_trigger_affect! = []
for n in 1:burst_sup
push!(delay_trigger_affect!, function (integrator, rng)
return append!(integrator.de_chan[1], fill(τ, n))
append!(integrator.de_chan[1], fill(τ, n))
end)
end
delay_trigger = Dict([Pair(i, delay_trigger_affect![i]) for i in 1:burst_sup])
Expand Down
4 changes: 2 additions & 2 deletions docs/src/tutorials/delay_degradation.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Then we turn to the definition of delay reactions
```julia
τ = 15.0
delay_trigger_affect! = function (integrator, rng)
return append!(integrator.de_chan[1], τ)
append!(integrator.de_chan[1], τ)
end
delay_trigger = Dict(3 => delay_trigger_affect!)
delay_complete = Dict(1 => [2 => -1])
Expand Down Expand Up @@ -177,7 +177,7 @@ dprob = DiscreteProblem(u0, tspan, p)
τ = 15.0
delay_trigger_affect! = function (integrator, rng)
append!(integrator.de_chan[1], τ)
return append!(integrator.de_chan[2], τ)
append!(integrator.de_chan[2], τ)
end
delay_trigger = Dict(3 => delay_trigger_affect!)
delay_complete = Dict(1 => [2 => -1], 2 => [3 => -1])
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/stochastic_delay.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Unlike other examples, the elongation time $\tau$ is a random variable sampled f
```julia
delay_trigger_affect! = function (integrator, rng)
τ = rand(LogNormal(1, sqrt(2))) + 120
return append!(integrator.de_chan[1], τ)
append!(integrator.de_chan[1], τ)
end
delay_trigger = Dict(3 => delay_trigger_affect!)
delay_complete = Dict(1 => [3 => -1])
Expand Down
4 changes: 2 additions & 2 deletions examples/bursty.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## This example shows an application of `DelaySSA.jl` for a bursty model with delay

## A Bursty model with delay is described as
## A Bursty model with delay is described as
# ab^n/(1+b)^(n+1): 0 -> n P, which triggers n P to degrade after delay time τ

using DelaySSAToolkit
Expand Down Expand Up @@ -30,7 +30,7 @@ dprob = DiscreteProblem(jumpsys, u0, tspan, ps)
delay_trigger_affect! = []
for i in 1:burst_sup
push!(delay_trigger_affect!, function (integrator, rng)
return append!(integrator.de_chan[1], fill(τ, i))
append!(integrator.de_chan[1], fill(τ, i))
end)
end
delay_trigger_affect!
Expand Down
2 changes: 1 addition & 1 deletion examples/delay_degradation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dprob = DiscreteProblem(u0, tspan, p)

τ = 15.0
delay_trigger_affect! = function (integrator, rng)
return append!(integrator.de_chan[1], τ)
append!(integrator.de_chan[1], τ)
end
delay_trigger = Dict(3 => delay_trigger_affect!)
delay_complete = Dict(1 => [2 => -1])
Expand Down
4 changes: 2 additions & 2 deletions examples/delay_oscillator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Catalyst
# using Plots
################################################################################
# the following example illustrates how to deal with a oscillatory system
# d: X-> 0; k1/(1+Y^2): 0-> X; [trigger X-> Y after τ time;] k2*Y/(1+Y): Y-> 0;
# d: X-> 0; k1/(1+Y^2): 0-> X; [trigger X-> Y after τ time;] k2*Y/(1+Y): Y-> 0;

rn = @reaction_network begin
1 / (1 + Y^2), 0 --> X
Expand All @@ -21,7 +21,7 @@ dprob = DiscreteProblem(jumpsys, u0, tspan)
# jumpsys.dep_graph

delay_trigger_affect! = function (integrator, rng)
return append!(integrator.de_chan[1], τ)
append!(integrator.de_chan[1], τ)
end
delay_trigger = Dict(1 => delay_trigger_affect!)
delay_complete = Dict(1 => [2 => 1, 1 => -1])
Expand Down
2 changes: 1 addition & 1 deletion examples/seir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ps = [1e-4, 1e-2]
τ = 20.0
dprob = DiscreteProblem(jumpsys, u0, tspan, ps)
delay_trigger_affect! = function (integrator, rng)
return append!(integrator.de_chan[1], τ)
append!(integrator.de_chan[1], τ)
end
delay_trigger = Dict(1 => delay_trigger_affect!)
# delay_trigger = Dict(1=>[1=>τ])
Expand Down
4 changes: 2 additions & 2 deletions examples/stochastic_delay.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dprob = DiscreteProblem(u0, tspan, p)

delay_trigger_affect! = function (integrator, rng)
τ = rand(LogNormal(1, sqrt(2))) + 120
return append!(integrator.de_chan[1], τ)
append!(integrator.de_chan[1], τ)
end
delay_trigger = Dict(3 => delay_trigger_affect!)
delay_complete = Dict(1 => [3 => -1])
Expand Down Expand Up @@ -49,7 +49,7 @@ histogram(

delay_trigger_affect2! = function (integrator, rng)
τ = rand(LogNormal(0, 2)) + 120
return append!(integrator.de_chan[1], τ)
append!(integrator.de_chan[1], τ)
end
delay_trigger2 = Dict(3 => delay_trigger_affect2!)
delayjumpset2 = DelayJumpSet(delay_trigger2, delay_complete, delay_interrupt)
Expand Down
4 changes: 2 additions & 2 deletions test/cascade_of_delay_reaction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end
delay_trigger_affect! = []
chain_len = 10
delay_trigger_affect! = function (integrator, rng)
return append!(integrator.de_chan[1], 1.0)
append!(integrator.de_chan[1], 1.0)
end

u0 = zeros(chain_len)
Expand All @@ -22,7 +22,7 @@ for i in 1:(chain_len - 1)
push!(delay_complete_affect!, function (integrator, rng)
integrator.u[i] -= 1 # A_prev minus 1
integrator.u[i + 1] += 1 # A plus 1
return append!(integrator.de_chan[i + 1], 1.0) # add to the delay channel
append!(integrator.de_chan[i + 1], 1.0) # add to the delay channel
end)
end
push!(delay_complete_affect!, function (integrator, rng)
Expand Down
2 changes: 1 addition & 1 deletion test/delay_problem_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ps = [1e-4, 1e-2] # parameters for ρ, r
dprob = DiscreteProblem(u0, tspan, ps)

delay_trigger_affect! = function (integrator, rng)
return append!(integrator.de_chan[1], τ)
append!(integrator.de_chan[1], τ)
end
delay_trigger = Dict(1 => delay_trigger_affect!)
delay_complete = Dict(1 => [2 => 1, 3 => -1])
Expand Down
2 changes: 1 addition & 1 deletion test/dep_gr_delay.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tspan = (0, tf)
dprob = DiscreteProblem(jumpsys, u0, tspan)

delay_trigger_affect! = function (integrator, rng)
return append!(integrator.de_chan[1], τ)
append!(integrator.de_chan[1], τ)
end
delay_trigger = Dict(1 => delay_trigger_affect!)
delay_complete = Dict(1 => [2 => 1], 2 => [1 => -1])
Expand Down
2 changes: 1 addition & 1 deletion test/remake_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ps = [1e-4, 1e-2] # parameters for ρ, r
dprob = DiscreteProblem(u0, tspan, ps)

delay_trigger_affect! = function (integrator, rng)
return append!(integrator.de_chan[1], τ)
append!(integrator.de_chan[1], τ)
end
delay_trigger = Dict(1 => delay_trigger_affect!)
delay_complete = Dict(1 => [2 => 1, 3 => -1])
Expand Down

0 comments on commit 3b40ce1

Please sign in to comment.