embrs.fire_simulator.logger#

Logger for saving sim data and creating log files

class embrs.fire_simulator.logger.Logger(log_folder: str)#

Logger class used to generate log files from sim data

Parameters:

log_folder (str) – String representing the path to the folder where the logger instance will write log files.

add_to_agent_cache(agents: list, time: int)#

Add list of agents’ state from the previous iteration of the sim to the logger’s agent cache to be stored in a log file later on.

Parameters:
  • agents (list) – list of AgentBase instances in their log format see the AgentBaseto_log_format() function for more info.

  • time (int) – sim time (in seconds) when agents’ were stored.

add_to_cache(updated_cells: list, time: int)#

Add the list of updated cells from the previous iteration of the sim to the logger’s cache to be stored in a log file later on.

Parameters:
  • updated_cells (list) – list of Cell objects that were changed in the last iteration in their log format. See to_log_format() for more info.

  • time (int) – sim time (in seconds) when these cells were updated and stored.

create_timestamp() str#

Function that creates a timestamp string based on the current datetime and returns it.

Returns:

Timestamp string representing the current date and time.

Return type:

str

finish(fire: FireSim, on_interrupt=False)#

Finish logging all data, write to a .msgpack log file and a .json status log.

Parameters:
  • fire (FireSim) – FireSim instance to write logs for.

  • on_interrupt (bool, optional) – set to True when writing final log file, if True program will terminate when finished logging, defaults to False.

generate_session_folder() str#

Generates the path for the current sim’s log files based on current datetime

Returns:

Session folder path string

Return type:

str

log_message(message: str)#

Log a custom message in the current status log.

Parameters:

message (str) – Message to be logged

property session_folder: str#

Path to the folder the logger is writing to

start_status_log()#

Start a status log by loading the relevant metadata and creating a dictionary to store all relevant status data.

store_init_fire_obj(fire_obj: FireSim)#

Store the initial state of the fire in a .pkl within the log folder.

This is done to speed up the post-processing of log data significantly.

Parameters:

fire_obj (FireSim) – FireSim object just after being initialized.

store_metadata(params: dict, fire: FireSim)#

Store metadata for the status log describing the parameters used to run a simulation.

Resulting metadata will be used in all status logs generated with a given simulation setup.

Parameters:
  • params (dict) – dictionary containing input parameters for the simulation.

  • fire (FireSim) – FireSim instance for which metadata is being stored.

Classes

Logger(log_folder)

Logger class used to generate log files from sim data