cf.PartitionMatrix

class cf.PartitionMatrix(array=[], dimensions=[])[source]

Bases: cf.utils.CfList

A partition matrix.

Initialization

Parameters :
array : list

A (possibly nested) list of Partition objects.

dimensions : list

The identities of the partition dimensions of the partition array. If the partition matrix is a scalar array then it is an empty list. The list is not copied.

Examples

>>> pm = PartitionMatrix(
...        [Partition(location   = [(0, n) for n in shape],
...                   shape      = shape[:],
...                   dimensions = dimensions[:],
...                   directions = copy(directions),
...                   Units      = units.copy(),
...                   part       = [],
...                   data       = data)
...         ],
...        dimensions = [])

PartitionMatrix attributes

ndim The number of partition dimensions in the partition matrix.
shape List of the partition matrix’s dimension sizes.
size The number of partitions in the partition matrix.

PartitionMatrix methods

Undocumented methods behave exactly as their counterparts in a built-in list.

add_partitions
append
change_dimension_names dim_name_map should be a dictionary which maps each dimension names in
copy Return a deep copy.
count Return the number of occurrences of a given value.
equals True if two instances are equal, False otherwise.
expand_dims Insert a new size 1 partition dimension in place.
extend
flat Return a flat iterator over the partitions in the partition matrix.
index Return the first index of a given value.
info
insert Insert an object before the given index in place.
partition_boundaries
pop
ravel Return a flattened partition matrix as a built-in list.
remove
reverse
rollaxis Roll the specified partition dimension backwards,in place until it lies in a given position.
set_location_map Recalculate the cf.Partition.location attribute of each partition in
squeeze Remove all size 1 partition dimensions in place.
transpose Permute the partition dimensions of the partition matrix in place.

Table Of Contents

Previous topic

cf.Partition.update_from

Next topic

cf.PartitionMatrix.ndim

This Page