scipp.vector#

scipp.vector(value, *, unit=<automatically deduced unit>)#

Constructs a zero dimensional Variable holding a single length-3 vector.

Parameters:
  • value (Union[_Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], complex, bytes, str, _NestedSequence[complex | bytes | str]]) – Initial value, a list or 1-D numpy array.

  • unit (Unit | str | DefaultUnit | None, default: <automatically deduced unit>) – Unit of contents.

Returns:

Variable – A scalar (zero-dimensional) variable of a vector.

See also

scipp.vectors

Construct an array of vectors.

scipp.spatial.as_vectors

Construct vectors from Scipp Variables

Examples

>>> sc.vector(value=[1, 2, 3])
<scipp.Variable> ()    vector3  [dimensionless]  (1, 2, 3)
>>> sc.vector(value=[4, 5, 6], unit='m')
<scipp.Variable> ()    vector3              [m]  (4, 5, 6)