Skip to content

ukhsa-collaboration/Mustard_and_Finnie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CONVERTPOPULATIONS

The convertPopulations.py code takes the files Synthetic Households and Synthetic Populations and creates the files Pools ,Itineraries, and Cases Pools contains a list of the total number of people in state 'S' in each location in rach time slice.At the start of the simulation this is everyone who isn't initially in state 'I'

Itinerary is a list of all the the individuals currently in state 'S' -so it should alawys contain the same total numbers as Pools - who are candidates to become 'I' individuals if the modelling indicates that more 'I' inidividuals should be created.

The cases data file cotains the'active' individuals (those in state'I' or 'R')

So, as the simulation progresses , the numbers in the Pools and Itineraries Itineraries decreases, while the numbers in the cases file increases.

Pools typically has just two time slices - at work, and at home. The at home locations are included in the input Synthetic Populations file.

The Synthetic Populations file only contains information about workplaces at Local Authority level. To generate individual workplaces the Generate_Workplaces function is used. This uses an underlying Normal dstribution, based on bins of sizes 10. There is an input option to randomly generate a few large workplaces (as the undelying distribution seems heavily weighted towards a large number of small workplaces).

RUTLAND.ipynb

This is the current latest version of the simulation module.It is based on the Pools version of the simulation. In this version only 'active' individuals -those in state'I' or 'R' - are modelled as individuals .Those in state 'S'are recorded in the 'Pools' data only as total numbers in a given location in a given time slice. The case data is stored in a Dask bag, to allow multiple processing.The bag is updated between time slices by writing the bag and then reading it back in.

The movement from 'S' to 'I' is controlled by a Possion distribution, with rate equal to the average number of new 'I' individuals expected to arise during the current time slice. This process is implemented in the function Truncated_Poisson (truncated because the number of 'S'individuals at a location converting to state 'I' can't be greater than the 'S'total for that location ). Once the number - if any - of new 'I'individualsthe function get_candidates is called to select suitable candidates for these new 'I'individuals.These are selected from the Itinerary file as individuals who are in the correct location during the current time slice. Once these canididates have been identified a random choice is performed to select the appropriate number. These individuals are then passed to the make_individuals function. This function creates a list of dictionaries containing the information for each individual. The file containing these new individuals is written out at the end of the iteration. THis is doen using the make_new_file function

The 'I' to 'R'movment is treated differently. For this movement, each 'I' individual is assigned a time to recovery . This is done using the function get_recovery_times. This function performs two roles: -it assigns a recovery time to every individual in the bag at the start of the simulation, and it also creates a list of recovery times to assigned to each new 'I' individual as they are created. It does this using the generate_recovery_times function. Once a recovery time has been assigned ot each 'I individual this recoverty time This is doen using the function recover_individuals.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published