bw_timex.helper_classes#

Module Contents#

Classes#

SetList

A helper class for the mapping of the same/mapped activity in different (temporal) databases, composed of a list of sets, that hold can hold the set of tuples of (act_id, database).

TimeMappingDict

A dictionary mapping (flow, timestamp) tuples to unique integer IDs.

InterDatabaseMapping

A dictionary of the form {id1:{database1: id1, database2: id2, ...}, id2: ...} that maps the

class bw_timex.helper_classes.SetList[source]#

A helper class for the mapping of the same/mapped activity in different (temporal) databases, composed of a list of sets, that hold can hold the set of tuples of (act_id, database). It is built by adding sets to the list, and returns the matching sets if one calls the an item from a set.

Example: If the class instance is called my_setlist, my_setlist.add(set).

add(new_set: set) None[source]#

This method adds a set to the SetList instance.

Parameters:

new_set (a set to add to the SetList instance)

Return type:

None

class bw_timex.helper_classes.TimeMappingDict(start_id=2, *args, **kwargs)[source]#

Bases: dict

Inheritance diagram of bw_timex.helper_classes.TimeMappingDict

A dictionary mapping (flow, timestamp) tuples to unique integer IDs.

Initializes the dictionary with a starting ID.

property reversed[source]#

Returns a reversed version of the dictionary, updating it only if necessary.

Returns:

A reversed dictionary mapping unique IDs to (flow, timestamp) tuples.

Return type:

dict

add(process_time_tuple, unique_id=None)[source]#

Adds a new process_time_tuple to the dictionary.

Parameters:
  • process_time_tuple (tuple) – A tuple of (flow and timestamp)

  • unique_id (int, optional) – A unique ID for the tuple (default: None).

Returns:

The assigned unique ID.

Return type:

int

class bw_timex.helper_classes.InterDatabaseMapping(*args, **kwargs)[source]#

Bases: dict

Inheritance diagram of bw_timex.helper_classes.InterDatabaseMapping

A dictionary of the form {id1:{database1: id1, database2: id2, …}, id2: …} that maps the same activity in different databases.

Initialize self. See help(type(self)) for accurate signature.

find_match(id_, db_name) any[source]#

Returns the matching ID in the given database for the given ID.

make_reciprocal()[source]#

Internal method to make the mapping reciprocal.