Skip to content

Commit 29ec6da

Browse files
Merge pull request #140 from ChrisRackauckas/fix-formatting
Apply JuliaFormatter to fix code formatting
2 parents 650be02 + 7f131f6 commit 29ec6da

18 files changed

+171
-135
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ prodstoich = [0 2 0 1 3;
121121
1 0 0 1 0;
122122
0 0 1 0 0]
123123
mn = MatrixNetwork(pars, substoich, prodstoich; species = species,
124-
params = pars) # a matrix network
124+
params = pars) # a matrix network
125125
prn = loadrxnetwork(mn; name = :testnetwork) # dense version
126126

127127
# test the two networks are the same
@@ -138,7 +138,7 @@ incidencemat = [-1 1 0 0 0;
138138
0 0 0 0 -1;
139139
0 0 0 0 1]
140140
cmn = ComplexMatrixNetwork(pars, stoichmat, incidencemat; species = species,
141-
params = pars) # a complex matrix network
141+
params = pars) # a complex matrix network
142142
prn = loadrxnetwork(cmn)
143143

144144
# test the two networks are the same
@@ -149,11 +149,11 @@ The basic usages are
149149

150150
```julia
151151
mn = MatrixNetwork(rateexprs, substoich, prodstoich; species = Any[],
152-
params = Any[], t = nothing)
152+
params = Any[], t = nothing)
153153
prn = loadrxnetwork(mn::MatrixNetwork)
154154

155155
cmn = ComplexMatrixNetwork(rateexprs, stoichmat, incidencemat; species = Any[],
156-
params = Any[], t = nothing)
156+
params = Any[], t = nothing)
157157
prn = loadrxnetwork(cmn::ComplexMatrixNetwork)
158158
```
159159

@@ -171,18 +171,18 @@ reaction rate expressions. These two types have the following fields:
171171
involving parameters and species like `k*A`.
172172

173173
- matrix inputs
174-
174+
175175
+ For `MatrixNetwork`
176-
176+
177177
* `substoich`, a number of species by number of reactions matrix with entry
178178
`(i,j)` giving the stoichiometric coefficient of species `i` as a
179179
substrate in reaction `j`.
180180
* `prodstoich`, a number of species by number of reactions matrix with entry
181181
`(i,j)` giving the stoichiometric coefficient of species `i` as a product
182182
in reaction `j`.
183-
183+
184184
+ For `ComplexMatrixNetwork`
185-
185+
186186
* `stoichmat`, the complex stoichiometry matrix [defined
187187
here](https://docs.sciml.ai/Catalyst/stable/api/catalyst_api/#Catalyst.complexstoichmat).
188188
* `incidencemat`, the complex incidence matrix [defined

docs/make.jl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ cp(joinpath(docpath, "Project.toml"), joinpath(assetpath, "Project.toml"), force
99
include("pages.jl")
1010

1111
mathengine = MathJax3(Dict(:loader => Dict("load" => ["[tex]/require", "[tex]/mathtools"]),
12-
:tex => Dict("inlineMath" => [["\$", "\$"], ["\\(", "\\)"]],
13-
"packages" => [
14-
"base",
15-
"ams",
16-
"autoload",
17-
"mathtools",
18-
"require",
19-
])))
12+
:tex => Dict("inlineMath" => [["\$", "\$"], ["\\(", "\\)"]],
13+
"packages" => [
14+
"base",
15+
"ams",
16+
"autoload",
17+
"mathtools",
18+
"require"
19+
])))
2020

2121
makedocs(sitename = "ReactionNetworkImporters.jl",
22-
authors = "Samuel Isaacson",
23-
format = Documenter.HTML(; analytics = "UA-90474609-3",
24-
assets = ["assets/favicon.ico"],
25-
mathengine,
26-
prettyurls = (get(ENV, "CI", nothing) == "true"),
27-
canonical = "https://docs.sciml.ai/ReactionNetworkImporters/stable/"),
28-
modules = [ReactionNetworkImporters],
29-
checkdocs = :exports, warnonly = [:missing_docs],
30-
clean = true, doctest = false, pages = pages)
22+
authors = "Samuel Isaacson",
23+
format = Documenter.HTML(; analytics = "UA-90474609-3",
24+
assets = ["assets/favicon.ico"],
25+
mathengine,
26+
prettyurls = (get(ENV, "CI", nothing) == "true"),
27+
canonical = "https://docs.sciml.ai/ReactionNetworkImporters/stable/"),
28+
modules = [ReactionNetworkImporters],
29+
checkdocs = :exports, warnonly = [:missing_docs],
30+
clean = true, doctest = false, pages = pages)
3131

