pulse2percept.topography.neuropythy

NeuropythyMap

Classes

NeuropythyMap([subject, cache_dir])

class pulse2percept.topography.neuropythy.NeuropythyMap(subject='fsaverage', cache_dir=None, **params)[source]
get_default_params()[source]

Required to inherit from Parametrized

get_param_units()[source]

Return a dict of the units that parameters are stored in

load_meshes(subject)[source]

Predicts retinotopy and loads submeshes for the given subject. Adapted from code courtesy of Noah Benson

dva_to_cortex(x, y, region='v1', hemi=None, surface='midgray')[source]

Gives the cortex position(s) of the visual field point(s) (x,y).

Parameters:
  • x (float or array_like) – The x and y-coordinate(s) of the visual field point(s) to look up (in dva).

  • y (float or array_like) – The x and y-coordinate(s) of the visual field point(s) to look up (in dva).

  • region (str) – The visual field map to look up the point(s) in. Valid options are ‘v1’, ‘v2’, and ‘v3’. Default is ‘v1’.

  • hemi (str) – The hemisphere to look up the point(s) in. Valid options are ‘lh’ and ‘rh’.

  • surface (str) – The surface to look up the point(s) on. Default is ‘midgray’. Other common options include ‘pial’ and ‘white’.

Returns:

  • cortex_pts (array_like) – cortical addresses of the visual field points (cortical addresses provide the face containing a point and the barycentric coordinates of the point within that face).

  • Adapted from code courtesy of Noah Benson

dva_to_v1(x, y, surface='midgray')[source]

Gives the 3D cortex position(s) of the visual field point(s) (x,y) in v1.

Parameters:
  • x (float or array_like) – The x and y-coordinate(s) of the visual field point(s) to look up (in dva).

  • y (float or array_like) – The x and y-coordinate(s) of the visual field point(s) to look up (in dva).

  • surface (str) – The surface to look up the point(s) on. Default is ‘midgray’. Other common options include ‘pial’ and ‘white’.

dva_to_v2(x, y, surface='midgray')[source]

Gives the 3D cortex position(s) of the visual field point(s) (x,y) in v2.

Parameters:
  • x (float or array_like) – The x and y-coordinate(s) of the visual field point(s) to look up (in dva).

  • y (float or array_like) – The x and y-coordinate(s) of the visual field point(s) to look up (in dva).

  • surface (str) – The surface to look up the point(s) on. Default is ‘midgray’. Other common options include ‘pial’ and ‘white’.

dva_to_v3(x, y, surface='midgray')[source]

Gives the 3D cortex position(s) of the visual field point(s) (x,y) in v3.

Parameters:
  • x (float or array_like) – The x and y-coordinate(s) of the visual field point(s) to look up (in dva).

  • y (float or array_like) – The x and y-coordinate(s) of the visual field point(s) to look up (in dva).

  • surface (str) – The surface to look up the point(s) on. Default is ‘midgray’. Other common options include ‘pial’ and ‘white’.

cortex_to_dva(xc, yc, zc)[source]

Gives the visual field position(s) of the cortex point(s) (xc,yc,zc).

Parameters:
  • xc (float or array_like) – The x, y, and z-coordinate(s) of the cortex point(s) to look up (in um).

  • yc (float or array_like) – The x, y, and z-coordinate(s) of the cortex point(s) to look up (in um).

  • zc (float or array_like) – The x, y, and z-coordinate(s) of the cortex point(s) to look up (in um).

Returns:

x, y – The x and y-coordinate(s) of the visual field point(s) (in dva). Both have the same shape as the input. Points that cannot be mapped are NaN: either because the input was NaN, or because no mesh vertex lies within cort_nn_thresh of them.

Return type:

array_like

v1_to_dva(xv1, yv1, zv1)[source]

Convert points in v1 to dva. Uses the mean of the 5 nearest neighbors in the cortical mesh, weighted by 1/distance, to interpolate dva. Any points that are more than self.cort_nn_thresh um from the nearest neighbor will be set to nan.

Parameters:
  • xv1 (float or array_like) – The x, y, and z-coordinate(s) of the v1 point(s) to look up (in um).

  • yv1 (float or array_like) – The x, y, and z-coordinate(s) of the v1 point(s) to look up (in um).

  • zv1 (float or array_like) – The x, y, and z-coordinate(s) of the v1 point(s) to look up (in um).

Returns:

x, y – The x and y-coordinate(s) of the visual field point(s) (in dva).

Return type:

array_like

v2_to_dva(xv2, yv2, zv2)[source]

Convert points in v2 to dva. Uses the mean of the 5 nearest neighbors in the cortical mesh, weighted by 1/distance, to interpolate dva. Any points that are more than self.cort_nn_thresh um from the nearest neighbor will be set to nan.

Parameters:
  • xv2 (float or array_like) – The x, y, and z-coordinate(s) of the v2 point(s) to look up (in um).

  • yv2 (float or array_like) – The x, y, and z-coordinate(s) of the v2 point(s) to look up (in um).

  • zv2 (float or array_like) – The x, y, and z-coordinate(s) of the v2 point(s) to look up (in um).

Returns:

x, y – The x and y-coordinate(s) of the visual field point(s) (in dva).

Return type:

array_like

v3_to_dva(xv3, yv3, zv3)[source]

Convert points in v3 to dva. Uses the mean of the 5 nearest neighbors in the cortical mesh, weighted by 1/distance, to interpolate dva. Any points that are more than self.cort_nn_thresh um from the nearest neighbor will be set to nan.

Parameters:
  • xv3 (float or array_like) – The x, y, and z-coordinate(s) of the v3 point(s) to look up (in um).

  • yv3 (float or array_like) – The x, y, and z-coordinate(s) of the v3 point(s) to look up (in um).

  • zv3 (float or array_like) – The x, y, and z-coordinate(s) of the v3 point(s) to look up (in um).

Returns:

x, y – The x and y-coordinate(s) of the visual field point(s) (in dva).

Return type:

array_like

from_dva()[source]

Returns a dict containing the region(s) that this visuotopy maps to, and the corresponding mapping function(s).

set_params(**params)[source]

Set the parameters of this object

tissue_unit = um[source]

The unit of the tissue side of the map

to_dva()[source]

Returns a dict containing the region(s) that this visuotopy maps from, and the corresponding inverse mapping function(s). This transform is optional for most models.

visual_unit = dva[source]

The unit of the visual field side of the map