DynamicGridsInteract.jl
DynamicGridsInteract.DynamicGridsInteract
— ModuleDynamicGridsInteract
Provides web interfaces for visualising and interacting with simulations from DynamicGrids.jl, and for packages that build on it like Dispersal.jl.
The basic InteractOutput
works in Jupyter notebooks and the atom plot pane, and also serves as the core component of other outputs. A Mux.jl web server ServerOutput
and a Blink.jl electron app ElectronOutput
are also included.
To use:
using DynamicGrids, DynamicGridsInteract
output = InteractOutput(init, ruleset;
tspan=(1, 100),
store=false,
processor=ColorProcessor()
)
display(output)
Where init
is either the initial array(s) for the simulation, ruleset is the Ruleset
to run in simulations.
To show the interface in the Atom plot pane, run display(output)
.
The interface also provides control of the simulation, using Interact.jl. It will automatically generate sliders for the parameters of the Ruleset
, even for user-defined rules.
To define range limits for sliders, use the @limits
macro from FieldMetadata.jl. Fields to be ignored can be marked with false
using the @flatten
macro, and descriptions for hover text use @description
.
Documentation
See the documentation for DynamicGrids.jl
DynamicGridsInteract.ElectronOutput
— TypeElectronOutput(init, ruleset::Ruleset; kwargs...)
A html output using Interact.jl and an Electron window through Blink.jl ElectronOutput automatically generates sliders to control simulations in realtime. args and kwargs are passed to InteractOutput
.
Example
using Blink
ElectronOutput(init, ruleset)
Arguments
init
: initialisation array, orNamedTuple
of arraysruleset::Ruleset
: A DynamicGridsRuleset
Keyword arguments are passed to InteractOutput
.
DynamicGridsInteract.InteractOutput
— TypeInteractOutput(init, ruleset; fps=25, showfps=fps, store=false,
processor=ColorProcessor(), minval=nothing, maxval=nothing,
extrainit=Dict())
An Output
for Atom/Juno and Jupyter notebooks, and the back-end for ElectronOutput
and ServerOutput
.
Arguments:
init
: an Array or NamedTuple of arrays.ruleset
: the ruleset to run in the interface simulations.
Keyword Arguments:
fps::Real
: frames per secondshowfps::Real
: maximum displayed frames per secondstore::Bool
: store the simulation frames to be used afterwards- `processor::GridProcessor
minval::Number
: Minimum value to display in the simulationmaxval::Number
: Maximum value to display in the simulation
DynamicGridsInteract.ServerOutput
— TypeA basic Mux.jl webserver, serving the same pages as ElectronOutput, but served for a multiple outputs in a local browser or the web.
ServerOutput automatically generates sliders to control simulaitons in realtime. Unlike ElectronOutput, the modifications are not written back to the original rulset. Each page load gets a identical initialised rulset.
DynamicGridsInteract.ServerOutput
— MethodServerOutput(frames, rulset, args...; fps=25, port=8080)
Builds a ServerOutput and serves the standard web interface for rulset simulations at the chosen port.
Arguments
init
:AbstractArray
orNamedTuple
ofArray
ruleset::Models
: tuple of rulset wrapped in Models().
Keyword arguments
port
: port number to reach the server. ie localhost:8080kwargs
: keyword arguments to be passed toInteractOuput
.
DynamicGridsInteract.AbstractInteractOutput
— TypeAbstract supertype of Interact outputs including InteractOuput
and ElectronOutput