DynamicGridsInteract.jl

DynamicGridsInteract.DynamicGridsInteractModule

DynamicGridsInteract

Build Status Codecov

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

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)

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, 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 second
  • showfps::Real: maximum displayed frames per second
  • store::Bool: store the simulation frames to be used afterwards
  • `processor::GridProcessor
  • minval::Number: Minimum value to display in the simulation
  • maxval::Number: Maximum value to display in the simulation
source
DynamicGridsInteract.ServerOutputType

A 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.

source
DynamicGridsInteract.ServerOutputMethod
ServerOutput(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 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