brainbox.ephys_plots

Functions

image_crosscorr_plot

Prepare data for 2D cross correlation plot of data across depth

image_fr_plot

Prepare data 2D raster plot of firing rate across recording

image_lfp_spectrum_plot

Prepare data for 2D image plot of LFP power spectrum along depth of probe

image_raw_data

image_rms_plot

Prepare data for 2D image plot of RMS data along depth of probe

line_amp_plot

Prepare data for 1D line plot of average firing rate across depth

line_fr_plot

Prepare data for 1D line plot of average firing rate across depth

plot_brain_regions

Plot brain regions along probe, if channel depths is provided will plot along depth otherwise along channel idx

plot_cdf

Plot cumulative amplitude of spikes across depth

probe_lfp_spectrum_plot

Prepare data for 2D probe plot of LFP power spectrum along depth of probe

probe_rms_plot

Prepare data for 2D probe plot of RMS along depth of probe

scatter_amp_depth_fr_plot

Prepare data for 2D scatter plot of cluster depth vs cluster amp with colour indicating cluster firing rate

scatter_raster_plot

Prepare data for 2D raster plot of spikes with colour and size indicative of spike amplitude

image_lfp_spectrum_plot(lfp_power, lfp_freq, chn_coords=None, chn_inds=None, freq_range=(0, 300), avg_across_depth=False, clim=None, cmap='viridis', display=False, title=None, **kwargs)[source]

Prepare data for 2D image plot of LFP power spectrum along depth of probe

Parameters:
  • lfp_power

  • lfp_freq

  • chn_depths

  • chn_inds

  • freq_range

  • avg_across_depth – Whether to average across channels at same depth

  • cmap

  • display – generate figure

Returns:

ImagePlot object, if display=True also returns matplotlib fig and ax objects

image_rms_plot(rms_amps, rms_times, chn_coords=None, chn_inds=None, avg_across_depth=False, median_subtract=True, clim=None, cmap='plasma', band='AP', display=False, title=None, **kwargs)[source]

Prepare data for 2D image plot of RMS data along depth of probe

Parameters:
  • rms_amps

  • rms_times

  • chn_coords

  • chn_inds

  • avg_across_depth – Whether to average across channels at same depth

  • median_subtract – Whether to apply median subtraction correction

  • cmap

  • band – Frequency band of rms data, can be either ‘LF’ or ‘AP’

  • display – generate figure

Returns:

ImagePlot object, if display=True also returns matplotlib fig and ax objects

scatter_raster_plot(spike_amps, spike_depths, spike_times, n_amp_bins=10, cmap='BuPu', subsample_factor=100, display=False, title=None, **kwargs)[source]

Prepare data for 2D raster plot of spikes with colour and size indicative of spike amplitude

Parameters:
  • spike_amps

  • spike_depths

  • spike_times

  • n_amp_bins – no. of colour and size bins into which to split amplitude data

  • cmap

  • subsample_factor – factor by which to subsample data when too many points for efficient

display :param display: generate figure :return: ScatterPlot object, if display=True also returns matplotlib fig and ax objects

image_fr_plot(spike_depths, spike_times, chn_coords, t_bin=0.05, d_bin=5, cmap='binary', display=False, title=None, **kwargs)[source]

Prepare data 2D raster plot of firing rate across recording

Parameters:
  • spike_depths

  • spike_times

  • chn_coords

  • t_bin – time bin to average across (see also brainbox.processing.bincount2D)

  • d_bin – depth bin to average across (see also brainbox.processing.bincount2D)

  • cmap

  • display – generate figure

Returns:

ImagePlot object, if display=True also returns matplotlib fig and ax objects

image_crosscorr_plot(spike_depths, spike_times, chn_coords, t_bin=0.05, d_bin=40, cmap='viridis', display=False, title=None, **kwargs)[source]

Prepare data for 2D cross correlation plot of data across depth

