Floor Dataclass
Module for Floor class.
Floor
dataclass
Representation of a floor in a building.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
floor_number
|
int
|
The number of the floor within the building. |
required |
rooms
|
list[Room]
|
The list of rooms on the floor. |
required |
Source code in src/amr_hub_abm/spatial/floor.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
adjacency_matrix
property
Get the adjacency matrix representing room connections on the floor.
edge_set
property
Get a list of all wall edges on the floor.
room_ids
property
Get a list of room IDs on the floor.
room_names
property
Get a list of room names on the floor.
__post_init__()
Post-initialization to validate floor attributes.
Raises:
| Type | Description |
|---|---|
InvalidRoomError
|
If there are duplicate room IDs on the floor. |
Source code in src/amr_hub_abm/spatial/floor.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
add_pseudo_rooms()
Add pseudo-rooms to the floor.
Source code in src/amr_hub_abm/spatial/floor.py
121 122 123 124 125 126 | |
create_spatial_room_from_pseudo_room(room)
staticmethod
Create a spatial room from a pseudo-room based on area.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
room
|
Room
|
A pseudo-room with defined area and doors but no walls. |
required |
Returns:
| Type | Description |
|---|---|
Room
|
A spatial room with walls and doors positioned based on the area of the pseudo-room. |
Raises:
| Type | Description |
|---|---|
InvalidRoomError
|
If the pseudo-room does not have a valid positive area. |
Notes
This method generates a rectangular room layout based on the area of the pseudo-room. The doors are positioned along one side of the rectangle. This function is not complete. Currently it only creates single simple rectangular rooms. Due to possibly complex topology, rectangular rooms may not always be a valid representation. Currently, no topology connections are considered. This function will be improved in future versions.
Source code in src/amr_hub_abm/spatial/floor.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
find_room_by_location(location)
Find the room that contains the given location.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
tuple[float, float]
|
The (x, y) coordinates of the location to search for. |
required |
Returns:
| Type | Description |
|---|---|
Room | None
|
The room that contains the location, or None if no such room exists. |
Source code in src/amr_hub_abm/spatial/floor.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
plot(ax, agents=None, *, trajectory=False, **kwargs)
Plot the floor layout including rooms and doors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ax
|
Axes
|
The matplotlib Axes object to plot on. |
required |
agents
|
list[Agent] | None
|
A list of agents to plot on the floor. Defaults to None. |
None
|
trajectory
|
bool
|
Whether to plot the trajectories of the agents. Defaults to False. |
False
|
Source code in src/amr_hub_abm/spatial/floor.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |