Outputs¶
Output provides various methods to record the outputs of any simulation or methods.
Overview:
- class pyEpiabm.output.AbstractReporter(folder: str, clear_folder: bool = False)[source]¶
Abstract class for Data Reporters.
- __init__(folder: str, clear_folder: bool = False)[source]¶
Constructor method for reporter. Makes a new folder in specified location if one does not already exist. Also clears contents of an existing folder if clear_folder is true.
- Parameters:
folder (str) – Absolute path to folder to store results
clear_folder (bool) – Whether to empty the folder before saving results
- class pyEpiabm.output._CsvDictWriter(folder: str, filename: str, fieldnames: List, clear_folder: bool = False)[source]¶
- __del__()[source]¶
Closes the file when the simulation is finished. Required for file data to be further used.
- __init__(folder: str, filename: str, fieldnames: List, clear_folder: bool = False)[source]¶
Initialises a file to store output in, and which categories to record.
- Parameters:
folder (str) – Output folder path
filename (str) – Output file name
fieldnames (List) – List of categories to be saved
clear_folder (bool) – Whether to empty the folder before saving results
- class pyEpiabm.output._CsvWriter(folder: str, filename: str, fieldnames: List, clear_folder: bool = False)[source]¶
- __del__()[source]¶
Closes the file when the simulation is finished. Required for file data to be further used.
- __init__(folder: str, filename: str, fieldnames: List, clear_folder: bool = False)[source]¶
Initialises a file to store output in, and which categories to record.
- Parameters:
folder (str) – Output folder path
filename (str) – Output file name
fieldnames (List) – List of categories to be saved
clear_folder (bool) – Whether to empty the folder before saving results
- class pyEpiabm.output.NewCasesWriter(folder: str)[source]¶
Writer for collecting number of daily new cases
- __init__(folder: str)[source]¶
Constructor method
- Parameters:
folder (str) – Absolute path to folder to store results
- write(t: float, population: Population)[source]¶
Write method Write daily new cases from population to file
- Parameters:
t (float) – Current simulation time
population (Population) – Population to record
- class pyEpiabm.output.AgeStratifiedNewCasesWriter(folder: str)[source]¶
Writer for collecting number of daily new cases and splitting them between age groups.
- __init__(folder: str)[source]¶
Constructor method.
- Parameters:
folder (str) – Absolute path to folder to store results
- write(t: float, population: Population)[source]¶
- Write method - write daily new cases split
by age group in population to file.
- Parameters:
t (float) – Current simulation time
population (Population) – Population to record