class eelbrain.Sensor(locs, names=None, sysname=None, proj2d='z root', connectivity='none')

Dimension class for representing sensor information

locs : array_like (n_sensor, 3)

list of sensor locations in ALS coordinates, i.e., for each sensor a (anterior, left, superior) coordinate triplet.

names : list of str

Sensor names, same order as locs (default is ['0', '1', '2', ...]).

sysname : str

Name of the sensor system.

proj2d : str

Default 2d projection (default is 'z-root'; for options see notes below).

connectivity : str | list of (str, str) | array of int, (n_edges, 2)

Connectivity between elements. Can be specified as:

  • "none" for no connections
  • "grid" to use adjacency in the sensor names
  • list of connections (e.g., [('OZ', 'O1'), ('OZ', 'O2'), ...])
  • numpy.ndarray of int, shape (n_edges, 2), to specify connections in terms of indices. Each row should specify one connection [i, j] with i < j. If the array’s dtype is uint32, property checks are disabled to improve efficiency.


The following are possible 2d-projections:

'z root':
the radius of each sensor is set to equal the root of the vertical distance from the top of the net.
derive x/y coordinate from height based on a cone transformation.
'lower cone':
only use cone for sensors with z < 0.
Axis and sign :
For example, x+ for anterior, x- for posterior.


>>> locs = [(0,  0,   0),
...         (0, -.25, -.45)]
>>> sensor_dim = Sensor(locs, names=["Cz", "Pz"])
channel_idx : dict

Dictionary mapping channel names to indexes.

locs : array (n_sensors, 3)

Spatial position of all sensors.

names : list of str

Ordered list of sensor names.

x, y, z : array (n_sensors,)

Sensor position x, y and z coordinates.


connectivity(self) Retrieve the dimension’s connectivity graph
dimindex(self, arg) Convert a dimension index to an array index
from_lout([path, transform_2d]) Create a Sensor instance from a *.lout file
from_montage(montage[, channels]) From DigMontage
from_sfp([path]) Create a Sensor instance from an sfp file
from_xyz([path]) Create a Sensor instance from a text file with xyz coordinates
get_connectivity(self) Sensor connectivity as list of (name_1, name_2)
get_locs_2d(self[, proj, extent, frame, …]) Compute a 2 dimensional projection of the sensor locations
index(self[, include, exclude]) Construct an index for specified sensors
index_into_dim(self, dim) Index into a subset dimension
intersect(self, dim[, check_dims]) Create a Sensor dimension that is the intersection with dim
neighbors(self, connect_dist) Find neighboring sensors.
set_connectivity(self[, neighbors, connect_dist]) Define the sensor connectivity through neighbors or distance