pysdic.Connectivity.get_property#

Connectivity.get_property(key)[source]#

Get a property of the connectivity by its key/name.

Note

The returned array is a unwritable view to prevent accidental modifications and is of type numpy.float64.

Note

The property can also be accessed using dictionary-like syntax:

1property_values = connectivity['property_key']
Parameters:

key (str) – The key/name of the property to retrieve.

Returns:

A NumPy array of shape \((N_p, A)\) representing the property values for each element in the connectivity.

Return type:

numpy.ndarray

Raises:

KeyError – If the property with the given key does not exist.

Examples

Get a property of the connectivity.

1import numpy
2from pysdic import Connectivity
3
4connectivity = Connectivity.from_array(numpy.random.rand(100, 3))
5intensity = numpy.random.rand(100)
6connectivity.set_property('intensity', intensity)
7retrieved_intensity = connectivity.get_property('intensity')