histopath_bim_des.bim module

Runner-related model parameters.

class histopath_bim_des.bim.BimModel(elevations: dict[str, float], doors: DataFrame, walls: DataFrame)[source]

Bases: object

Representation of the histopathology lab’s BIM data.

elevations: dict[str, float]

Elevation of each building storey, in metres.

doors: DataFrame

Dataframe of door coordinate data.

walls: DataFrame

Dataframe of wall coordinate data.

static from_ifc(path: PathLike, door_filter: str = 'd\\d+$') Self[source]

Parse an Industry Foundation Model file representation of the histopathology lab.

to_shapely(level: int) ShapelyModel[source]

Returns a Shapely representation of a floor in the BimModel.

Parameters:

level – Level number of the floor.

Returns:

Shapely representation of the selected floor, where all doors and walls are represented as shapely.Polygon instances.

class histopath_bim_des.bim.ShapelyModel(wall_shapes: list[Polygon], door_shapes: dict[str, Polygon])[source]

Bases: object

Shapely representation of a floor in the histopathology lab. All doors and walls are represented as shapely.Polygon instances.

wall_shapes: list[Polygon]
door_shapes: dict[str, Polygon]
is_valid_box(box: Polygon, ok_doors: list[str])[source]

Determines if box intersects with a wall or door except for ok_doors. ok_doors will typically be the source and destination doors of a shortest-path algorithm.

Parameters:
  • box – The box to check against the current model.

  • ok_doors – A list of doors to ignore when checking for intersections.

shortest_path(from_door: str, to_door: str, grid_size: float = 0.5, bottom_left: tuple[float, float] = (30, 45), top_right: tuple[float, float] = (90, 70)) Graph[source]

Find the shortest path between two doors in the model. A reasonable search box has been provided for the current study (the histopathology lab at Addenbrooke’s Hospital, Cambridge, UK).

Parameters:
  • from_door – Starting door on the path.

  • to_door – Destination door on the path.

  • grid_size – Grid size for pathfinding algorithm, in metres. Defaults to 0.5.

  • bottom_left – Bottom-left coordinate for pathfinding algorithm, in metres. Defaults to (30, 45).

  • top_right – Top-right coordinate for pathfinding algorithm, in metres. Defaults to (90,70).

Raises:

networkx.NetworkXNoPath – If no path exists between from_door and to_door without passing through a wall or another door.

plot_floor(ax: Axes, title: str, bottom_left: tuple[float, float] = (30, 45), top_right: tuple[float, float] = (100, 80))[source]

Plots the floor model using Matplotlib. Reasonable axis limits have been provided for the current study (the histopathology lab at Addenbrooke’s Hospital, Cambridge, UK).

Parameters:
  • ax – The Axes object to plot to.

  • title – The plot title.

  • bottom_left – Bottom left corner of plot. Defaults to (30, 45), corresponding to metres in the floor plan.

  • top_right – Top right corner of plot. Defaults to (100, 80), corresponding to metres in the floor plan.

histopath_bim_des.bim.logical_graph(model: ShapelyModel, speed: float | None = 1.2) Graph[source]

Construct a logical graph representation of the floor model, with nodes representing doors and edge weights representing travel times in seconds.

Parameters:

speed – Runner speed in m/s. Defaults to 1.2.

Returns:

The logical graph for the given floor model.

histopath_bim_des.bim.runner_times(model: BimModel, cfg: RunnerConfig) dict[tuple[str, str], float][source]

Compute runner times between process stages in the histopathology model.

Parameters:
  • model – BIM model representation of the histopathology lab.

  • config – Dataclass containing runner parameters.

Returns:

Maps pairs of process stages to the time (in seconds) required to travel between them.