3232
deploydocs(repo = "github.com/SciML/ReactionNetworkImporters.jl.git";
33-
push_preview = true)
33+
push_preview = true)

docs/src/index.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Pkg.add("ReactionNetworkImporters")
3535

3636
- See the [SciML Style Guide](https://github.com/SciML/SciMLStyle) for common coding practices and other style decisions.
3737
- There are a few community forums:
38-
38+
3939
+ The #diffeq-bridged and #sciml-bridged channels in the
4040
[Julia Slack](https://julialang.org/slack/)
4141
+ The #diffeq-bridged and #sciml-bridged channels in the
@@ -133,7 +133,7 @@ prodstoich = [0 2 0 1 3;
133133
1 0 0 1 0;
134134
0 0 1 0 0]
135135
mn = MatrixNetwork(pars, substoich, prodstoich; species = species,
136-
params = pars) # a matrix network
136+
params = pars) # a matrix network
137137
prn = loadrxnetwork(mn) # dense version
138138

139139
# test the two networks are the same
@@ -150,7 +150,7 @@ incidencemat = [-1 1 0 0 0;
150150
0 0 0 0 -1;
151151
0 0 0 0 1]
152152
cmn = ComplexMatrixNetwork(pars, stoichmat, incidencemat; species = species,
153-
params = pars) # a complex matrix network
153+
params = pars) # a complex matrix network
154154
prn = loadrxnetwork(cmn; name = :testnetwork)
155155

156156
# test the two networks are the same
@@ -161,11 +161,11 @@ The basic usages are
161161

162162
```julia
163163
mn = MatrixNetwork(rateexprs, substoich, prodstoich; species = Any[],
164-
params = Any[], t = nothing)
164+
params = Any[], t = nothing)
165165
prn = loadrxnetwork(mn::MatrixNetwork)
166166

167167
cmn = ComplexMatrixNetwork(rateexprs, stoichmat, incidencemat; species = Any[],
168-
params = Any[], t = nothing)
168+
params = Any[], t = nothing)
169169
prn = loadrxnetwork(cmn::ComplexMatrixNetwork)
170170
```
171171

@@ -183,18 +183,18 @@ reaction rate expressions. These two types have the following fields:
183183
involving parameters and species like `k*A`.
184184

