Skip to main content

🎉 We released Spotlight 1.5.10 check it out

Version: 1.5.10

dtypes

Spotlight data types.

The most dtypes are non-customazable and can be used through simple importing the respective module variables (e.g. float_dtype, image_dtype).

Some dtypes are customazable and only their default versions can be defined through the respective module variables (e.g. category_dtype, embedding_dtype). For more info, see the module classes.

In the most usage cases string or object aliases can be used instead of the default dtypes. For more info, see the module classes.

The main usage of the dtypes is customizing the spotlight.show.

Variables

bool_dtype

Bool dtype. Aliases: "bool", bool.

int_dtype

Integer dtype. Aliases: "int", int.

float_dtype

Float dtype. Aliases: "float", float.

str_dtype

String dtype. Aliases: "str", str.

datetime_dtype

Datetime dtype. Aliases: "datetime", datetime.datetime.

category_dtype

Categorical dtype with arbitraty categories. Aliases: "Category".

window_dtype

A single window. Aliases: "Window".

A single window is represented by an array-like with two timestamps in seconds as float values.

Single NaN, infinity and out-of-bound values will be clipped by the audio/time series bounds. In case of both non-valid values no window will be showed. Descending values will be visually highlighted.

bounding_box_dtype

Single or multiple bounding boxes. Aliases: "BoundingBox".

A single bounding box is represented by an array-like with its relative coordinates [x_min, y_min, x_max, y_max] (float values scaled onto 0 to 1). Top-left image corner is assumed to be (0, 0).

embedding_dtype

Embedding dtype. Aliases: "Embedding", renumics.spotlight.media.Embedding.

array_dtype

numpy array dtype. Aliases: "array", np.ndarray.

image_dtype

Image dtype. Aliases: "Image", renumics.spotlight.media.Image.

audio_dtype

Audio dtype. Aliases: "Audio", renumics.spotlight.media.Audio.

mesh_dtype

Mesh dtype. Aliases: "Mesh", renumics.spotlight.media.Mesh.

sequence_1d_dtype

1D-sequence dtype with arbitraty axis labels. Aliases: "Sequence1D", renumics.spotlight.media.Sequence1D.

video_dtype

Video dtype. Aliases: "video", renumics.spotlight.media.Video.

Classes

CategoryDType(categories=None)

Categorical dtype with predefined categories.

Category names and codes are assured to be unique. Empty categories mean to be defined later (in this case, equivalent to the category_dtype module variable).

Using with category names: >>> from renumics.spotlight import dtypes >>> dtype = dtypes.CategoryDType(["cat", "dog"]) >>> str(dtype) 'Category' >>> dtype.categories {'cat': 0, 'dog': 1} >>> dtype.inverted_categories {0: 'cat', 1: 'dog'}

Example of usage with category mapping: >>> from renumics.spotlight import dtypes >>> dtype = dtypes.CategoryDType({"four": 4, "two": 2}) >>> dtype.categories {'two': 2, 'four': 4}

Example of usage with empty categories: >>> from renumics.spotlight import dtypes >>> dtype = dtypes.CategoryDType() >>> dtype == dtypes.category_dtype True

Instance variables

categories

Category mapping (string category -> integer code).

inverted_categories

Inverted Category mapping (integer code -> string category).

Methods

dict(self)

Serialize dtype as dict.

ArrayDType(shape=None)

Array dtype with optional shape.

Attributes

shape : Array dimensions. Can be fully or partially defined. No shape means to be defined later.

Example of usage with defined shape: >>> from renumics.spotlight import dtypes >>> dtype = dtypes.ArrayDType((10, None, 4)) >>> str(dtype) 'array' >>> dtype.shape (10, None, 4) >>> dtype.ndim 3

Example of usage with empty shape: >>> from renumics.spotlight import dtypes >>> dtype = dtypes.ArrayDType() >>> dtype.ndim 0 >>> dtype == dtypes.array_dtype True

Instance variables

ndim

Number of array dimensions.

Methods

dict(self)

Serialize dtype as dict.

EmbeddingDType(length=None)

Embedding dtype with optional length.

Attributes

length : Embedding length. No length means to be defined later.

Example of usage with defined length: >>> from renumics.spotlight import dtypes >>> dtype = dtypes.EmbeddingDType(8) >>> str(dtype) 'Embedding' >>> dtype.length 8

Example of usage with empty length: >>> from renumics.spotlight import dtypes >>> dtype = dtypes.EmbeddingDType() >>> dtype == dtypes.embedding_dtype True

Methods

dict(self)

Serialize dtype as dict.

Sequence1DDType(x_label='x', y_label='y')

1D-sequence dtype with optional axis names.

Attributes

x_label : Optional name of the x axis.

y_label : Optional name of the y axis.

Example of usage with defined labels: >>> from renumics.spotlight import dtypes >>> dtype = dtypes.Sequence1DDType("time", "acceleration") >>> str(dtype) 'Sequence1D' >>> dtype.x_label 'time' >>> dtype.y_label 'acceleration'

Example of usage with empty labels: >>> from renumics.spotlight import dtypes >>> dtype = dtypes.Sequence1DDType() >>> dtype == dtypes.sequence_1d_dtype True

Methods

dict(self)

Serialize dtype as dict.