Skip to content

Box Environment

Simple box-like environments.

Bounds3D dataclass

A 3D region bounded by [0, 0, 0] and [x_max, y_max, z_max].

Parameters:

Name Type Description Default
x_max float

Bound x coordinates between 0 and x_max.

required
y_max float

Bound y coordinates between 0 and y_max.

required
z_max float

Bound z coordinates between 0 and z_max.

required
Example
>>> bounds = Bounds3D(10, 10, 5)
>>> Position(9, 6, 4) in bounds
True
>>> Position(9, 6, 6) in bounds
False
>>> Position(9, -1, 4) in bounds
False

__contains__(position)

Determine if position is inside Bounds3D.

Parameters:

Name Type Description Default
position Position

Position to test.

required

Returns:

Type Description
bool

True if the position is in bounds.

BoxEnvironment

Bases: NullEnvironment

A simple environment defined by a 3D region.

bounds: Bounds3D property

Public API for internal bounds.

Returns Three-dimensional bounds for the environment.

__init__(x_max, y_max, z_max)

Create a new bounded BoxEnvironment.

A Position is in bounds if 0 <= x <= x_max, 0 <= y <= y_max and 0 <= z <= z_max.

Parameters:

Name Type Description Default
x_max float

Maximum x coordinate

required
y_max float

Maximum y coordinate

required
z_max float

Maximum z coordinate

required

Raises:

Type Description
ValueError

if x_max < 0 or y_max < 0 or z_max < 0.

visualize(*, show=True, save_path=None)

Visualize the environment with the currently placed devices.

PlanarEnvironment

Bases: BoxEnvironment

A simple environment defined by a flat 2D region.

Devices must have spatial distributions that place them at a height of z=0.

__init__(x_max, y_max)

Create a new bounded PlanarEnvironment.

A Position is in bounds if 0 <= x <= x_max, 0 <= y <= y_max and z == 0.

Parameters:

Name Type Description Default
x_max float

Maximum x coordinate

required
y_max float

Maximum y coordinate

required

Raises:

Type Description
ValueError

if x_max < 0 or y_max < 0.

visualize(*, show=True, save_path=None)

Visualize the environment with the currently placed devices.