185185
- matrix inputs
186-
186+
187187
+ For `MatrixNetwork`
188-
188+
189189
* `substoich`, a number of species by number of reactions matrix, with entry
190190
`(i,j)` giving the stoichiometric coefficient of species `i` as a
191191
substrate in reaction `j`.
192192
* `prodstoich`, a number of species by number of reactions matrix, with entry
193193
`(i,j)` giving the stoichiometric coefficient of species `i` as a product
194194
in reaction `j`.
195-
195+
196196
+ For `ComplexMatrixNetwork`
197-
197+
198198
* `stoichmat`, the complex stoichiometry matrix [defined
199199
here](https://docs.sciml.ai/Catalyst/stable/api/catalyst_api/#Catalyst.complexstoichmat).
200200
* `incidencemat`, the complex incidence matrix [defined

examples/bcrssa_bench.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ rn = prn.rn
2828
tf = 20000.0
2929
jsys = convert(JumpSystem, rn)
3030
u0 = convert.(Int,
31-
ModelingToolkit.varmap_to_vars(ModelingToolkit.defaults(jsys), states(jsys)))
31+
ModelingToolkit.varmap_to_vars(ModelingToolkit.defaults(jsys), states(jsys)))
3232
dprob = DiscreteProblem(jsys, u0, (0.0, tf), [])
3333
@assert eltype(dprob.u0) <: Int
3434
jprob = JumpProblem(jsys, dprob, RSSACR(), save_positions = (false, false))

examples/not_updated_yet/bcr_odes_sparse.jl

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ rnbng = prnbng.rn;
3535
u0 = prnbng.u0;
3636
p = prnbng.p;
3737
@timeit to "baddodes" addodes!(rnbng; build_jac = build_jac, zeroout_jac = zeroout_jac,
38-
sparse_jac = sparse_jac, build_symfuncs = false,
39-
build_paramjac = false)
38+
sparse_jac = sparse_jac, build_symfuncs = false,
39+
build_paramjac = false)
4040
@timeit to "bODEProb" boprob=ODEProblem(rnbng, u0, (0.0, tf), p)
4141
u = copy(u0);
4242
du = similar(u);
@@ -52,13 +52,17 @@ function solve_dense(boprob, u, p, build_jac)
5252
show(to)
5353
println()
5454

55-
@timeit to "KenCarp4-LU-1" begin bsol = solve(boprob, KenCarp4(autodiff = false),
56-
abstol = 1e-8, reltol = 1e-8,
57-
saveat = 1.0) end
55+
@timeit to "KenCarp4-LU-1" begin
56+
bsol = solve(boprob, KenCarp4(autodiff = false),
57+
abstol = 1e-8, reltol = 1e-8,
58+
saveat = 1.0)
59+
end
5860
show(to)
59-
@timeit to "KenCarp4-LU-2" begin bsol = solve(boprob, KenCarp4(autodiff = false),
60-
abstol = 1e-8, reltol = 1e-8,
61-
saveat = 1.0) end
61+
@timeit to "KenCarp4-LU-2" begin
62+
bsol = solve(boprob, KenCarp4(autodiff = false),
63+
abstol = 1e-8, reltol = 1e-8,
64+
saveat = 1.0)
65+
end
6266
show(to)
6367

6468
bsol
@@ -71,17 +75,21 @@ function solve_sparse(boprob, u, p)
7175
show(to)
7276
println()
7377

74-
@timeit to "KenCarp4-SLU-1" begin bsol = solve(boprob,
75-
KenCarp4(autodiff = false,
76-
linsolve = LinSolveFactorize(lu)),
77-
saveat = 1.0, abstol = 1e-8,
78-
reltol = 1e-8) end
78+
@timeit to "KenCarp4-SLU-1" begin
79+
bsol = solve(boprob,
80+
KenCarp4(autodiff = false,
81+
linsolve = LinSolveFactorize(lu)),
82+
saveat = 1.0, abstol = 1e-8,
83+
reltol = 1e-8)
84+
end
7985
show(to)
80-
@timeit to "KenCarp4-SLU-2" begin bsol = solve(boprob,
81-
KenCarp4(autodiff = false,
82-
linsolve = LinSolveFactorize(lu)),
83-
saveat = 1.0, abstol = 1e-8,
84-
reltol = 1e-8) end
86+
@timeit to "KenCarp4-SLU-2" begin
87+
bsol = solve(boprob,
88+
KenCarp4(autodiff = false,
89+
linsolve = LinSolveFactorize(lu)),
90+
saveat = 1.0, abstol = 1e-8,
91+
reltol = 1e-8)
92+
end
8593
show(to)
8694

8795
bsol

examples/not_updated_yet/test_network.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ tf = 10.0
1919
# get the RSSA reaction network
2020
reset_timer!(to)
2121
@timeit to "netgen" prn=loadrxnetwork(RSSANetwork(), networkname, speciesf, rxsf;
22-
printrxs = false)
22+
printrxs = false)
2323
rn = prn.rn
2424
initialpop = prn.u0
2525
println("network parsed")
2626

