flatspin.grid

Grid

Module Contents

Classes

Grid

Functions

add_values_fast(grid_values, grid_inds, values)

flatspin.grid.add_values_fast(grid_values, grid_inds, values)
class flatspin.grid.Grid(points, cell_size=None, padding=None)
centers(self)

Return the centers of the grid cells

edges(self)

Return the edges of the grid cells

center_grid(self)

Make a grid with the cell centers

classmethod fixed_grid(cls, pos, grid_size)

Make a grid with a fixed size

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

point_index(self, grid_index)

Map one grid index to zero or more point indices

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

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

valuesarray or list

Values to map onto the grid cells

fill_valuescalar

Fill value for empty cells

method{‘sum’, ‘mean’}

How to aggregate multiple values which map to the same cell