diff --git a/brainiak/searchlight/searchlight.py b/brainiak/searchlight/searchlight.py index 968a33e99..651c9c988 100644 --- a/brainiak/searchlight/searchlight.py +++ b/brainiak/searchlight/searchlight.py @@ -23,7 +23,7 @@ """ __all__ = [ - "Searchlight", + "Searchlight", "Shape", "Cube", "Diamond" ] @@ -38,18 +38,16 @@ class Shape: mask_ : a 3D boolean numpy array of size (2*rad+1,2*rad+1,2*rad+1) which is set to True within the boundaries of the desired shape - """ - def __init__(self, rad): - """Constructor + Parameters + ---------- - Parameters - ---------- + rad: radius, in voxels, of the sphere inscribed in the + searchlight cube, not counting the center voxel - rad: radius, in voxels, of the sphere inscribed in the - searchlight cube, not counting the center voxel + """ - """ + def __init__(self, rad): self.rad = rad @@ -57,17 +55,15 @@ class Cube(Shape): """Cube Searchlight shape which is a cube of size (2*rad+1,2*rad+1,2*rad+1) - """ - def __init__(self, rad): - """Constructor - Parameters - ---------- + Parameters + ---------- - rad: radius, in voxels, of the sphere inscribed in the - searchlight cube, not counting the center voxel + rad: radius, in voxels, of the sphere inscribed in the + searchlight cube, not counting the center voxel - """ + """ + def __init__(self, rad): super().__init__(rad) self.rad = rad self.mask_ = np.ones((2*rad+1, 2*rad+1, 2*rad+1), dtype=np.bool) @@ -80,17 +76,15 @@ class Diamond(Shape): inscribed in a cube of size (2*rad+1,2*rad+1,2*rad+1). Any location in the cube which has a Manhattan distance of less than rad from the center point is set to True. - """ - def __init__(self, rad): - """Constructor - Parameters - ---------- + Parameters + ---------- - rad: radius, in voxels, of the sphere inscribed in the - searchlight cube, not counting the center voxel + rad: radius, in voxels, of the sphere inscribed in the + searchlight cube, not counting the center voxel - """ + """ + def __init__(self, rad): super().__init__(rad) self.mask_ = np.zeros((2*rad+1, 2*rad+1, 2*rad+1), dtype=np.bool) for r1 in range(2*self.rad+1): @@ -109,30 +103,28 @@ class Searchlight: Optionally, users can define a block function which runs over larger portions of the volume called blocks. - """ - def __init__(self, sl_rad=1, max_blk_edge=10, shape=Cube, - min_active_voxels_proportion=0): - """Constructor - Parameters - ---------- + Parameters + ---------- - sl_rad: radius, in voxels, of the sphere inscribed in the - searchlight cube, not counting the center voxel + sl_rad: radius, in voxels, of the sphere inscribed in the + searchlight cube, not counting the center voxel - max_blk_edge: max edge length, in voxels, of the 3D block + max_blk_edge: max edge length, in voxels, of the 3D block - shape: brainiak.searchlight.searchlight.Shape indicating the - shape in voxels of the searchlight region + shape: brainiak.searchlight.searchlight.Shape indicating the + shape in voxels of the searchlight region - min_active_voxels_proportion: float - If a searchlight region does not have more than this minimum - proportion of active voxels in the mask, it is not processed by the - searchlight function. The mask used for the test is the - intersection of the global (brain) mask and the `Shape` mask. The - seed (central) voxel of the searchlight region is taken into - consideration. - """ + min_active_voxels_proportion: float + If a searchlight region does not have more than this minimum + proportion of active voxels in the mask, it is not processed by the + searchlight function. The mask used for the test is the + intersection of the global (brain) mask and the `Shape` mask. The + seed (central) voxel of the searchlight region is taken into + consideration. + """ + def __init__(self, sl_rad=1, max_blk_edge=10, shape=Cube, + min_active_voxels_proportion=0): self.sl_rad = sl_rad self.max_blk_edge = max_blk_edge self.min_active_voxels_proportion = min_active_voxels_proportion