2727
# get the BioNetGen reaction network
2828
@timeit to "bionetgen" prnbng=loadrxnetwork(BNGNetwork(), string(networkname, "bng"),
29-
bngfname)
29+
bngfname)
3030
rnbng = prnbng.rn;
3131
u0 = prnbng.u0;
3232
p = prnbng.p;

examples/not_updated_yet/test_odes.jl

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ rn = prnbng.rn;
1919
u0 = prnbng.u0;
2020
p = prnbng.p;
2121
@timeit to "addodes" addodes!(rn; build_jac = build_jac, sparse_jac = sparse_jac,
22-
build_symfuncs = false, build_paramjac = false)
22+
build_symfuncs = false, build_paramjac = false)
2323
@timeit to "ODEProb" oprob=ODEProblem(rn, u0, (0.0, tf), p)
2424
u = copy(u0);
2525
du = similar(u);
@@ -47,16 +47,24 @@ calck = true
4747
# @timeit to "CVODE_BDF-GMRES-2" begin sol = solve(oprob,CVODE_BDF(linear_solver=:GMRES),dense=dense, abstol=1e-8, reltol=1e-8); end;
4848

4949
# CVODE_BDF with LU
50-
@timeit to "CVODE_BDF-1" begin sol = solve(oprob, CVODE_BDF(), dense = dense, abstol = 1e-8,
51-
reltol = 1e-8) end;
50+
@timeit to "CVODE_BDF-1" begin
51+
sol = solve(oprob, CVODE_BDF(), dense = dense, abstol = 1e-8,
52+
reltol = 1e-8)
53+
end;
5254
show(to);
53-
@timeit to "CVODE_BDF-2" begin sol = solve(oprob, CVODE_BDF(), dense = dense, abstol = 1e-8,
54-
reltol = 1e-8) end;
55+
@timeit to "CVODE_BDF-2" begin
56+
sol = solve(oprob, CVODE_BDF(), dense = dense, abstol = 1e-8,
57+
reltol = 1e-8)
58+
end;
5559
show(to);
56-
@timeit to "KenCarp4-1" begin sol = solve(oprob, KenCarp4(autodiff = false), dense = dense,
57-
calck = calck, abstol = 1e-8, reltol = 1e-8) end;
60+
@timeit to "KenCarp4-1" begin
61+
sol = solve(oprob, KenCarp4(autodiff = false), dense = dense,
62+
calck = calck, abstol = 1e-8, reltol = 1e-8)
63+
end;
5864
show(to);
59-
@timeit to "KenCarp4-2" begin sol = solve(oprob, KenCarp4(autodiff = false), dense = dense,
60-
calck = calck, abstol = 1e-8, reltol = 1e-8) end;
65+
@timeit to "KenCarp4-2" begin
66+
sol = solve(oprob, KenCarp4(autodiff = false), dense = dense,
67+
calck = calck, abstol = 1e-8, reltol = 1e-8)
68+
end;
6169

6270
show(to)

examples/not_updated_yet/test_odes_rssa.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ reset_timer!(to)
1818

1919
# get the reaction network
2020
@timeit to "netgen" prn=loadrxnetwork(RSSAFile(), networkname, speciesf, rxsf;
21-
printrxs = false)
21+
printrxs = false)
2222
rn = prn.rn;
2323
initialpop = prn.u0;
2424
@timeit to "addodes" addodes!(rn; build_jac = false, build_symfuncs = false,
25-
build_paramjac = false)
25+
build_paramjac = false)
2626
@timeit to "ODEProb" oprob=ODEProblem(rn, convert.(Float64, initialpop), (0.0, tf))
2727
show(to)
2828
println()
@@ -40,8 +40,12 @@ println()
4040

