UT-Covid / episimlab

Framework for development of epidemiological models
https://ut-covid.github.io/episimlab/
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Model that uses Partition instead of PartitionFromNC #21

Closed ethho closed 3 years ago

ethho commented 3 years ago

Fixes #20.

ethho commented 3 years ago

Merged much of #24

ethho commented 3 years ago

Usage

This PR provides a script (scripts/20210512_partition_model.py) that constructs and runs two xsimlab.Models with contact partitioning. All benchmarks performed serially on MacBook Pro. poetry install first to set up test env.

  1. The first model uses the Partition2Contact process to transform travel and contacts dataframes (stored as CSV files) into the contact_xr DataArray.
    • Wall time benchmark (1 days, 1 steps)
      $ time PYTHONPATH='.' poetry run python scripts/20210512_partition_model.py --func-name partition_from_csv
      # ...
      50.24s user 14.34s system 99% cpu 1:04.60 total
    • This is significantly faster thanks to Dask refactor in #24
    • Extrapolating, estimated 83 minutes to run the 83 step ~ 3 month similar to the partition_from_nc model described below.
  2. The second model instead uses NC2Contact to load a precomputed contact_xr DataArray from a NetCDF file (example at tests/data/20200311_contact_matrix.nc).
    • Wall time benchmark (83 days, 83 steps)
      $ time PYTHONPATH='.' poetry run python scripts/20210512_partition_model.py --func-name partition_from_nc
      # ...
      6.19s user 1.26s system 82% cpu 9.037 total