scipp.vectors#

scipp.vectors(*, dims, values, unit=<automatically deduced unit>)#

Constructs a Variable with given dimensions holding an array of length-3 vectors.

Parameters:
Returns:

Variable – A variable of vectors with given values.

See also

scipp.vector

Construct a single vector.

scipp.spatial.as_vectors

Construct vectors from Scipp Variables

Examples

>>> sc.vectors(dims=['x'], values=[[1, 2, 3]])
<scipp.Variable> (x: 1)    vector3  [dimensionless]  [(1, 2, 3)]
>>> var = sc.vectors(dims=['x'], values=[[1, 2, 3], [4, 5, 6]])
>>> var
<scipp.Variable> (x: 2)    vector3  [dimensionless]  [(1, 2, 3), (4, 5, 6)]
>>> var.values
array([[1., 2., 3.],
       [4., 5., 6.]])
>>> sc.vectors(dims=['x'], values=[[1, 2, 3], [4, 5, 6]], unit='mm')
<scipp.Variable> (x: 2)    vector3             [mm]  [(1, 2, 3), (4, 5, 6)]