mvpa2.misc.neighborhood.scatter_neighborhoods(neighbor_gen, coords, deterministic=False)

Scatter neighborhoods over a coordinate list.

Neighborhood seeds (or centers) are placed on coordinates drawn from a provided list so that no seed is part of any other neighborhood. Depending on the actual shape and size of the neighborhoods, their elements can be overlapping, only the seeds (or centers) are guaranteed to be non-overlapping with any other neighborhood. This can be used to perform sparse sampling of a given space.


neighbor_gen : neighborhood generator

Callable that return a list of neighborhood element coordinates, when called with a seed coordinate (cf. Sphere)

coords : list

List of candidate coordinates that can serve as neighborhood seeds or elements.

deterministic : bool

If true, performs seed placement using an OrderedDict (available in Python 2.7 or later) to guarantee deterministic placement of neighborhood seeds in consecutive runs with identical input arguments.


coordinates, indices :

Two lists are returned. The first list contains the choosen seed coordinates (a subset of the input coordinates), the second list contains the indices of the respective seeds coordinates in the input coordinate list. If particular coordinates are present multiple times the index list will contain all indices corresponding to these coordinates.