An alternative implementation of #18 for sake of demonstration. Similar to #18, the goal is to allow the contact partitioning processing to ingest a travel_fp with a date column, and generate a time-varying contact matrix contact_xr at every step of the simulation.
The implementation in #18 provides a new process TravelManager that wraps the Partition class. While this is nonstandard paradigm in the xsimlab ecosystem, it is a perfectly viable implementation. It essentially uses Partition as an attr.s decorated class, rather than an xsimlab process (xsimlab.process decorated class).
The implementation in this PR does not create a TravelManager process, but instead modifies the existing Partition class. Methods such as probabilistic_partition, partitions_to_contacts, and contact_matrix were moved from the initialize to the run_step method so that they are run at every step. In addition, run_step performs the date indexing that is handled by TravelManager.subset_date, generating a travel_df that changes at every step.
An alternative implementation of #18 for sake of demonstration. Similar to #18, the goal is to allow the contact partitioning processing to ingest a
travel_fp
with a date column, and generate a time-varying contact matrixcontact_xr
at every step of the simulation.The implementation in #18 provides a new process
TravelManager
that wraps thePartition
class. While this is nonstandard paradigm in the xsimlab ecosystem, it is a perfectly viable implementation. It essentially usesPartition
as anattr.s
decorated class, rather than an xsimlab process (xsimlab.process
decorated class).The implementation in this PR does not create a
TravelManager
process, but instead modifies the existingPartition
class. Methods such asprobabilistic_partition
,partitions_to_contacts
, andcontact_matrix
were moved from theinitialize
to therun_step
method so that they are run at every step. In addition,run_step
performs the date indexing that is handled byTravelManager.subset_date
, generating atravel_df
that changes at every step.