vispy.visuals.collections.array_list module#

An ArrayList is a strongly typed list whose type can be anything that can be interpreted as a numpy data type.

Example#

>>> L = ArrayList( [[0], [1,2], [3,4,5], [6,7,8,9]] )
>>> print L
[ [0] [1 2] [3 4 5] [6 7 8 9] ]
>>> print L.data
[0 1 2 3 4 5 6 7 8 9]

You can add several items at once by specifying common or individual size: a single scalar means all items are the same size while a list of sizes is used to specify individual item sizes.

Example#

>>> L = ArrayList( np.arange(10), [3,3,4])
>>> print L
[ [0 1 2] [3 4 5] [6 7 8 9] ]
>>> print L.data
[0 1 2 3 4 5 6 7 8 9]
class vispy.visuals.collections.array_list.ArrayList(data=None, itemsize=None, dtype=<class 'float'>, sizeable=True, writeable=True)#

Bases: object

An ArrayList is a strongly typed list whose type can be anything that can be interpreted as a numpy data type.

append(data, itemsize=None)#

Append data to the end.

Parameters:
dataarray_like

An array, any object exposing the array interface, an object whose __array__ method returns an array, or any (nested) sequence.

itemsize: int or 1-D array

If itemsize is an integer, N, the array will be divided into elements of size N. If such partition is not possible, an error is raised.

If itemsize is 1-D array, the array will be divided into elements whose successive sizes will be picked from itemsize. If the sum of itemsize values is different from array size, an error is raised.

property data#

The array’s elements, in memory.

property dtype#

Describes the format of the elements in the buffer.

insert(index, data, itemsize=None)#

Insert data before index

Parameters:
indexint

Index before which data will be inserted.

dataarray_like

An array, any object exposing the array interface, an object whose __array__ method returns an array, or any (nested) sequence.

itemsize: int or 1-D array

If itemsize is an integer, N, the array will be divided into elements of size N. If such partition is not possible, an error is raised.

If itemsize is 1-D array, the array will be divided into elements whose successive sizes will be picked from itemsize. If the sum of itemsize values is different from array size, an error is raised.

property itemsize#

Individual item sizes

reserve(capacity)#

Set current capacity of the underlying array

property size#

Number of base elements, in memory.