Skip to content

Commit bebb035

Browse files
committed
reapply formatter
1 parent 1a24034 commit bebb035

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+761
-723
lines changed

.JuliaFormatter.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
style = "sciml"
2-
format_markdown = true
2+
format_markdown = true
3+
format_docstrings = true

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ mathengine = MathJax3(Dict(:loader => Dict("load" => ["[tex]/require", "[tex]/ma
1414
"ams",
1515
"autoload",
1616
"mathtools",
17-
"require",
17+
"require"
1818
])))
1919

2020
makedocs(sitename = "JumpProcesses.jl",

docs/pages.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ pages = ["index.md",
1010
"Type Documentation" => Any["Jumps, JumpProblem, and Aggregators" => "jump_types.md",
1111
"Jump solvers" => "jump_solve.md"],
1212
"FAQ" => "faq.md",
13-
"API" => "api.md",
13+
"API" => "api.md"
1414
]

docs/src/applications/advanced_point_process.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ processes connected to it by ``alpha``. This influence will then decrease at
190190
rate ``\beta``.
191191

192192
The conditional intensity of this process has a recursive formulation which we
193-
can use to our advantage to significantly speed simulation. Let ``t_{N_i} = \max
194-
\{t_{n_j} < t \mid j \in E_i\}`` and ``\phi_i^\ast(t)`` below.
193+
can use to our advantage to significantly speed simulation. Let ``t_{N_i} = \max \{t_{n_j} < t \mid j \in E_i\}`` and ``\phi_i^\ast(t)`` below.
195194

196195
```math
197196
\begin{split}
@@ -224,8 +223,7 @@ end
224223
nothing # hide
225224
```
226225

227-
We assume that each sup-process `i` is a marked TPP. With probability ``(1 -
228-
\omega^\ast(t))``, we draw a mark from a 2-dimensional Gaussian
226+
We assume that each sup-process `i` is a marked TPP. With probability ``(1 - \omega^\ast(t))``, we draw a mark from a 2-dimensional Gaussian
229227
distribution centered in ``\mu_i`` with ``\sigma_1`` standard deviation; and
230228
with probability ``\omega^\ast(t)`` we draw from a 2-dimensional Gaussian
231229
distribution centered on the last location visited by ``i`` with ``\sigma_2``
@@ -321,7 +319,7 @@ using Graphs
321319
using Distributions
322320
V = 10
323321
G = erdos_renyi(V, 0.2)
324-
g = [[[i] ; neighbors(G, i)] for i in 1:nv(G)]
322+
g = [[[i]; neighbors(G, i)] for i in 1:nv(G)]
325323
mark_dist = [MvNormal(rand(2), [0.2, 0.2]) for i in 1:nv(G)]
326324
jumps = [hawkes_jump(i, g, mark_dist) for i in 1:nv(G)]
327325
tspan = (0.0, 50.0)
@@ -330,7 +328,7 @@ hawkes = SciMLPointProcess{
330328
eltype(jumps),
331329
typeof(g),
332330
eltype(mark_dist),
333-
eltype(tspan),
331+
eltype(tspan)
334332
}(jumps,
335333
mark_dist,
336334
g,
@@ -342,8 +340,7 @@ hawkes = SciMLPointProcess{
342340
## [Sampling](@id tpp_sampling)
343341

344342
JumpProcesses shines in the simulation of SDEs with discontinuous jumps. The
345-
mapping we introduced in the [previous Section](@ref tpp_theory) whereby ``du =
346-
dN(t)`` implies that JumpProcesses also excels in simulating TPPs.
343+
mapping we introduced in the [previous Section](@ref tpp_theory) whereby ``du = dN(t)`` implies that JumpProcesses also excels in simulating TPPs.
347344

348345
JumpProcesses offers a plethora of simulation algorithms for TPPs. The library
349346
call them _aggregators_ because these algorithms are methods for aggregating

docs/src/index.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,26 @@ As jump and point processes are often considered from a variety of perspectives
2222
across different fields, JumpProcesses provides three tutorials on using the
2323
package for those with different backgrounds:
2424

25-
- [Simulating basic Poisson processes](@ref poisson_proc_tutorial)
26-
- [Simulating jump processes via SSAs (i.e., Gillespie methods)](@ref ssa_tutorial)
27-
- [Simulating temporal point processes (TPPs)](@ref tpp_tutorial)
25+
- [Simulating basic Poisson processes](@ref poisson_proc_tutorial)
26+
- [Simulating jump processes via SSAs (i.e., Gillespie methods)](@ref ssa_tutorial)
27+
- [Simulating temporal point processes (TPPs)](@ref tpp_tutorial)
2828

2929
These tutorials also explain the types of jump/point processes that can be
3030
mathematically modelled with JumpProcesses.jl. For more complicated models that
3131
couple ODEs and/or SDEs with continuous noise to jump processes, we provide a
3232
tutorial on
3333

34-
- [Simulating jump-diffusion processes](@ref jump_diffusion_tutorial)
34+
- [Simulating jump-diffusion processes](@ref jump_diffusion_tutorial)
3535

3636
For jump processes that involve spatial transport on a graph/mesh, such
3737
as Reaction-Diffusion Master Equation models, we provide a tutorial on
3838

39-
- [Spatial SSAs](@ref Spatial-SSAs-with-JumpProcesses.jl)
39+
- [Spatial SSAs](@ref Spatial-SSAs-with-JumpProcesses.jl)
4040

4141
Finally, we provide application tutorials which are more extensive tutorials that
4242
interface with other libraries going deeper into a topic.
4343

44-
- [Temporal Point Processes (TPP) with JumpProcesses and PointProcesses](@ref tpp_advanced)
44+
- [Temporal Point Processes (TPP) with JumpProcesses and PointProcesses](@ref tpp_advanced)
4545

4646
We provide a mathematical overview of the library below, but note users may also
4747
skip to the appropriate tutorial listed above to get started with using
@@ -73,6 +73,7 @@ can then generate exact realizations of pure jump processes of the form
7373
```math
7474
du = \sum_{i=1}^I h_i(u,p,t) \, dN_i(t),
7575
```
76+
7677
where ``h_i(u,p,t)`` represents the amount that ``u(t)`` changes when ``N_i(t)``
7778
jumps. JumpProcesses encodes such changes via a user-provided `affect!`
7879
function, which allows even more general changes to the state, ``u(t)``, when
@@ -146,7 +147,7 @@ Pkg.add("JumpProcesses")
146147

147148
- See the [SciML Style Guide](https://github.com/SciML/SciMLStyle) for common coding practices and other style decisions.
148149
- There are a few community forums for getting help and asking questions:
149-
150+
150151
+ The #diffeq-bridged and #sciml-bridged channels in the
151152
[Julia Slack](https://julialang.org/slack/)
152153
+ The #diffeq-bridged and #sciml-bridged channels in the

docs/src/tutorials/discrete_stochastic_example.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,11 @@ latter determining the affect function.
453453
rateidxs = [1, 2] # i.e., [β, ν]
454454
reactant_stoich = [
455455
[1 => 1, 2 => 1], # 1*S and 1*I
456-
[2 => 1], # 1*I
456+
[2 => 1] # 1*I
457457
]
458458
net_stoich = [
459459
[1 => -1, 2 => 1], # -1*S and 1*I
460-
[2 => -1, 3 => 1], # -1*I and 1*R
460+
[2 => -1, 3 => 1] # -1*I and 1*R
461461
]
462462
mass_act_jump = MassActionJump(reactant_stoich, net_stoich; param_idxs = rateidxs)
463463
```

docs/src/tutorials/point_process_simulation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ and hence the dependencies of `seasonal_process` are only `[2]`.
231231
Therefore, we obtain the following dependency graph:
232232

233233
```@example tpp-tutorial
234-
dep_graph = [[1,2], [2]]
234+
dep_graph = [[1, 2], [2]]
235235
```
236236

237237
We can then construct the corresponding problem `JumpProblem`, passing our

ext/JumpProcessFastBroadcastExt.jl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@ module JumpProcessFastBroadcastExt
33
using JumpProcesses, FastBroadcast
44

55
@inline function FastBroadcast.fast_materialize!(::FastBroadcast.False, ::DB, dst::EJA,
6-
bc::Base.Broadcast.Broadcasted{S}) where {
7-
S,
8-
DB,
9-
EJA <:
10-
ExtendedJumpArray
11-
}
6+
bc::Base.Broadcast.Broadcasted{S}) where {
7+
S,
8+
DB,
9+
EJA <:
10+
ExtendedJumpArray
11+
}
1212
FastBroadcast.fast_materialize!(FastBroadcast.False(), DB(), dst.u,
13-
JumpProcesses.repack(bc, Val(:u)))
13+
JumpProcesses.repack(bc, Val(:u)))
1414
FastBroadcast.fast_materialize!(FastBroadcast.False(), DB(), dst.jump_u,
15-
JumpProcesses.repack(bc, Val(:jump_u)))
15+
JumpProcesses.repack(bc, Val(:jump_u)))
1616
dst
1717
end
1818

1919
@inline function FastBroadcast.fast_materialize!(::FastBroadcast.True, ::DB, dst::EJA,
20-
bc::Base.Broadcast.Broadcasted{S}) where {
21-
S,
22-
DB,
23-
EJA <:
24-
ExtendedJumpArray
25-
}
20+
bc::Base.Broadcast.Broadcasted{S}) where {
21+
S,
22+
DB,
23+
EJA <:
24+
ExtendedJumpArray
25+
}
2626
FastBroadcast.fast_materialize!(FastBroadcast.True(), DB(), dst.u,
27-
JumpProcesses.repack(bc, Val(:u)))
27+
JumpProcesses.repack(bc, Val(:u)))
2828
FastBroadcast.fast_materialize!(FastBroadcast.True(), DB(), dst.jump_u,
29-
JumpProcesses.repack(bc, Val(:jump_u)))
29+
JumpProcesses.repack(bc, Val(:jump_u)))
3030
dst
3131
end
3232

src/SSA_stepper.jl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ function DiffEqBase.u_modified!(integrator::SSAIntegrator, bool::Bool)
108108
end
109109

110110
function DiffEqBase.__solve(jump_prob::JumpProblem,
111-
alg::SSAStepper;
112-
kwargs...)
111+
alg::SSAStepper;
112+
kwargs...)
113113
integrator = init(jump_prob, alg; kwargs...)
114114
solve!(integrator)
115115
integrator.sol
@@ -145,15 +145,15 @@ function DiffEqBase.solve!(integrator::SSAIntegrator)
145145
end
146146

147147
function DiffEqBase.__init(jump_prob::JumpProblem,
148-
alg::SSAStepper;
149-
save_start = true,
150-
save_end = true,
151-
seed = nothing,
152-
alias_jump = Threads.threadid() == 1,
153-
saveat = nothing,
154-
callback = nothing,
155-
tstops = eltype(jump_prob.prob.tspan)[],
156-
numsteps_hint = 100)
148+
alg::SSAStepper;
149+
save_start = true,
150+
save_end = true,
151+
seed = nothing,
152+
alias_jump = Threads.threadid() == 1,
153+
saveat = nothing,
154+
callback = nothing,
155+
tstops = eltype(jump_prob.prob.tspan)[],
156+
numsteps_hint = 100)
157157
if !(jump_prob.prob isa DiscreteProblem)
158158
error("SSAStepper only supports DiscreteProblems.")
159159
end
@@ -184,9 +184,9 @@ function DiffEqBase.__init(jump_prob::JumpProblem,
184184
end
185185

186186
sol = DiffEqBase.build_solution(prob, alg, t, u, dense = false,
187-
calculate_error = false,
188-
stats = DiffEqBase.Stats(0),
189-
interp = DiffEqBase.ConstantInterpolation(t, u))
187+
calculate_error = false,
188+
stats = DiffEqBase.Stats(0),
189+
interp = DiffEqBase.ConstantInterpolation(t, u))
190190
save_everystep = any(cb.save_positions)
191191

192192
if saveat isa Number
@@ -217,8 +217,8 @@ function DiffEqBase.__init(jump_prob::JumpProblem,
217217
error("The time interval to solve over is non-increasing, i.e. tspan[2] <= tspan[1]. This is not allowed for pure jump problem.")
218218

219219
integrator = SSAIntegrator(prob.f, copy(prob.u0), prob.tspan[1], prob.tspan[1], tdir,
220-
prob.p, sol, 1, prob.tspan[1], cb, _saveat, save_everystep,
221-
save_end, cur_saveat, opts, tstops, 1, false, true)
220+
prob.p, sol, 1, prob.tspan[1], cb, _saveat, save_everystep,
221+
save_end, cur_saveat, opts, tstops, 1, false, true)
222222
cb.initialize(cb, integrator.u, prob.tspan[1], integrator)
223223
DiffEqBase.initialize!(opts.callback, integrator.u, prob.tspan[1], integrator)
224224
integrator
@@ -235,7 +235,7 @@ end
235235
# The Jump aggregators should not register the next jump through add_tstop! for SSAIntegrator
236236
# such that we can achieve maximum performance
237237
@inline function register_next_jump_time!(integrator::SSAIntegrator,
238-
p::AbstractSSAJumpAggregator, t)
238+
p::AbstractSSAJumpAggregator, t)
239239
integrator.tstop = p.next_jump_time
240240
nothing
241241
end
@@ -279,7 +279,7 @@ function DiffEqBase.step!(integrator::SSAIntegrator)
279279

280280
if !(integrator.opts.callback.discrete_callbacks isa Tuple{})
281281
discrete_modified, saved_in_cb = DiffEqBase.apply_discrete_callback!(integrator,
282-
integrator.opts.callback.discrete_callbacks...)
282+
integrator.opts.callback.discrete_callbacks...)
283283
else
284284
saved_in_cb = false
285285
end

src/aggregators/aggregated_api.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,41 @@ Notes
1111
vector is unchanged, this can safely be set to false to improve performance.
1212
"""
1313
function reset_aggregated_jumps!(integrator, uprev = nothing; update_jump_params = true,
14-
kwargs...)
14+
kwargs...)
1515
reset_aggregated_jumps!(integrator, uprev, integrator.opts.callback,
16-
update_jump_params = update_jump_params, kwargs...)
16+
update_jump_params = update_jump_params, kwargs...)
1717
nothing
1818
end
1919

2020
function reset_aggregated_jumps!(integrator, uprev, callback::Nothing;
21-
update_jump_params = true, kwargs...)
21+
update_jump_params = true, kwargs...)
2222
nothing
2323
end
2424

2525
function reset_aggregated_jumps!(integrator, uprev, callback::CallbackSet;
26-
update_jump_params = true, kwargs...)
26+
update_jump_params = true, kwargs...)
2727
if !isempty(callback.discrete_callbacks)
2828
reset_aggregated_jumps!(integrator, uprev, callback.discrete_callbacks...,
29-
update_jump_params = update_jump_params, kwargs...)
29+
update_jump_params = update_jump_params, kwargs...)
3030
end
3131
nothing
3232
end
3333

3434
function reset_aggregated_jumps!(integrator, uprev, cb::DiscreteCallback, cbs...;
35-
update_jump_params = true, kwargs...)
35+
update_jump_params = true, kwargs...)
3636
if cb.condition isa AbstractSSAJumpAggregator
3737
maj = cb.condition.ma_jumps
3838
update_jump_params && using_params(maj) &&
3939
update_parameters!(cb.condition.ma_jumps, integrator.p; kwargs...)
4040
cb.condition(cb, integrator.u, integrator.t, integrator)
4141
end
4242
reset_aggregated_jumps!(integrator, uprev, cbs...;
43-
update_jump_params = update_jump_params, kwargs...)
43+
update_jump_params = update_jump_params, kwargs...)
4444
nothing
4545
end
4646

4747
function reset_aggregated_jumps!(integrator, uprev, cb::DiscreteCallback;
48-
update_jump_params = true, kwargs...)
48+
update_jump_params = true, kwargs...)
4949
if cb.condition isa AbstractSSAJumpAggregator
5050
maj = cb.condition.ma_jumps
5151
update_jump_params && using_params(maj) &&

src/aggregators/aggregators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ algorithm with optimal binning, Journal of Chemical Physics 143, 074108
164164
struct DirectCRDirect <: AbstractAggregatorAlgorithm end
165165

166166
const JUMP_AGGREGATORS = (Direct(), DirectFW(), DirectCR(), SortingDirect(), RSSA(), FRM(),
167-
FRMFW(), NRM(), RSSACR(), RDirect(), Coevolve())
167+
FRMFW(), NRM(), RSSACR(), RDirect(), Coevolve())
168168

169169
# For JumpProblem construction without an aggregator
170170
struct NullAggregator <: AbstractAggregatorAlgorithm end

src/aggregators/bracketing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ get brackets for the rate of reaction rx by first checking if the reaction is a
6363
return get_majump_brackets(p.ulow, p.uhigh, rx, ma_jumps)
6464
else
6565
@inbounds return get_cjump_brackets(p.ulow, p.uhigh, p.rates[rx - num_majumps],
66-
params, t)
66+
params, t)
6767
end
6868
end
6969

0 commit comments

Comments
 (0)