eelbrain.NDVar.summary

NDVar.summary(*dims, **regions)

Aggregate specified dimensions.

Warning

Data is collapsed over the different dimensions in turn using the provided function with an axis argument. For certain functions this is not equivalent to collapsing over several axes concurrently (e.g., np.var).

dimension:

A whole dimension is specified as string argument. This dimension is collapsed over the whole range.

range:

A range within a dimension is specified through a keyword-argument. Only the data in the specified range is included. Use like the sub() method.

additional kwargs:

funccallable

Function used to collapse the data. Needs to accept an “axis” kwarg (default: np.mean)

namestr

Name for the new NDVar.

Returns:

summary – Result of applying the summary function over specified dimensions.

Return type:

float | Var | NDVar

Examples

Assuming data is a normal time series. Get the average in a time window:

>>> y = data.summary(time=(.1, .2))

Get the peak in a time window:

>>> y = data.summary(time=(.1, .2), func=np.max)

Assuming meg is an NDVar with dimensions time and sensor. Get the average across sensors 5, 6, and 8 in a time window:

>>> roi = [5, 6, 8]
>>> y = meg.summary(sensor=roi, time=(.1, .2))

Get the peak in the same data:

>>> roi = [5, 6, 8]
>>> peak = meg.summary(sensor=roi, time=(.1, .2), func=np.max)

Get the RMS over all sensors

>>> meg_rms = meg.summary('sensor', func=rms)