Spatial structure¶
Structure classes¶
Structure
classes all inherit from the following base class, and
inherit its methods:
- class BaseStructure[source]¶
Bases:
object
- describe(template='structure_default.txt', engine='default')[source]¶
Returns a human-readable description of the network structure.
The output may be customized by specifying a different template togther with an associated template engine (see
pyNN.descriptions
).If template is None, then a dictionary containing the template context will be returned.
- class Line(dx=1.0, x0=0.0, y=0.0, z=0.0)[source]¶
Bases:
BaseStructure
Represents a structure with neurons distributed evenly on a straight line.
- Arguments:
- dx:
distance between points in the line.
- y, z,:
y- and z-coordinates of all points in the line.
- x0:
x-coordinate of the first point in the line.
- parameter_names = ('dx', 'x0', 'y', 'z')¶
- class Grid2D(aspect_ratio=1.0, dx=1.0, dy=1.0, x0=0.0, y0=0.0, z=0, fill_order='sequential', rng=None)[source]¶
Bases:
BaseStructure
Represents a structure with neurons distributed on a 2D grid.
- Arguments:
- dx, dy:
distances between points in the x, y directions.
- x0, y0:
coordinates of the starting corner of the grid.
- z:
the z-coordinate of all points in the grid.
- aspect_ratio:
ratio of the number of grid points per side (not the ratio of the side lengths, unless
dx == dy
)- fill_order:
may be ‘sequential’ or ‘random’
- parameter_names = ('aspect_ratio', 'dx', 'dy', 'x0', 'y0', 'z', 'fill_order')¶
- class Grid3D(aspect_ratioXY=1.0, aspect_ratioXZ=1.0, dx=1.0, dy=1.0, dz=1.0, x0=0.0, y0=0.0, z0=0, fill_order='sequential', rng=None)[source]¶
Bases:
BaseStructure
Represents a structure with neurons distributed on a 3D grid.
- Arguments:
- dx, dy, dz:
distances between points in the x, y, z directions.
- x0, y0. z0:
coordinates of the starting corner of the grid.
- aspect_ratioXY, aspect_ratioXZ:
ratios of the number of grid points per side (not the ratio of the side lengths, unless
dx == dy == dz
)- fill_order:
may be ‘sequential’ or ‘random’.
If fill_order is ‘sequential’, the z-index will be filled first, then y then x, i.e. the first cell will be at (0,0,0) (given default values for the other arguments), the second at (0,0,1), etc.
- parameter_names = ('aspect_ratios', 'dx', 'dy', 'dz', 'x0', 'y0', 'z0', 'fill_order')¶
- class RandomStructure(boundary, origin=(0.0, 0.0, 0.0), rng=None)[source]¶
Bases:
BaseStructure
Represents a structure with neurons distributed randomly within a given volume.
- Arguments:
boundary - a subclass of
Shape
. origin - the coordinates (x,y,z) of the centre of the volume.
- parameter_names = ('boundary', 'origin', 'rng')¶
Shape classes¶
The Space class¶
- class Space(axes=None, scale_factor=1.0, offset=0.0, periodic_boundaries=None)[source]¶
Class representing a space within distances can be calculated. The space is Cartesian, may be 1-, 2- or 3-dimensional, and may have periodic boundaries in any of the dimensions.
- Arguments:
- axes:
if not supplied, then the 3D distance is calculated. If supplied, axes should be a string containing the axes to be used, e.g. ‘x’, or ‘yz’. axes=’xyz’ is the same as axes=None.
- scale_factor:
it may be that the pre and post populations use different units for position, e.g. degrees and µm. In this case, scale_factor can be specified, which is applied to the positions in the post-synaptic population.
- offset:
if the origins of the coordinate systems of the pre- and post- synaptic populations are different, offset can be used to adjust for this difference. The offset is applied before any scaling.
- periodic_boundaries:
either None, or a tuple giving the boundaries for each dimension, e.g. ((x_min, x_max), None, (z_min, z_max)).
- AXES = {'x': [0], 'xy': [0, 1], 'xyz': range(0, 3), 'xz': [0, 2], 'y': [1], 'yz': [1, 2], 'z': [2], None: range(0, 3)}¶
- distances(A, B, expand=False)[source]¶
Calculate the distance matrix between two sets of coordinates, given the topology of the current space. From http://projects.scipy.org/pipermail/numpy-discussion/2007-April/027203.html
Implementing your own Shape¶
Todo
write this
Implementing your own Structure¶
Todo
write this