osl_dynamics.utils.topoplots#

Classes and functions to make topoplots.

Module Contents#

Classes#

Topology

Topology class.

Functions#

available_layouts()

get_layout(layout_name)

available_outlines()

get_outline(outline_name)

osl_dynamics.utils.topoplots.available_layouts()[source]#
osl_dynamics.utils.topoplots.get_layout(layout_name)[source]#
osl_dynamics.utils.topoplots.available_outlines()[source]#
osl_dynamics.utils.topoplots.get_outline(outline_name)[source]#
class osl_dynamics.utils.topoplots.Topology(layout)[source]#

Topology class.

Parameters:

layout (str) – Path to layout file.

property width[source]#

Dynamically calculate the bounding width of the topology.

property height[source]#

Dynamically calculate the bounding height of the topology.

property sensor_positions[source]#
property sensor_deltas[source]#
property sensor_names[source]#
property min_x[source]#
property min_y[source]#
property max_x[source]#
property max_y[source]#
property channel_ids[source]#
read_lay(filename)[source]#

Read .lay topology files

Every line in a .lay file represents a sensor. The data is delimited by whitespace. The columns are: channel ID, X, Y, width, height, name.

Parameters:

filename (str) – The location of a .lout file

read_outline(filename)[source]#
keep_channels(channel_names)[source]#

Remove channels which aren’t present in channel_names

Remove any channels which don’t correspond to on in the names provided. This is probably a strong case for using Pandas for data storage.

Parameters:

channel_names (list of str) – A list of channel names which are present in the data. All others are removed.

plot_data(data, plot_boxes=False, show_names=False, title=None, show_deleted_sensors=False, colorbar=True, axis=None, cmap='plasma', n_contours=10)[source]#

Interpolate the data in sensor-space and plot it.

Given a data vector which corresponds to each sensor in the topology, resample the data by interpolating over a grid. Use this data to create a contour plot. Also display the sensor locations and head shape.

Parameters:
  • data (numpy.array or list) – A vector with data corresponding to each sensor.

  • plot_boxes (bool, optional) – Plot boxes to display the height and width of sensors, rather than just the centers.

  • show_names (bool, optional) – Display channel names.

  • title (str, optional) – Title for plot.

  • show_deleted_sensors (bool, optional) – Plot the sensors which have been deleted, in red.

  • colorbar (bool, optional) – Display colorbar

  • axis (matplotlib.pyplot.Axes, optional) – matplotlib axis to plot on.

  • cmap (str, optional) – Colourmap to use in plot. Defaults to matplotlib’s plasma.

  • n_contours (int, optional) – Number of contours to use in plot.

Returns:

fig – Figure.

Return type:

matplotlib.figure