:py:mod:`flatspin.grid` ======================= .. py:module:: flatspin.grid .. autoapi-nested-parse:: Grid Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: flatspin.grid.Grid Functions ~~~~~~~~~ .. autoapisummary:: flatspin.grid.add_values_fast .. py:function:: add_values_fast(grid_values, grid_inds, values) .. py:class:: Grid(points, cell_size=None, padding=None) .. py:method:: centers(self) Return the centers of the grid cells .. py:method:: edges(self) Return the edges of the grid cells .. py:method:: center_grid(self) Make a grid with the cell centers .. py:method:: fixed_grid(cls, pos, grid_size) :classmethod: Make a grid with a fixed size .. py:method:: grid_index(self, point_inds) Map point index to grid index If point_inds is a single index i, a single grid index (gi, gj) is returned. If point_inds is a list of indices, it should take the form of an integer array index: ([i0, i1, i2, ...], [j0, j1, j2, ...]) The corresponding grid indices are returned in the same format. See https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#integer-array-indexing .. py:method:: point_index(self, grid_index) Map one grid index to zero or more point indices .. py:method:: map_values(self, values, fill_value=0, mask_empty=False) Map values onto the grid Returns a 2D array with the values mapped onto the grid .. py:method:: add_values(self, values, fill_value=0, mask_empty=False, method='sum') Add values to the grid Returns a 2D array with the values summed to the grid Parameters: ----------- values : array or list Values to map onto the grid cells fill_value : scalar Fill value for empty cells method : {'sum', 'mean'} How to aggregate multiple values which map to the same cell