Parameters:
  • spike_depths

  • spike_times

  • chn_coords

  • t_bin – t_bin: time bin to average across (see also brainbox.processing.bincount2D)

  • d_bin – depth bin to average across (see also brainbox.processing.bincount2D)

  • cmap

  • display – generate figure

Returns:

ImagePlot object, if display=True also returns matploltlib fig and ax objects

scatter_amp_depth_fr_plot(spike_amps, spike_clusters, spike_depths, spike_times, cmap='hot', display=False, title=None, **kwargs)[source]

Prepare data for 2D scatter plot of cluster depth vs cluster amp with colour indicating cluster firing rate

Parameters:
  • spike_amps

  • spike_clusters

  • spike_depths

  • spike_times

  • cmap

  • display – generate figure

Returns:

ScatterPlot object, if display=True also returns matplotlib fig and ax objects

probe_lfp_spectrum_plot(lfp_power, lfp_freq, chn_coords, chn_inds, freq_range=(0, 4), display=False, pad=True, x_offset=1, **kwargs)[source]

Prepare data for 2D probe plot of LFP power spectrum along depth of probe

Parameters:
  • lfp_power

  • lfp_freq

  • chn_coords

  • chn_inds

  • freq_range

  • display

  • pad – whether to add nans around the individual image plots. For matplotlib use pad=True,

for pyqtgraph use pad=False :param x_offset: Distance between the channel banks in x direction :return: ProbePlot object, if display=True also returns matplotlib fig and ax objects

probe_rms_plot(rms_amps, chn_coords, chn_inds, cmap='plasma', band='AP', display=False, pad=True, x_offset=1, **kwargs)[source]

Prepare data for 2D probe plot of RMS along depth of probe

Parameters:
  • rms_amps

  • chn_coords

  • chn_inds

  • cmap

  • band

  • display

  • pad – whether to add nans around the individual image plots. For matplotlib use pad=True,

for pyqtgraph use pad=False :param x_offset: Distance between the channel banks in x direction :return: ProbePlot object, if display=True also returns matplotlib fig and ax objects

line_fr_plot(spike_depths, spike_times, chn_coords, d_bin=10, display=False, title=None, **kwargs)[source]

Prepare data for 1D line plot of average firing rate across depth

Parameters:
  • spike_depths

  • spike_times

  • chn_coords

  • d_bin – depth bin to average across (see also brainbox.processing.bincount2D)

  • display

Returns:

line_amp_plot(spike_amps, spike_depths, spike_times, chn_coords, d_bin=10, display=False, title=None, **kwargs)[source]

Prepare data for 1D line plot of average firing rate across depth

Parameters:
  • spike_amps

  • spike_depths

  • spike_times

  • chn_coords

  • d_bin – depth bin to average across (see also brainbox.processing.bincount2D)

  • display

Returns:

plot_brain_regions(channel_ids, channel_depths=None, brain_regions=None, display=True, ax=None, title=None, label='left', **kwargs)[source]

Plot brain regions along probe, if channel depths is provided will plot along depth otherwise along channel idx

Parameters:
  • channel_ids – atlas ids for each channel

  • channel_depths – depth along probe for each channel

  • brain_regions – BrainRegions object

  • display – whether to output plot

  • ax – axis to plot on

  • title – title for plot

  • kwargs – additional keyword arguments for bar plot

Returns:

plot_cdf(spike_amps, spike_depths, spike_times, n_amp_bins=10, d_bin=40, amp_range=None, d_range=None, display=False, cmap='hot', ax=None)[source]

Plot cumulative amplitude of spikes across depth

Parameters:
  • spike_amps

  • spike_depths

  • spike_times

  • n_amp_bins – number of amplitude bins to use

  • d_bin – the value of the depth bins in um (default is 40 um)

  • amp_range – amp range to use [amp_min, amp_max], if not given automatically computed from spike_amps

  • d_range – depth range to use, by default [0, 3840]

  • display – whether or not to display plot

  • cmap

Returns:

image_raw_data(raw, fs, chn_coords=None, cmap='bone', title=None, display=False, gain=-90, **kwargs)[source]