Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust test calls to use Python interface #234

Merged
merged 1 commit into from
Jan 10, 2023

Conversation

p-robot
Copy link
Contributor

@p-robot p-robot commented Dec 20, 2022

Adjusted main test files to call the Python interface instead of the C executable. This removes any calls of subprocess module. This is in reference to issue #146.

Some minor formatting of tests also included in these commits.

Outstanding tests are those in tests/test_infection_dynamics.py and conftest.py. These will be amended in a future commit (as they require a more involved restructure as they have functions that pass parameter objects etc).

@p-robot p-robot added test New or enhanced tests of the model dependencies Pull requests that update a dependency file labels Dec 20, 2022
@roberthinch
Copy link
Collaborator

Good job removing all the very old ways of calling the model.

We could go one step further and remove all file calls completely (this is what I do with the R interface, although I've implemented for the Python interface as well). Look at /src/COVID19/model.py where you can use:

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

Where params is a dictionary of overrides to the default parameters.

You also have:

model.get_individuals()
model.get_transmissions()

which directly returns dataframes from the C model object as opposed to going via files.

I've not yet implemented for the interactions (probably worth doing) or trace tokens (probably not worth doing).

@roberthinch roberthinch merged commit ee2f2c0 into BDI-pathogens:master Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file test New or enhanced tests of the model
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants