Types

class detroit.types.Interval(*args, **kwargs)

Protocol class which represents Interval class

static floor(x: float) float

Apply floor procedure on x value

Parameters:

x (float) – Input

Returns:

Output

Return type:

float

static ceil(x: float) float

Apply ceil procedure on x value

Parameters:

x (float) – Input

Returns:

Output

Return type:

float

detroit.types.Accessor

alias of Callable[[U], V] | Callable[[U, int], V] | Callable[[U, int, list[Element]], V]

class detroit.types.MultiPolygonGeoJSON

Describes a contour as GeoJSON MultiPolygon geometry objects

type

Type of contour (ex: "MultiPolygon")

Type:

str

value

Threshold value; the input values are greater than or equal to this value.

Type:

str

coordinates

Coordinates of contours

Type:

list[list[tuple[int, int]]]

class detroit.types.SimulationNode

Describes a simulation’s node.

index

The node’s zero-based index into nodes

Type:

int

x

The node’s current x-position

Type:

float

y

The node’s current y-position

Type:

float

vx

The node’s current x-velocity

Type:

float

vy

The node’s current y-velocity

Type:

float

fx

The node’s fixed x-position

Type:

float

fy

The node’s fixed y-position

Type:

float

Describes a simulation’s link.

source

The link’s source node

Type:

SimulationNode

target

The link’s target node

Type:

SimulationNode

index

The zero-based index into links

Type:

int

class detroit.types.Force(*args, **kwargs)

Protocol class which represents Force object

initialize(nodes: list[SimulationNode], random: Callable[[None], float])

Initializes the force.

Parameters:
  • nodes (list[SimulationNode]) – List of simulation nodes

  • random (Callable[[None], float]) – Function which returns a random number

__call__(alpha: float | None)

Applies the force on simulation nodes.

Parameters:

alpha (float | None) – Parameter used during the call.