Skip to content
This repository was archived by the owner on Jun 21, 2024. It is now read-only.

Commit 415b3c2

Browse files
committed
allow keyword propagation to the record function in Agents
1 parent 5574cfb commit 415b3c2

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "InteractiveDynamics"
22
uuid = "ec714cd0-5f51-11eb-0b6e-452e7367ff84"
33
repo = "https://github.com/JuliaDynamics/InteractiveDynamics.jl.git"
4-
version = "0.21.7"
4+
version = "0.21.8"
55

66
[deps]
77
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"

src/agents/convenience.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,16 @@ The plotting is identical as in [`abmplot`](@ref) and applicable keywords are pr
119119
* `showstep = true`: If current step should be shown in title.
120120
* `figure = NamedTuple()`: Figure related keywords (e.g. resolution, backgroundcolor).
121121
* `axis = NamedTuple()`: Axis related keywords (e.g. aspect).
122+
* `recordkwargs = NamedTuple()`: Keyword arguments given to `Makie.record`.
123+
You can use `(compression = 1, profile = "high")` for a higher quality output,
124+
and prefer the `CairoMakie` backend.
125+
(compression 0 results in videos that are not playable by some software)
122126
* `kwargs...`: All other keywords are propagated to [`abmplot`](@ref).
123127
"""
124128
function abmvideo(file, model, agent_step!, model_step! = Agents.dummystep;
125129
spf = 1, framerate = 30, frames = 300, title = "", showstep = true,
126-
figure = (resolution = (600, 600),), axis = NamedTuple(), kwargs...
130+
figure = (resolution = (600, 600),), axis = NamedTuple(),
131+
recordkwargs = (compression = 20,), kwargs...
127132
)
128133
# add some title stuff
129134
s = Observable(0) # counter of current step
@@ -141,7 +146,7 @@ function abmvideo(file, model, agent_step!, model_step! = Agents.dummystep;
141146

142147
resize_to_layout!(fig)
143148

144-
record(fig, file; framerate) do io
149+
record(fig, file; framerate, recordkwargs...) do io
145150
for j in 1:frames-1
146151
recordframe!(io)
147152
Agents.step!(abmobs, spf)

0 commit comments

Comments
 (0)