Snapshot

class archABM.snapshot.Snapshot(header)[source]

Stores the state of an agent at a given time

header: list
store: dict
reset()None[source]

Initializes dictionary store with header as keys.

classmethod get_header(sep=',')str[source]

Takes all items in header and joins them into one string.

A string must be specified as the separator, by default “,”

Parameters

sep (str, optional) – separator. Defaults to “,”.

Returns

a string created by joining the elements of header by string separator

Return type

str

get_data(sep=',')str[source]

Takes all items in store and joins them into one string.

A string must be specified as the separator, by default “,”

Parameters

sep (str, optional) – separator. Defaults to “,”.

Returns

a string created by joining the elements of store by string separator

Return type

str

set(key: str, value, digits: int = 2)None[source]

Add a key:value pair to the store dictionary

  • If value is bool, it is casted to int.

  • If value is list, the elements are joined into one str, separated by “;”.

  • If value is float, it is rounded to the specified number digits.

  • If digits is 0, value is casted to int.

Parameters
  • key (str) – item key

  • value (Union[bool, int, float, list]) – item value

  • digits (int, optional) – number of digits to store. Defaults to 2.

Raises

BaseException – raises if the specified key is not a key in store

Snapshot Person

class archABM.snapshot_person.SnapshotPerson[source]

Stores the state of a person at a given time

It saves the following attributes:

Attribute

Description

Type

run

Simulation run

int

time

Simulation time (minutes)

int

person

Person ID

int

status

Person status (0: susceptible, 1: infective)

bool

place

Place ID

int

event

Event ID

int

CO2_level

Average CO2 level (ppm)

float

quanta_inhaled

Quanta inhaled (quanta)

float

header: list = ['run', 'time', 'person', 'status', 'place', 'event', 'CO2_level', 'quanta_inhaled']
store: dict

Snapshot Place

class archABM.snapshot_place.SnapshotPlace[source]

Stores the state of a place at a given time

It saves the following attributes:

Attribute

Description

Type

run

Simulation run

int

time

Simulation time (minutes)

int

place

Place ID

int

activity

Activity

str

num_people

Number of people

int

infective_people

Number of infective people

int

CO2_level

CO2 level (ppm)

float

quanta_level

quanta level (ppm)

float

temperature

Room temperature

float

relative_humidity

Room relative humidity

float

header: list = ['run', 'time', 'place', 'activity', 'num_people', 'infective_people', 'CO2_level', 'quanta_level', 'temperature', 'relative_humidity']
store: dict