biosppy.spatial.eam

biosppy.spatial.eam

This module provides functions for computing and visualizing electrophysiological activation maps (EAMs) from electrogram (EGM) data. It includes functions for calculating conduction velocity (CV) using triangulation of activation times, as well as interpolation of values across a 3D mesh. The module also provides a function for plotting the geometry of the mesh with the computed values using PyVista.

copyright:
  1. 2015-2026 by Instituto de Telecomunicacoes

license:

BSD 3-clause, see LICENSE for more details.

Functions

cv_triangulation(egmX, lat[, min_dist, ...])

Computes the conduction velocity (CV) and CV vector at each point in a 3D mesh using triangulation.

interpolator(X, y, X_new[, kernel])

Interpolates values at new points using Radial Basis Function (RBF) interpolation.

plot_geometry(X, triang[, values, cmap, ...])

Plots a 3D mesh using PyVista.

biosppy.spatial.eam.cv_triangulation(egmX, lat, min_dist=2, min_lat=2, verbose=1)[source]

Computes the conduction velocity (CV) and CV vector at each point in a 3D mesh using triangulation.

Parameters:
  • egmX (np.ndarray) – An Nx3 array of vertex coordinates.

  • lat (np.ndarray) – An array of activation times corresponding to each vertex in egmX.

  • min_dist (float, optional) – The minimum distance (in mm) between points to be considered for CV calculation. Defaults to 2 mm.

  • min_lat (float, optional) – The minimum difference in activation time (in ms) between points to be considered for CV calculation. Defaults to 2 ms.

  • verbose (int, optional) – If set to 1, displays a progress bar during the CV calculation. Defaults to 1.

Returns:

  • cvs (np.ndarray) – An array of conduction velocities (in m/s) corresponding to each vertex in egmX

  • vecs (np.ndarray) – An Nx3 array of conduction velocity vectors corresponding to each vertex in egmX.

  • cv_X (np.ndarray) – An Nx3 array of vertex coordinates corresponding to the calculated conduction velocities and vectors.

biosppy.spatial.eam.interpolator(X, y, X_new, kernel='multiquadric')[source]

Interpolates values at new points using Radial Basis Function (RBF) interpolation.

Parameters:
  • X (np.ndarray) – An NxD array of original data points.

  • y (np.ndarray) – An array of values corresponding to each point in X.

  • X_new (np.ndarray) – An MxD array of new data points where interpolation is to be performed.

  • kernel (str, optional) – The type of RBF kernel to use. Defaults to ‘multiquadric’.

Returns:

y_new (np.ndarray) – An array of interpolated values corresponding to each point in X_new.

biosppy.spatial.eam.plot_geometry(X, triang, values=None, cmap=<Mock name='mock()' id='138576839715040'>, lims=None, type='activation', center=None, vec=None)[source]

Plots a 3D mesh using PyVista.

Parameters:
  • X (np.ndarray) – An Nx3 array of vertex coordinates.

  • triang (np.ndarray) – An Mx3 array of triangle indices.

  • values (np.ndarray, optional) – An array of scalar values for coloring the mesh.

  • cmap (matplotlib.colors.Colormap, optional) – A colormap for coloring the mesh.

  • lims (tuple, optional) – A tuple specifying the min and max limits for truncating the colormap.

  • type (str, optional) – A string specifying the type of map (e.g., ‘activation’, ‘voltage’, ‘cv’, ‘cv_vec’ or any other custom label). Defaults to ‘activation’.

  • center (np.ndarray, optional) – An Nx3 array of coordinates for the center points of the vectors (required if type is ‘cv_vec’).

  • vec (np.ndarray, optional) – An Nx3 array of vector components (required if type is ‘cv_vec’).