BAM Engine 0.9.0 redesigns the results collection API, making simulation
data easier to access and explore. A follow-up patch (0.9.1) adds a
log_level convenience parameter.
Intuitive Data Access#
Accessing simulation results no longer requires remembering which dictionary to look in. You can now use string keys or attribute chains:
results = sim.run(n_periods=1000)
# String-key access
results["Producer.production"]
results["Economy.inflation"]
# Attribute access
results.Producer.price
results.Economy.avg_mkt_priceThe new results.get() method supports on-demand aggregation, replacing the
now-deprecated get_array():
results.get("Producer", "price", aggregate="mean") # 1D mean across agentsTwo discovery helpers let you inspect what data is available:
results.available(): lists all collected fields after a run.sim.collectables(): lists what can be collected before callingrun().
See the data collection guide for full details.
Unaggregated Data by Default#
sim.run() now returns results by default (collect=True, previously
collect=False), and the collected data is unaggregated: full 2D arrays
with shape (n_periods, n_agents) instead of pre-averaged 1D arrays. This
gives you access to complete agent-level detail. Use
results.get(..., aggregate="mean") when you need the old aggregated form.
Economy-level metrics (average price, inflation) are always captured
automatically when collection is active, so "Economy": True is no longer
needed in collect dicts.
Simpler Logging (0.9.1)#
Silencing log output used to require the verbose
logging={"default_level": "WARNING"} dict. Version 0.9.1 adds a shorthand:
sim = bam.Simulation.init(seed=42, log_level="WARNING")The full logging dict remains available for advanced use cases like per-event
log levels.
Upgrading#
pip install --upgrade bamengine