MetaWards.utils API Detail¶
Functions¶
|
Return whether the passed function accepts the “stage” argument, meaning that it can do different things for different day stages |
|
Add in metadata about the network that can be used to look up wards by name of location or region etc. |
|
Reads the location data in network.parameters.input_files.position and adds those locations to all of the nodes in the passed network. |
|
Aggregate all of the Susceptibles data from the demographic sub-networks into an overall total set of data that is stored in the overall network |
|
This function runs through and checks that the passed network is sane. |
|
Build the play matrix for the passed network |
|
Creates a network of wards using the information provided in the file specified in parameters.input_files.work. |
|
Call either ‘func’ or ‘parallel’ (depending on the number of threads, nthreads) on the passed Network, or on all demographic subnetworks |
|
Check if a newer version of MetaWards is available. |
|
Clears all infections associated with a model run |
|
This is a singleton class that provides access to printing and logging functions to the console. |
|
Create a new array.array of the specified size. |
|
Create a new array.array of the specified size. |
|
Create an array of python strings of size ‘size’, optionally initialised with ‘default’ |
|
Return a set of random number generators, one for each thread - these are seeded using the next ‘nthreads’ random numbers drawn from the passed generator |
|
Delete the passed random number generator. |
|
Fills in gaps in the network |
Return the maximum number of threads that are recommended for this computer (the OMP_NUM_THREADS value) |
|
|
Return the functions that must be called for the specified stage of the day; |
|
Convenience function that returns all of the functions that should be called during the initialisation step of the model (e.g. |
|
Convenience function that returns all of the functions that should be called during the finalisation step of the model (e.g. |
|
Convenience function that returns all of the functions that should be called during the model loop (i.e. |
|
Return the minimum and maximum distances recorded in the network |
|
This function works out how many processes have been set by the paralellisation system called ‘parallel_scheme’ |
|
Initialise the data structure used to store the infections |
|
Initialise the space used to store the play infections |
|
This function is not used or implemented, but is implied by the naming scheme… |
|
And Vice Versa From Work to Play The relevant parameters are network.params.play_to_work and network.params.work_to_play |
|
Prepare a worker to receive work to run a model using the passed parameters. |
|
Return a random number drawn from the binomial distribution [p,n] (see gsl_ran_binomial for documentation) |
|
Draw a random integer from [0,upper] inclusive |
|
Return a random double drawn from a uniform distribution between zero and one |
|
This function reads the ‘done_file’ from ‘filename’ returning the list of seeded nodes |
|
Recalculate the denominator_d for the wards (nodes) in the network for the normal links |
|
Recalculate the denominator_d for the wards (nodes) in the network for the play links |
|
Static Play At Home rescaling. |
|
Resize the passed array to size ‘size’, adding ‘default’ if this will grow the array |
|
Reset everything in the passed network so that it can be used for a new model run |
|
Resets the play entries in the passed Network. |
|
Resets the ward entries in the passed Network. |
|
Resets the work entries in the passed Network. |
|
Actually run the model. |
|
Run all of the models on the passed Network that are described by the passed VariableSets |
|
Ask the worker to run a model using the passed variables and options. |
Convert ‘s’ to a number. |
|
|
Scale the number of susceptibles in the passed Links by the passed scale ratio. |
|
Scale the number of susceptibles in the passed Nodes by the passed scale ratios. |
|
Seed and return the random binomial generator. |
|
Convert the passed string (or strings) containing integers (or ranges of integers) into a single sorted list of integers where no value is repeated |
|
Update MetaWards to the latest version. |
|
Classes¶
|
This is a simple profiling class that supports manual instrumenting of the code. |
|
This is a null profiler that does nothing |