sgpykit.util.cell

Classes

Cell(shape[, dtype])

A 1D or 2D container class that extends Python's built-in list.

class sgpykit.util.cell.Cell(shape, dtype=<class 'float'>)[source]

Bases: list

A 1D or 2D container class that extends Python’s built-in list.

This class provides a way to store elements in a grid-like structure with support for both flat and tuple indexing. It is designed to mimic MATLAB’s cell array functionality.

Parameters:
shapeint or tuple of ints

The shape of the cell. If an integer is provided, a square shape is assumed.

dtypetype, optional

The data type of the elements in the cell. Default is float.

Attributes:
shapetuple

The shape of the cell.

dtypetype

The data type of the elements in the cell.

datalist

The internal data structure storing the elements.

Methods

append(object, /)

Append object to the end of the list.

clear(/)

Remove all items from list.

copy(/)

Return a shallow copy of the list.

count(value, /)

Return number of occurrences of value.

extend(iterable, /)

Extend list by appending elements from the iterable.

index(value[, start, stop])

Return first index of value.

insert(index, object, /)

Insert object before index.

pop([index])

Remove and return item at index (default last).

remove(value, /)

Remove first occurrence of value.

reverse(/)

Reverse IN PLACE.

sort(*[, key, reverse])

Sort the list in ascending order and return None.

tolist()

Return the first row of the cell as a list.

tolist()[source]

Return the first row of the cell as a list.

Returns:
list

The first row of the cell.