4141
# CVODE_BDF with LU seems to finish, on my machine it takes upwards of 500 seconds
4242
reset_timer!(to);
43-
@timeit to "CVODE_BDF" begin sol = solve(oprob, CVODE_BDF(), dense = false) end;
43+
@timeit to "CVODE_BDF" begin
44+
sol = solve(oprob, CVODE_BDF(), dense = false)
45+
end;
4446
show(to);
4547
reset_timer!(to);
46-
@timeit to "CVODE_BDF" begin sol = solve(oprob, CVODE_BDF(), dense = false) end;
48+
@timeit to "CVODE_BDF" begin
49+
sol = solve(oprob, CVODE_BDF(), dense = false)
50+
end;
4751
show(to);

examples/test_bcr_odes.jl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fname = joinpath(datadir, "bcr.net")
1919
gdatfile = joinpath(datadir, "bcr.gdat")
2020
print("getting gdat file...")
2121
gdatdf = DataFrame(load(File(format"CSV", gdatfile), header_exists = true,
22-
spacedelim = true))
22+
spacedelim = true))
2323
println("done")
2424

2525
# we'll time the DiffEq solvers
@@ -57,11 +57,15 @@ println()
5757
# #reset_timer!(to); @timeit to "BNG_RODAS5_BDF" begin bsol2 = solve(boprob, rodas5(autodiff=false), saveat=1., abstol=1e-8, reltol=1e-8); end; show(to)
5858
#@timeit to "KenCarp4-1" begin sol = solve(boprob,KenCarp4(autodiff=false,linsolve=LinSolveFactorize(lu)), saveat=1., abstol=1e-8, reltol=1e-8); end; show(to)
5959
#@timeit to "KenCarp4-2" begin bsol = solve(boprob,KenCarp4(autodiff=false,linsolve=LinSolveFactorize(lu)), saveat=1., abstol=1e-8, reltol=1e-8); end; show(to)
60-
@timeit to "KenCarp4-1" begin sol = solve(boprob, KenCarp4(autodiff = false), abstol = 1e-8,
61-
reltol = 1e-8, saveat = 1.0) end;
60+
@timeit to "KenCarp4-1" begin
61+
sol = solve(boprob, KenCarp4(autodiff = false), abstol = 1e-8,
62+
reltol = 1e-8, saveat = 1.0)
63+
end;
6264
show(to);
63-
@timeit to "KenCarp4-2" begin bsol = solve(boprob, KenCarp4(autodiff = false),
64-
abstol = 1e-8, reltol = 1e-8, saveat = 1.0) end;
65+
@timeit to "KenCarp4-2" begin
66+
bsol = solve(boprob, KenCarp4(autodiff = false),
67+
abstol = 1e-8, reltol = 1e-8, saveat = 1.0)
68+
end;
6569
show(to);
6670

6771
# Activated Syk from DiffEq
@@ -70,9 +74,9 @@ show(to);
7074
if doplot
7175
plotlyjs()
7276
plot(gdatdf[!, :time][2:end], gdatdf[!, :Activated_Syk][2:end], xscale = :log10,
73-
label = "AsykGroup", linestyle = :dot)
77+
label = "AsykGroup", linestyle = :dot)
7478
plot!(bsol.t[2:end], sol[Activated_Syk][2:end], label = "Activated_Syk",
75-
xscale = :log10)
79+
xscale = :log10)
7680
end
7781

7882
# test the error, note may be large in abs value though small relatively

src/ReactionNetworkImporters.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct ParsedReactionNetwork
5757
groupstosyms::Any
5858
end
5959
function ParsedReactionNetwork(rn::ReactionSystem; u0 = nothing, p = nothing,
60-
varstonames = nothing, groupstosyms = nothing)
60+
varstonames = nothing, groupstosyms = nothing)
6161
ParsedReactionNetwork(rn, u0, p, varstonames, groupstosyms)
6262
end
6363

@@ -69,7 +69,6 @@ include("parsing_routines_matrixnetworks.jl")
6969

7070
export loadrxnetwork
7171

72-
7372
# Overload ensuring that u0 and u₀ can be used interchangeably.
7473
# (introduced when the u₀ field was changed to u0)
7574
# Should be deleted whenever u₀ is fully deprecated.

0 commit comments

Comments
 (0)