pysdic.core.property_container.PropertyContainer.set#

PropertyContainer.set(key, value, *, dtype=None, force_2d=None)[source]#

Set the values of a property (the input is copied).

Parameters:
  • key (str) – The name of the property.

  • value (ArrayLike) – An array of shape \((N, \dots)\) with the values of the property.

  • dtype (numpy.dtype, optional) – The data type of the stored array. By default, it is inferred from value.

  • force_2d (bool, optional) – If True, the property is stored as a 2D array even if the container does not enforce force_2d. If the container enforces force_2d, this parameter has no effect.

Raises:
  • TypeError – If the key is not a string.

  • ValueError – If the shape of value is not \((N, \dots)\) with at least one attribute, or if the property cannot be stored as a 2D array.

Return type:

None