BDI-pathogens / OpenABM-Covid19

OpenABM-Covid19: an agent-based model for modelling the spread of SARS-CoV-2 (coronavirus) and control interventions for the Covid-19 epidemic
GNU General Public License v3.0
111 stars 76 forks source link

Simplify Python Code when Running a Model #195

Closed roberthinch closed 3 years ago

roberthinch commented 3 years ago

This PR simplifies the code required to run a model by including default parameters if no parameters/parameters files are specified. The Python Model class also has a run() method now which runs the simulation to the end time and results are collected. The 2 changes means a whole simulation can be created with a few lines of code once the Python package is installed (which now includes default data).

import COVID19.model as abm model = abm.Model( params = { "n_total" : 10000, "end_time": 20 } ) print( model.run() )

The change is fully backwards compatible with no changes to current behaviour.