Types#

Aliases#

type pyenki.Vector = Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']#

A two dimensional vector in cm.

type pyenki.VectorLike = Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']#

Anything that can be converted to a Vector.

type pyenki.Array1D = Annotated[numpy.typing.NDArray[numpy.float64], '[n]']#

A one-dimensional array of floats

type pyenki.IntArray1D = Annotated[numpy.typing.NDArray[numpy.int64], '[n]']#

A one-dimensional array of integers.

type pyenki.Array2D = Annotated[numpy.typing.NDArray[numpy.float64], '[n]']#

A two-dimensional array of floats

type pyenki.Image = Annotated[numpy.typing.NDArray[numpy.uint8], '[n, m, 3]']#

An RGB image with 8 bits per color.

type pyenki.ARGBImage = Annotated[numpy.typing.NDArray[numpy.uint8], '[n, m, 4]']#

An ARGB image with 8 bits per color.

type pyenki.ARGBImageLike = Annotated[numpy.typing.ArrayLike, numpy.uint8, '[n, m, 4]']#

Anything that can be converted to a ARGBImage.

type pyenki.Controller = collections.abc.Callable[[pyenki.PhysicalObject, SupportsFloat], None]#

The type of callbacks that can be assigned to pyenki.PhysicalObject.control_step_callback

def callback(PhysicalObject: obj, time_step: float) -> None: ...

The first argument is the object to control, the second the time step (in seconds).

type pyenki.viewer.Vector3 = Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#

A three dimensional vector in cm.

type pyenki.viewer.Vector3Like = Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']#

Anything that can be converted to a Vector3.

Color#

class pyenki.Color#
Parameters:
  • r (float) – Red channel, in [0, 1], optional (default 0.0)

  • g (float) – Green channel, in [0, 1], optional (default 0.0)

  • b (float) – Blue channel, in [0, 1], optional (default 0.0)

  • a (float) – Alpha channel, in [0, 1], optional (default 1.0)

An RGBA color with values between 0.0 and 1.0.

black#

readonly

Type:

Color

gray#

readonly

Type:

Color

white#

readonly

Type:

Color

red#

readonly

Type:

Color

green#

readonly

Type:

Color

blue#

readonly

Type:

Color

lightgray#

readonly

Type:

Color

darkgray#

readonly

Type:

Color

lightred#

readonly

Type:

Color

darkred#

readonly

Type:

Color

lightgreen#

readonly

Type:

Color

darkgreen#

readonly

Type:

Color

lightblue#

readonly

Type:

Color

darkblue#

readonly

Type:

Color

lightyellow#

readonly

Type:

Color

yellow#

readonly

Type:

Color

darkyellow#

readonly

Type:

Color

orange#

readonly

Type:

Color

violet#

readonly

Type:

Color

purple#

readonly

Type:

Color

pink#

readonly

Type:

Color

cyan#

readonly

Type:

Color

r#

Red channel, in [0, 1]

Type:

float

g#

Green channel, in [0, 1]

Type:

float

b#

Blue channel, in [0, 1]

Type:

float

a#

Alpha channel, in [0, 1]

Type:

float

components#

Components, in [0, 1]

Type:

tuple[float, float, float, float]

threshold(limits: pyenki.Color) None#

Threshold the color using limit. For each component, if value is below limit, set it to 0

Parameters:

limit (Color) – the threshold

toGray() float#

Return the grey level value

Returns:

the average intensity of the channels.

Return type:

float