SciPy

pynibs.visualization package

Submodules

pynibs.visualization.plot_2D module

pynibs.visualization.plot_2D.plot_io_curve(mep_data, local_mag_e, title='I/O curve', y_axis_label='EMG p2p-amplitude, µV', x_axis_label='mag(E), V/m, scaled', fit_fun=None, screenshot_fn=None, interactive=False)

Plot scattered data of MEP-mag(E) pairs (=> I/O curve). Optionally the fit of the proided fit function can be overlaid.

Parameters:
  • mep_data (np.ndarray[float], [n_stims]) – The acquired MEPs fo each stimulation.

  • local_mag_e (np.ndarray[float], [n_stims]) – The local electric field magnitude at the ROI element the I/O curve should be plotted from.

  • title (str, optional) – The title of the plot; default: “I/O curve”

  • y_axis_label (str, optional) – The title of the y-axis; default: “EMG p2p-amplitude, µV”

  • x_axis_label (str, optional) – The title of the x-axis; default: “mag(E), V/m, scaled”

  • fit_fun (Callable, optional) – If provided, the fit of the I/O curve with the provided function will be computed and displayed. Currently supported: pynibs.simgoid4, pynibs.sigmoid4_log, pynibs.linear

  • screenshot_fn (str, optional) – If provided, output the plotted image to that file location.

  • interactive (bool) – If True, spawn plot in blocking window.

Return type:

True if successful, False otherwise.

pynibs.visualization.render_3D module

pynibs.visualization.render_3D.render_coil_positions(coil_conf_set_1_positions, coil_conf_set_1_orientations, coil_conf_set_2_positions=None, coil_conf_set_2_orientations=None, fn_mesh=None, surf_type='skin', viewport_dim=(1280, 720), camera_polar_coords=(-175, 66, 110), screenshot_fn=None, interactive=False)

Plots coil positions (and their orientation) in space, optionally also display a second set of coil positions, optionally also display a surface (e.g. gray matter or skin)

pynibs.visualization.render_3D.render_data_on_surface(points, tris, data, viewport_dim=(1280, 720), camera_polar_coords=(-175, 66, 110), title=None, data_name='Data', colormap='jet', screenshot_fn=None, interactive=False)

Plots data on surface: - If the number of data points equals the number of vertices in the mesh, the data will be displayed as point data. - If the number of data points equals the number of triangles in the mesh, the data will be displayed as cell data.

Parameters:
  • points (np.darray[float], [n_points x 3]) – Points (vertices) of surface mesh.

  • tris (np.array[float], [n_tris x 3]) – Connectivity list of triangles.

  • data (np.array[float], [n_tris]) – Data in triangular center

  • viewport_dim (Tuple[int, int]) – Size of the viewport. Default: (1280, 720)

  • camera_polar_coords (Tuple[float, float, float)) – The coordinate of the camera around the object in polar coordinates: (azimuthal angle, polar angle, radius)

  • title (str) – Tile of the rendering window.

  • data_name (str) – Name of the visualized data set.

  • colormap (str) – Identifier of the desired color map. Available colormaps are: ‘Accent’, ‘Blues’, ‘BrBG’, ‘BuGn’, ‘BuPu’, ‘CMRmap’, ‘Dark2’, ‘GnBu’, ‘Greens’, ‘Greys’ ‘OrRd’, ‘Oranges’, ‘PRGn’, ‘Paired’, ‘Pastel1’, ‘Pastel2’, ‘PiYG’, ‘PuBu’, ‘PuBuGn’, ‘PuOr’, ‘PuRd’, ‘Purples’, ‘RdBu’, ‘RdGy’, ‘RdPu’, ‘RdYlBu’, ‘RdYlGn’, ‘Reds’, ‘Set1’, ‘Set2’, ‘Set3’ ‘Spectral’, ‘Vega10’, ‘Vega20’, ‘Vega20b’, ‘Vega20c’, ‘Wistia’, ‘YlGn’, ‘YlGnBu’, ‘YlOrBr’, ‘YlOrRd’, ‘afmhot’, ‘autumn’, ‘binary’, ‘black-white’, ‘blue-red’, ‘bone’, ‘brg’, ‘bwr’, ‘cool’, ‘coolwarm’, ‘copper’, ‘cubehelix’, ‘file’, ‘flag’, ‘gist_earth’, ‘gist_gray’, ‘gist_heat’, ‘gist_ncar’, ‘gist_rainbow’, ‘gist_stern’, ‘gist_yarg’, ‘gnuplot’, ‘gnuplot2’, ‘gray’, ‘hot’, ‘hsv’, ‘inferno’, ‘jet’, ‘magma’, ‘nipy_spectral’, ‘ocean’, ‘pink’, ‘plasma’, ‘prism’, ‘rainbow’, ‘seismic’, ‘spectral’, ‘spring’, ‘summer’, ‘terrain’, ‘viridis’, ‘winter’

  • screenshot_fn (str | None) – If provided a screenshot will be saved to that path.

  • interactive (bool) – If true, a blocking window will be spawned.

Return type:

True if successful, False in case of a fatal error.