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, z
ndarray The x, y, z components of all vectors. For instance, in the example of the input parameter vectors:
>>> vecs.x array([1., 4.])
- x, y, z
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.
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
iwherecondition[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
iwherecondition[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.