vis_tools.MigrationHelpers module

MigrationHelpers.py

This class contains static methods that are useful in the composition of infected migration animations. Namely collate_infected_human_migrations(), which trawls through a ReportHumanMigrationTracking report and combines that with a ReportEventRecorder report to find and create a data structure of the migrations of only infected individuals.

While there is currently only one method in this class, as other forms of migration culling are developed more methods will be added here as needed.

class vis_tools.MigrationHelpers.MigrationHelpers[source]

Bases: object

Helper functions for processing migrations.

static collate_infected_human_migrations(rpt_human_migs, rpt_evt_rec)[source]

Glean infected human migrations from two source files.

This function combines a ReportHumanMigrationTracking.csv and a ReportEventRecorder.csv to generate a set of infected human migrations.

Returns:

obj:

{
  infected_migrations: { ... },
  aggregate_migrations_max: n
}

where:

  • infected_migrations in the result is an dictionary where the keys are <timestep> and the values are objects with keys <from_node_id>-<to_node_id> and the values are the number of migrations at that timestep from from_node_id to to_node_id.

  • aggregate_migrations_max in the result is the most simultaneous migrations between any two nodes. This could be used for visualization, for example using a thicker line for more migrations.

Parameters:
  • rpt_human_migs (obj) – CSVReport of a ReportHumanMigrationTracking.

  • rpt_evt_rec (obj) – CSVReport of a ReportEventRecorder.