mesa_frames.DataCollector.__init__#

DataCollector.__init__(model: Model, model_reporters: dict[str, Callable] | None = None, agent_reporters: dict[str, str | Callable] | None = None, trigger: Callable[[Any], bool] | None = None, reset_memory: bool = True, storage: Literal['memory', 'csv', 'parquet', 'S3-csv', 'S3-parquet', 'postgresql'] = 'memory', storage_uri: str | None = None, schema: str = 'public', max_worker: int = 4)[source]#

Initialize the DataCollector with configuration options.

Parameters:
  • model (Model) – The model object from which data is collected.

  • model_reporters (dict[str, Callable] | None) – Functions to collect data at the model level.

  • agent_reporters (dict[str, str | Callable] | None) – Attributes or functions to collect data at the agent level.

  • trigger (Callable[[Any], bool] | None) – A function(model) -> bool that determines whether to collect data.

  • reset_memory (bool) – Whether to reset in-memory data after flushing. Default is True.

  • storage (Literal["memory", "csv", "parquet", "S3-csv", "S3-parquet", "postgresql" ]) – Storage backend URI (e.g. ‘memory:’, ‘csv:’, ‘postgresql:’).

  • storage_uri (str | None) – URI or path corresponding to the selected storage backend.

  • schema (str) – Schema name used for PostgreSQL storage.

  • max_worker (int) – Maximum number of worker threads used for flushing collected data asynchronously