DynamicGridsInteract.jl

DynamicGridsInteract.DynamicGridsInteractModule

DynamicGridsInteract

Build Status Codecov

DynamicGridsInteract 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 the atom plot pane and Jupyter notebooks, 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=ruleset,
    tspan=1:100, 
    store=false, 
    processor=ColorProcessor()
)
display(output)

Where init is the initial array(s) for the simulation and ruleset is the Ruleset to run in simulations.

To show the interface in the Atom plot pane, run display(output).

Interact

The interface 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 @bounds macro from FieldMetadata.jl on your struct. Fields to be ignored can be marked with false using the @flatten macro, and descriptions for hover text use @description.

source
DynamicGridsInteract.ElectronOutputType
ElectronOutput(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; tspan=(1, 100))

Arguments

  • init: initialisation array, or NamedTuple of arrays
  • ruleset::Ruleset: A DynamicGrids Ruleset

Keyword arguments are passed to InteractOutput.

source
DynamicGridsInteract.InteractOutputType
InteractOutput(init; ruleset, fps=25.0, 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: initialisation Array or NamedTuple of arrays.

Keyword Arguments:

  • ruleset: the ruleset to run in the interface simulations.
  • tspan: AbstractRange timespan for the simulation
  • fps::Real: frames per second to display the simulation
  • store::Bool: whether ot store the simulation frames for later use
  • `processor::GridProcessor
  • minval::Number: minimum value to display in the simulation
  • maxval::Number: maximum value to display in the simulation
source
DynamicGridsInteract.ServerOutputType
ServerOutput(frames, rulset, args...; port=8080, kwargs...)

A basic Mux.jl webserver, serving a InteractOutputs to the web.

Unlike ElectronOutput, the parameter modifications are not written back to the original rulset, and the simulations are not stored. Each page load gets a identical initialised rulset.

Arguments

  • init: AbstractArray or NamedTuple of Array
  • ruleset::Models: tuple of rulset wrapped in Models().

Keyword arguments

  • port: port number to reach the server. ie localhost:8080
  • kwargs: keyword arguments to be passed to InteractOuput.
source