grid#
- class brainpy.state.spatial.grid(shape, extent=None, center=None)[source]#
Build a regular cell-centered lattice (NEST
nest.spatial.grid).Node
kruns with the first axis slowest (k = col * ny [* nz] + ...); theyaxis decreases from top to bottom, matching NEST’s raster order.- Parameters:
shape (
sequenceofint) – Two- or three-element grid shape[nx, ny]or[nx, ny, nz].extent (
sequenceorQuantity, optional) – Physical size per dimension; defaults to a unit box[1.0] * ndim.center (
sequenceorQuantity, optional) – Layer center; defaults to the origin.
- Returns:
A concrete layer of
prod(shape)cell-centered positions.- Return type:
Examples
>>> from brainpy import state as bp >>> import brainunit as u >>> layer = bp.spatial.grid([4, 3], extent=[2.0, 1.5]) >>> layer.n 12 >>> bool(u.math.allclose(layer.coords[0], [-0.75, 0.5] * u.um)) True