june.logger.logger.Logger¶
-
class
june.logger.logger.
Logger
(save_path: str = 'results', file_name: str = 'logger.0.hdf5', rank: int = 0, config: dict = None) Logger used by the simulator to store the relevant information.
- save_path:
path to save file
- file_name:
name of output hdf5 file
- rank:
id of rank that will save population (for parallel mpi code)
-
__init__
(save_path: str = 'results', file_name: str = 'logger.0.hdf5', rank: int = 0, config: dict = None) Logger used by the simulator to store the relevant information.
- save_path:
path to save file
- file_name:
name of output hdf5 file
- rank:
id of rank that will save population (for parallel mpi code)
-
accumulate_infection_location
(location, new_infected_ids) Store where infections happend in a time step
- location:
group type of the group in which the infection took place
-
static
get_username
()
-
log_config
(config=None)
-
log_hospital_capacity
(date: datetime, hospitals: Hospitals) Log the variation of number of patients in hospitals over time
- date:
date to log
- hospitals:
hospitals to log
-
log_hospital_characteristics
(hospitals: Hospitals) Log hospital’s coordinates and number of beds per hospital
- hospitals:
hospitals to log
-
log_infected
(date: datetime, infected_ids: List[int], symptoms: List[int]) Log relevant information of infected people per super area and time step.
- date:
datetime of time step to log
- super_area_infections:
dictionary containing (per super area) the IDs of infected people, their symtpoms tag, and the number of secondary infections they produced. list of IDs of everyone infected
-
log_infection_location
(time) Log where did all infections in a time step happened Parameters ———- time:
datetime to log
-
log_meta_info
(comment=None, random_state=None)
-
log_parameters
(interaction: Interaction = None, infection_seed: InfectionSeed = None, infection_selector: InfectionSelector = None, activity_manager: ActivityManager = None)
-
log_population
(population: june.demography.demography.Population, chunk_size: int = 100000) Saves the Population object to hdf5 format file
self.save_path
. Currently for each person, the following values are stored: - id, age, sex, super_area- population:
population object
- chunk_size:
number of people to save at a time. Note that they have to be copied to be saved, so keep the number below 1e6.
-
unpack_dict
(hdf5_obj, data, base_path, depth=0, max_depth=5) Recursively unpack a nested dict of data into an hdf5 object, starting group name at base_path
- hdf5_obj
The open hdf5_object
- data
A (nested) dictionary of data: dict vals can be int, float, str, List[int,float], np.ndarray, datetime.datetime, pd.Timestamp.
- base_path
the top-level location of the group data in the hdf5_obj.
- depth
leave this at zero - keeps track of number of depth of recursion.
- max_depth
breaks recursion if depth > max_depth.