djgroen / flee

flee agent-based modelling code
BSD 3-Clause "New" or "Revised" License
6 stars 7 forks source link

Implement Programmatic FLEE Execution #102

Closed nicleosch closed 5 months ago

nicleosch commented 8 months ago

Preliminary Information

Summary

This pull request introduces a new module, runner.py, containing a class, Simulation, that allows flee execution via function calls extending the previously used command line interface. The goal is to provide developers with a programmatic way to interact with flee within their applications.

Changes Made

How to Use

Developers can now utilize the runner.py module in their codebase to programmatically invoke the tool. Example usage:

from runscripts.runner import Simulation

# Create an instance of the Simulation class
sim = Simulation(input_dir, validation_dir, duration, simsettings)

# Invoke flee using the function call
output = sim.run()

# Process the output as needed

Benefits

Testing

Reviewer Checklist

djgroen commented 7 months ago

Okay. Overall I think this is a sensible change, although the contents of runner.py does overlap strongly with those of run.py and run_par.py, which are already widely used.

This is not a serious issue, but it just means that whenever we update the run functions, we will have to update this now in three places, not two, to prevent things from breaking.

Also, I think it would be good to mention this new functionality somewhere in the docs/ documentation. Perhaps it's worth adding that?

Lastly, I see that some of the tests are failing, but if they work then I'm happy to merge this in.