Skip to content

Access and modify model from Solara visualisation. #2176

@EwoutH

Description

@EwoutH

Let's say you're running the Solara visualisation in a Jupyter notebook. Currently you can initialize the visualisation, and then it initializes a model instance from a model class.

image

However, you can currently not:

  • Start Solara with an existing model
  • Directly access the model instance, to get variables or data (like model.datacollectors.get_model_vars_dataframe())
  • Perform model methods, like model.step().

Ideally you want full control of the model, and Solara just updating whatever the current state of the model is. All the buttons in Solara should access methods that are also accessible by Python.

I think one non-ideal design choice we made is initializing the model in the JupyterViz class itself (here). If it's initialized outside there, you can just pass the model instance instead of the class.

One way of approaching is being able to directly access page.model and do things from there.

There might be some overlap with Mesa-interactive / #1805 here (cc @Corvince).

cc @rht and @maartenbreddels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions