holoviews.core.data.image module#

class holoviews.core.data.image.ImageInterface(*, name)[source]#

Bases: GridInterface

Interface for 2 or 3D arrays representing images of raw luminance values, RGB values or HSV values.

Methods

coords(dataset, dim[, ordered, expanded, edges])

Returns the coordinates along a dimension.

dtype(dataset, dimension)

Returns the dtype for the selected dimension.

irregular(dataset, dim)

ImageInterface does not support irregular data

length(dataset)

Returns the number of rows in the Dataset.

range(obj, dim)

Computes the minimum and maximum value along a dimension.

redim(dataset, dimensions)

Renames dimensions in the data.

reindex(dataset[, kdims, vdims])

Reindexes data given new key and value dimensions.

sample(dataset[, samples])

Sample the Raster along one or both of its dimensions, returning a reduced dimensionality type, which is either a ItemTable, Curve or Scatter.

select(dataset[, selection_mask])

Slice the underlying numpy array in sheet coordinates.

shape(dataset[, gridded])

Returns the shape of the data.

unpack_scalar(dataset, data)

Given a dataset object and data in the appropriate format for the interface, return a simple scalar.

validate(dataset[, vdims])

Validation runs after the Dataset has been constructed and should validate that the Dataset is correctly formed and contains all declared dimensions.

values(dataset, dim[, expanded, flat, ...])

The set of samples available along a particular dimension.

aggregate

groupby

init

mask

Parameter Definitions


classmethod coords(dataset, dim, ordered=False, expanded=False, edges=False)[source]#

Returns the coordinates along a dimension. Ordered ensures coordinates are in ascending order and expanded creates ND-array matching the dimensionality of the dataset.

classmethod dtype(dataset, dimension)[source]#

Returns the dtype for the selected dimension.

Parameters:
datasetDataset

The dataset to query

dimensionstr or Dimension

Dimension to return the dtype for

Returns:
numpy.dtype

The dtype of the selected dimension

classmethod irregular(dataset, dim)[source]#

ImageInterface does not support irregular data

classmethod length(dataset)[source]#

Returns the number of rows in the Dataset.

Parameters:
datasetDataset

The dataset to get the length from

Returns:
int

Length of the data

classmethod range(obj, dim)[source]#

Computes the minimum and maximum value along a dimension.

Parameters:
datasetDataset

The dataset to query

dimensionstr or Dimension

Dimension to compute the range on

Returns:
tuple[Any, Any]

Tuple of (min, max) values

Notes

In the past categorical and string columns were handled by sorting the values and taking the first and last value. This behavior is deprecated and will be removed in 2.0. In future the range for these columns will be returned as (None, None).

classmethod redim(dataset, dimensions)[source]#

Renames dimensions in the data.

Parameters:
datasetDataset

The dataset to transform

dimensionsdict[str, str]

Dictionary mapping from old to new dimension names

Returns:
data

Data after the dimension names have been transformed

Notes

Only meaningful for data formats that store dimension names.

classmethod reindex(dataset, kdims=None, vdims=None)[source]#

Reindexes data given new key and value dimensions.

classmethod sample(dataset, samples=None)[source]#

Sample the Raster along one or both of its dimensions, returning a reduced dimensionality type, which is either a ItemTable, Curve or Scatter. If two dimension samples and a new_xaxis is provided the sample will be the value of the sampled unit indexed by the value in the new_xaxis tuple.

classmethod select(dataset, selection_mask=None, **selection)[source]#

Slice the underlying numpy array in sheet coordinates.

classmethod shape(dataset, gridded=False)[source]#

Returns the shape of the data.

Parameters:
datasetDataset

The dataset to get the shape from

Returns:
tuple[int, int]

The shape of the data (rows, cols)

classmethod unpack_scalar(dataset, data)[source]#

Given a dataset object and data in the appropriate format for the interface, return a simple scalar.

classmethod validate(dataset, vdims=True)[source]#

Validation runs after the Dataset has been constructed and should validate that the Dataset is correctly formed and contains all declared dimensions.

classmethod values(dataset, dim, expanded=True, flat=True, compute=True, keep_index=False)[source]#

The set of samples available along a particular dimension.