Skip to content

Commit

Permalink
USe CairoMakie
Browse files Browse the repository at this point in the history
  • Loading branch information
TorkelE committed Jul 12, 2024
1 parent ab0bd39 commit cc7042b
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The expansion of `ReactionSystem` models to spatial lattices have been enabled.
simple example where a Brusselator model is expanded to a 20x20 grid of compartments, with diffusion
for species X, and then simulated using ODEs. Finally, an animation of the simulation is created.
```julia
using Catalyst, GLMakie, OrdinaryDiffEq
using Catalyst, CairoMakie, OrdinaryDiffEq

# Create `LatticeReactionSystem` model.
brusselator = @reaction_network begin
Expand Down
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
[weakdeps]
BifurcationKit = "0f109fa4-8a5d-4b75-95aa-f515264e7665"
HomotopyContinuation = "f213a82b-91d6-5c5d-acf7-10f1c761b327"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
StructuralIdentifiability = "220ca800-aa68-49bb-acd8-6037fa93a544"

[extensions]
CatalystBifurcationKitExtension = "BifurcationKit"
CatalystGLMakieExtension = "GLMakie"
CatalystCairoMakieExtension = "CairoMakie"
CatalystHomotopyContinuationExtension = "HomotopyContinuation"
CatalystStructuralIdentifiabilityExtension = "StructuralIdentifiability"

Expand Down Expand Up @@ -70,7 +70,7 @@ Graphviz_jll = "3c863552-8265-54e4-a6dc-903eb78fde85"
HomotopyContinuation = "f213a82b-91d6-5c5d-acf7-10f1c761b327"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Expand All @@ -88,4 +88,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[targets]
test = ["BifurcationKit", "DiffEqCallbacks", "DomainSets", "Graphviz_jll", "HomotopyContinuation", "Logging", "GLMakie", "NonlinearSolve", "OrdinaryDiffEq", "Plots", "Random", "SafeTestsets", "SciMLBase", "SciMLNLSolve", "StableRNGs", "StaticArrays", "Statistics", "SteadyStateDiffEq", "StochasticDiffEq", "StructuralIdentifiability", "Test", "Unitful"]
test = ["BifurcationKit", "DiffEqCallbacks", "DomainSets", "Graphviz_jll", "HomotopyContinuation", "Logging", "CairoMakie", "NonlinearSolve", "OrdinaryDiffEq", "Plots", "Random", "SafeTestsets", "SciMLBase", "SciMLNLSolve", "StableRNGs", "StaticArrays", "Statistics", "SteadyStateDiffEq", "StochasticDiffEq", "StructuralIdentifiability", "Test", "Unitful"]
4 changes: 2 additions & 2 deletions docs/src/spatial_modelling/lattice_simulation_plotting.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ oprob = ODEProblem(lrs, u0, tspan, ps)
sol = solve(oprob, FBDF())
nothing # hide
```
Next, we can animate it using the `lattice_animation` function, which requires the [GLMakie.jl](https://github.com/JuliaPlots/GLMakie.jl) package:
Next, we can animate it using the `lattice_animation` function, which requires the [CairoMakie.jl](https://github.com/JuliaPlots/CairoMakie.jl) package:
```@example lattice_plotting
using GLMakie
using CairoMakie
lattice_animation(sol, :X, "brusselator.mp4", lrs)
nothing # hide
```
Expand Down
9 changes: 9 additions & 0 deletions ext/CatalystCairoMakieExtension.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module CatalystCairoMakieExtension

# Fetch packages.
using Catalyst, CairoMakie

# Creates and exports hc_steady_states function.
include("CatalystCairoMakieExtension/cairo_makie_extension_spatial_modelling.jl")

end
9 changes: 0 additions & 9 deletions ext/CatalystGLMakieExtension.jl

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,8 @@ end
# Functions which in each sample point reshape the vector of values to the correct form (depending
# on the type of lattice used).
function reshape_vals(vals, lattice::CartesianGridRej{N, T}) where {N, T}
println(vals)
lattice.dims
return reshape(vals, lattice.dims...)
end
function reshape_vals(vals, lattice::AbstractSparseArray{Bool, Int64, 1})
Expand Down
2 changes: 1 addition & 1 deletion test/spatial_modelling/lattice_simulation_plotting.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Preparations ###

# Fetch packages.
using Catalyst, GLMakie, OrdinaryDiffEq, Test
using Catalyst, CairoMakie, OrdinaryDiffEq, Test

# Sets stable rng number.
using StableRNGs
Expand Down

0 comments on commit cc7042b

Please sign in to comment.