polymerist.maths.lattices.coordinates ===================================== .. py:module:: polymerist.maths.lattices.coordinates .. autoapi-nested-parse:: Representation of vectors of coordinates and elementary distance geometry operations Attributes ---------- .. autoapisummary:: polymerist.maths.lattices.coordinates.Num Classes ------- .. autoapisummary:: polymerist.maths.lattices.coordinates.Coordinates polymerist.maths.lattices.coordinates.BoundingBox Module Contents --------------- .. py:data:: Num .. py:class:: Coordinates(points: Optional[numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N, polymerist.genutils.typetools.numpytypes.D], Num]] = None) Bases: :py:obj:`Generic`\ [\ :py:obj:`Num`\ ] Represention class for encapsulating N-vectors of D-dimensional coordinates, with basic coordinate operations .. py:attribute:: points :value: None .. py:attribute:: n_dims .. py:property:: n_points :type: int The number of points currently stored in the coordinates vector .. py:property:: dimensions :type: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.D], Num] The side lengths of the bounding box along each dimension .. py:property:: minimum :type: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.D], Num] The bounding box vertex with the smallest coordinates in each dimension .. py:property:: maximum :type: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.D], Num] The bounding box vertex with the largest coordinates in each dimension .. py:property:: extrema :type: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[2, polymerist.genutils.typetools.numpytypes.D], Num] A 2xN array of the minimal and maximal bounding box vertices .. py:method:: validate_point(point: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.D], Num]) -> None Check if a point is compatible with the coordinates, or else raise Exception with reason why not .. py:method:: dists_to_point(point: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.D], Num], norm_order: Optional[int] = None) -> numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N], Num] The distance between each point in a coordinate array and a single arbitrary point .. py:method:: weighted_centroid(weights: Optional[numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N], Num]] = None) -> numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.D], Num] The average (center-of-mass) coordinate of a vector of coordinates, with optional array of weights for each coordinates .. py:property:: centroid :type: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.D], Num] The unweighted average coordinate of the vector .. py:method:: dists_to_centroid(norm_order: Optional[int] = None, weights: Optional[numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N], Num]] = None) -> numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N], Num] The distance of each coordinate in an array of coordinates to the coordinates' centroid .. py:property:: lex_ordered_idxs :type: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N, polymerist.genutils.typetools.numpytypes.D], int] Returns a vector of the position that each point in self.points occupies when ordered lexicographically .. py:property:: lex_ordered_points :type: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N, polymerist.genutils.typetools.numpytypes.D], Num] Return copy of the points in the lattice in lexicographic order .. py:method:: lex_order_points() -> None Sort points in the lattice in lexicographic order .. py:method:: randomize_points() -> None Place the points in the lattice in a random order .. py:method:: translate(displacement: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.D], Num]) -> None Apply affine shift (translation only) to all points .. py:method:: linear_transformation(matrix: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.D, polymerist.genutils.typetools.numpytypes.D], float], as_coords: bool = False) -> Union[numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N, polymerist.genutils.typetools.numpytypes.D], float], Coordinates] Accepts an NxN matrix (where D is the dimension of the lattice), returns a linearly-transformed copy of the coordinate points .. py:method:: affine_transformation(matrix: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.D, polymerist.genutils.typetools.numpytypes.D], float], as_coords: bool = False) -> Union[numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N, polymerist.genutils.typetools.numpytypes.D], float], Coordinates] Accepts an NxN matrix (where D is the dimension of the lattice), returns an affinely-transformed copy of the coordinate points .. py:class:: BoundingBox(coords: Union[Coordinates, numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N, polymerist.genutils.typetools.numpytypes.D], Num]]) Bases: :py:obj:`Coordinates` For representing a minimum bounding box around an N-coordinate vector of D-dimensional points .. py:property:: vertices :type: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N, polymerist.genutils.typetools.numpytypes.D], Num] Alias of the "points" attribute to distinguish use via syntax .. py:property:: face_indices :type: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N, polymerist.genutils.typetools.numpytypes.D], int] Returns a [2**(n_dim-1) x 2*n_dim] whose points are the indices of (2*n_dims)-tuplets which form a "face" of the bounding box (i.e. shared values of exactly one coordinate) .. py:property:: face_coords :type: numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N, polymerist.genutils.typetools.numpytypes.D, 3], int] Return a [2**(n_dim-1) x 2*n_dim x 3] array in which each row is the set .. py:method:: surrounds(coords: Union[Coordinates, numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N, polymerist.genutils.typetools.numpytypes.D], Num]], strict: bool = False) -> numpy.ndarray[polymerist.genutils.typetools.numpytypes.Shape[polymerist.genutils.typetools.numpytypes.N, polymerist.genutils.typetools.numpytypes.D], bool] Boolean mask of whether the coordinates in a point vector lies within the bounding box