requsim.world module

Classes:

World()

A collection of WorldObjects with an EventQueue.

class requsim.world.World

Bases: object

A collection of WorldObjects with an EventQueue.

The World can be understood as a central object describing an experimental setup. It keeps track of all WorldObjects, which contain all the information a protocol can access to make decisions.

Variables:
  • event_queue (EventQueue) – A schedule of events so they can be resolved in order.

  • world_objects (dict) – keys: str of world object type values: list of WorldObjects with this type

Methods:

print_status([filter, max_display])

Print scheduled events and objects in a somewhat formatted way.

register_world_object(world_object)

Add a WorldObject to this world.

deregister_world_object(world_object)

Remove a WorldObject from this World.

print_status(filter=None, max_display=12)

Print scheduled events and objects in a somewhat formatted way.

Parameters:
  • filter ({"all", "Event", str, None}) – None displays max_display entries for events and each object type. “all” displays all events and objects regardless of max_display. “Event” displays all events. If any other str, will display all objects with matching object type. e.g. “Pair” or “Station”

  • max_display (int) – If filter is None, only max_display items per category will be displayed.

Returns:

None

register_world_object(world_object)

Add a WorldObject to this world.

Parameters:

world_object (WorldObject) – WorldObject that should be added and tracked by self.world_objects

Returns:

str – A label for the world_object, which is the object type plus a counter that ticks up every time an object of that type is created.

deregister_world_object(world_object)

Remove a WorldObject from this World.

Parameters:

world_object (WorldObject) – The WorldObject that is removed from this World.

Returns:

None