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.
- 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.
- 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.