metawards.utils.get_functions

metawards.utils.get_functions(stage: str, network: Union[metawards._network.Network, metawards._networks.Networks], population: metawards._population.Population, infections: metawards._infections.Infections, output_dir: metawards._outputfiles.OutputFiles, workspace: metawards._workspace.Workspace, iterator: Callable[[], None], extractor: Callable[[], None], mixer: Callable[[], None], mover: Callable[[], None], rngs, nthreads, profiler: metawards.utils._profiler.Profiler, trajectory: metawards._population.Populations = None, results=None) → List[Callable[[], None]][source]

Return the functions that must be called for the specified stage of the day;

  • “initialise”: model initialisation. Called once before the

    whole model run is performed

  • “setup”: day setup. Called once at the start of the day.

    Should be used to import new seeds, move populations between demographics, move infected individuals through disease stages etc. There is no calculation performed at this stage.

  • “foi”: foi calculation. Called to recalculate the force of infection

    (foi) for each ward in the network (and subnetworks). This is calculated based on the populations in each state in each ward in each demographic

  • “infect”: Called to advance the outbreak by calculating

    the number of new infections

  • “analyse”: Called at the end of the day to analyse

    the data and extract the results

  • “finalise”: Called at the end of the model run to finalise

    any outputs or produce overall summary files

  • “summary”: Called at the end of lots of model runs, to write

    overview summary files. Only the extractor has a summary stage

Parameters
  • stage (str) – The stage of the day/model for which to get the functions

  • network (Network or Networks) – The network(s) to be modelled

  • population (Population) – The population experiencing the outbreak

  • infections (Infections) – Space to record the infections through the day

  • iterator (function) – Iterator used to obtain the function used to advance the outbreak

  • extractor (function) – Extractor used to analyse the data and output results

  • mixer (function) – Mixer used to mix and merge data between different demographics

  • mover (function) – Mover used to move populations between demographics

  • rngs (list[random number generate pointers]) – Pointers to the random number generators to use for each thread

  • nthreads (int) – The number of threads to use to run the model

  • profiler (Profiler) – The profiler used to profile the calculation

Returns

functions – The list of all functions that should be called for this stage of the day

Return type

List[MetaFunction]