ibllib.plots.figures

Module that produces figures, usually for the extraction pipeline

Functions

dlc_qc_plot

Creates DLC QC plot.

ephys_bad_channels

raw_destripe

remove_axis_outline

Function to remove outline of empty axis

set_axis_label_size

Function to normalise size of all axis labels

Classes

ApPlots

Plots AP RMS plots

BadChannelsAp

Plots raw electrophysiology AP band task = BadChannelsAp(pid, one=one=one)

BehaviourPlots

Behavioural plots.

HistologySlices

Plots coronal and sagittal slice showing electrode locations.

LfpPlots

Plots LFP spectrum and LFP RMS plots

SpikeSorting

Plots raw electrophysiology AP band

set_axis_label_size(ax, labels=14, ticklabels=12, title=14, cmap=False)[source]

Function to normalise size of all axis labels

Parameters:
  • ax

  • labels

  • ticklabels

  • title

  • cmap

Returns:

remove_axis_outline(ax)[source]

Function to remove outline of empty axis

Parameters:

ax

Returns:

class BehaviourPlots(eid, session_path=None, one=None, **kwargs)[source]

Bases: ReportSnapshot

Behavioural plots.

property signature

The signature of the task specifies inputs and outputs for the given task. For some tasks it is dynamic and calculated. The legacy code specifies those as tuples. The preferred way is to use the ExpectedDataset input and output constructors.

I = ExpectedDataset.input O = ExpectedDataset.output signature = {

‘input_files’: [

I(name=’extract.me.npy’, collection=’raw_data’, required=True, register=False, unique=False),

], ‘output_files’: [

O(name=’look.atme.npy’, collection=’shiny_data’, required=True, register=True, unique=False)

]} is equivalent to: signature = {

‘input_files’: [(‘extract.me.npy’, ‘raw_data’, True, True)], ‘output_files’: [(‘look.atme.npy’, ‘shiny_data’, True)], }

Returns:

class HistologySlices(pid, session_path=None, one=None, brain_regions=None, brain_atlas=None, **kwargs)[source]

Bases: ReportSnapshotProbe

Plots coronal and sagittal slice showing electrode locations.

get_probe_signature()[source]
class LfpPlots(pid, session_path=None, one=None, brain_regions=None, brain_atlas=None, **kwargs)[source]

Bases: ReportSnapshotProbe

Plots LFP spectrum and LFP RMS plots

get_probe_signature()[source]
class ApPlots(pid, session_path=None, one=None, brain_regions=None, brain_atlas=None, **kwargs)[source]

Bases: ReportSnapshotProbe

Plots AP RMS plots

get_probe_signature()[source]
class SpikeSorting(pid, session_path=None, one=None, brain_regions=None, brain_atlas=None, **kwargs)[source]

Bases: ReportSnapshotProbe

Plots raw electrophysiology AP band

Parameters:
  • session_path – session path

  • probe_id – str, UUID of the probe insertion for which to create the plot

  • **kwargs

    keyword arguments passed to tasks.Task

get_probe_signature()[source]
get_signatures(**kwargs)[source]

This is the default but should be overwritten for each task :return:

class BadChannelsAp(pid, session_path=None, one=None, brain_regions=None, brain_atlas=None, **kwargs)[source]

Bases: ReportSnapshotProbe

Plots raw electrophysiology AP band task = BadChannelsAp(pid, one=one=one)

Parameters:
  • session_path – session path

  • probe_id – str, UUID of the probe insertion for which to create the plot

  • **kwargs

    keyword arguments passed to tasks.Task

get_probe_signature()[source]
ephys_bad_channels(raw, fs, channel_labels, channel_features, h=None, channels=None, title='ephys_bad_channels', save_dir=None, destripe=False, eqcs=None, br=None, pid_info=None, plot_backend='matplotlib')[source]
raw_destripe(raw, fs, t0, i_plt, n_plt, fig=None, axs=None, savedir=None, detect_badch=True, SAMPLE_SKIP=200, DISPLAY_TIME=0.05, N_CHAN=384, MIN_X=-0.00011, MAX_X=0.00011)[source]
Parameters:
  • raw – raw ephys data, Ns x Nc, x-axis: time (s), y-axis: channel

  • fs – sampling freq (Hz) of the raw ephys data

  • t0 – time (s) of ephys sample beginning from session start

  • i_plt – increment of plot to display image one (start from 0, has to be < n_plt)

  • n_plt – total number of subplot on figure

  • fig – figure handle

  • axs – axis handle

  • savedir – filename, including directory, to save figure to

  • detect_badch – boolean, to detect or not bad channels

  • SAMPLE_SKIP – number of samples to skip at origin of ephsy sample for display

  • DISPLAY_TIME – time (s) to display

  • N_CHAN – number of expected channels on the probe

  • MIN_X – max voltage for color range

  • MAX_X – min voltage for color range

Returns:

fig, axs

dlc_qc_plot(session_path, one=None, device_collection='raw_video_data', cameras=('left', 'right', 'body'), trials_collection='alf')[source]

Creates DLC QC plot. Data is searched first locally, then on Alyx. Panels that lack required data are skipped.

Required data to create all panels

‘raw_video_data/_iblrig_bodyCamera.raw.mp4’, ‘raw_video_data/_iblrig_leftCamera.raw.mp4’, ‘raw_video_data/_iblrig_rightCamera.raw.mp4’, ‘alf/_ibl_bodyCamera.dlc.pqt’, ‘alf/_ibl_leftCamera.dlc.pqt’, ‘alf/_ibl_rightCamera.dlc.pqt’, ‘alf/_ibl_bodyCamera.times.npy’, ‘alf/_ibl_leftCamera.times.npy’, ‘alf/_ibl_rightCamera.times.npy’, ‘alf/_ibl_leftCamera.features.pqt’, ‘alf/_ibl_rightCamera.features.pqt’, ‘alf/rightROIMotionEnergy.position.npy’, ‘alf/leftROIMotionEnergy.position.npy’, ‘alf/bodyROIMotionEnergy.position.npy’, ‘alf/_ibl_trials.choice.npy’, ‘alf/_ibl_trials.feedbackType.npy’, ‘alf/_ibl_trials.feedback_times.npy’, ‘alf/_ibl_trials.stimOn_times.npy’, ‘alf/_ibl_wheel.position.npy’, ‘alf/_ibl_wheel.timestamps.npy’, ‘alf/licks.times.npy’,

Params session_path:

Path to session data on disk

Params one:

ONE instance, if None is given, default ONE is instantiated

Returns:

Matplotlib figure