pysdic.Connectivity.from_npz#

classmethod Connectivity.from_npz(filepath, load_properties=True)[source]#

Create a Connectivity object from a NumPy NPZ file.

The NPZ file should contain an array named ‘elements’ with shape \((N_e, N_{vpe})\) representing the elements of the connectivity. Additional properties can be stored as separate arrays in the NPZ file.

See also

  • to_npz() method for saving the connectivity to a NPZ file.

Parameters:
  • filepath (str) – The path to the NPZ file.

  • load_properties (bool, optional) – If True, all arrays in the NPZ file with format "_properties/{property_name}" will be loaded as properties of the connectivity. Default is True.

Returns:

A Connectivity object containing the elements and properties read from the NPZ file.

Return type:

Connectivity

Examples

Creating a Connectivity object from a NPZ file.

1from pysdic import Connectivity
2# Create a connectivity from a NPZ file
3connectivity = Connectivity.from_npz('path/to/connectivity.npz')

Now, connectivity is a Connectivity object containing the elements and properties read from the specified NPZ file.