VectorArray#

class atompy.VectorArray(vectors)[source]#

Class representing an array of vectors.

Tip

If you want to store a single vector, consider Vector.

Parameters:
vectorsarray_like

The vectors.

Should have shape (N, 3).

E.g., storing two vectors, do something like:

>>> v1 = (1, 2, 3)
>>> v2 = (4, 5, 6)
>>> vecs = VectorArray((v1, v2))
>>> vecs
VectorArray([[1. 2. 3.]
             [4. 5. 6.]])
Attributes:
x, y, zndarray

The x, y, z components of all vectors. For instance, in the example of the input parameter vectors:

>>> vecs.x
array([1., 4.])

Examples

For more examples, see Working with vectors.

Methods

angle_to(other)

Calculate the angles to vector other.

asarray()

Return as a numpy array.

copy()

Return a copy of the vector.

cos_theta()

Calculate cosines of the polar angles.

cross(other)

Calculate cross (outer) product with other.

dot(other)

Calculate dot (inner) product with other.

keep(condition[, squeeze, setval])

Keep all vectors i where condition[i] == True.

mag()

Calculate magnitude of vector.

norm([copy])

Return the vectors normalized to 1.

phi()

Calculate azimuth angles in rad.

remove(condition[, squeeze, setval])

Remove all vectors i where condition[i] == True.

rotate(angle_rad, axis)

Rotate vectors by angle_rad around axis

scale(fac[, copy])

Scale the vector.

theta()

Calculate polar angles in rad.