scipp.vectors#
- scipp.vectors(*, dims, values, unit=<automatically deduced unit>)#
Constructs a
Variablewith given dimensions holding an array of length-3 vectors.- Parameters:
values (
Union[_SupportsArray[dtype[Any]],_NestedSequence[_SupportsArray[dtype[Any]]],bool,int,float,complex,str,bytes,_NestedSequence[Union[bool,int,float,complex,str,bytes]]]) – Initial values.unit (
Unit|str|DefaultUnit|None, default:<automatically deduced unit>) – Unit of contents.
- Returns:
Variable– A variable of vectors with given values.
See also
scipp.vectorConstruct a single vector.
scipp.spatial.as_vectorsConstruct 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)]