ibl_alignment_gui.plugins.ephys_features

Functions

callback

Open the ephys features viewer.

setup

Set up the ephys features plugin in the controller.

Classes

EphysFeatureView

A view for displaying ephys features within regions.

EphysFeatures

A plugin for visualising ephys features within brain regions.

class ibl_alignment_gui.plugins.ephys_features.EphysFeatureView(title, controller, step=10)[source]

Bases: PopupWindow

A view for displaying ephys features within regions.

Parameters:
  • title (str) – The title of the popup window

  • controller (AlignmentGUIController) – The main application controller.

  • step (int) – The number of probes to show per page.

plots_hist

A list of plot items for the histology regions.

Type:

list

plots_feat

A list of plot items for the ephys features.

Type:

list

plots_cbar

A list of plot items for the colorbars.

Type:

list

fig_areas

A list of graphics layout widgets for each probe.

Type:

list

step

The number of probes to show per page.

Type:

int

controller

The main application controller.

Type:

AlignmentGUIController

property aligned: bool

Whether the plots are aligned.

clear_plots()[source]

Clear all plots.

Return type:

None

static create_figures()[source]

Create the plot items for each probe.

Return type:

tuple[GraphicsLayoutWidget, PlotItem, PlotItem, PlotItem]

property normalised: bool

Whether the plots are normalised.

plot_probe(idx, data, offset, levels=None)[source]

Plot the feature data for a single probe.

Parameters:
  • idx (int) – The index of the probe to plot.

  • data (dict) – The feature data for the probe.

  • offset (float) – The offset to apply to the y-axis.

  • levels (list, optional) – The color levels to use for the plot.

Return type:

None

plot_region(idx, data, offset, selected_region)[source]

Plot the histology regions for a single probe.

Parameters:
  • idx (int) – The index of the probe to plot.

  • data (dict) – The region data for the probe.

  • offset (float) – The offset to apply to the y-axis.

  • selected_region (int) – The id of the currently selected region.

Return type:

None

setup()[source]

Add widgets to the main layout.

Return type:

None

class ibl_alignment_gui.plugins.ephys_features.EphysFeatures(title, controller)[source]

Bases: object

A plugin for visualising ephys features within brain regions.

Parameters:
  • title (str) – The title of the popup window.

  • controller (AlignmentGUIController) – The main application controller.

page_num

The total number of pages.

Type:

int

page_idx

The current page index.

Type:

int

step

The number of probes to show per page.

Type:

int

max_idx

The maximum index of probes.

Type:

int

levels

The current color levels.

Type:

list

max_levels

The maximum color levels across all probes within the region.

Type:

list

plot_name

The name of the feature to plot.

Type:

str

plot_idx

The index of the feature to plot.

Type:

int

cmap

The name of the colormap to use.

Type:

str

chosen_region

The id of the currently selected region.

Type:

int

pids

The list of probe ids that pass through the chosen region.

Type:

list

current_pids

The list of probe ids for the current page.

Type:

list

selected_pid

The currently selected probe id.

Type:

str

selected_idx

The index of the currently selected probe within the current page.

Type:

int

feature_data

A bunch containing the feature data for each pid.

Type:

Bunch

region_data

A bunch containing the region data for each pid.

Type:

Bunch

offset_data

A bunch containing the offset data for each pid.

Type:

Bunch

property aligned: bool

Whether the plots are aligned.

get_features()[source]

Download ephys atlas features table from S3.

Returns:

The ephys atlas features table.

Return type:

pd.DataFrame

get_pids()[source]

Get the list of probe ids for the current page.

Returns:

An array of probe ids for the current page.

Return type:

np.ndarray

get_regions(controller)[source]

Get all unique Allen region ids for the shanks in the controller.

Parameters:

controller (AlignmentGUIController) – The main application controller.

Returns:

An array of unique Allen region ids.

Return type:

np.ndarray

load_data(pids)[source]

Prepare feature, region and offset data for a list of probe ids.

Will only prepare data for pids that are not already in the respective data dictionaries.

Parameters:

pids (list) – The list of pids to prepare data for.

Return type:

None

property normalised: bool

Whether the plots are normalised.

on_align_plots()[source]

Align plots based on chosen region.

If align is True then plots are centered on the chosen region.

on_area_clicked(_, idx)[source]

Highlight selected probe and update slider and pid label.

Only works in non-normalised mode.

Parameters:

idx (int) – The index of the clicked area.

Return type:

None

on_close()[source]

Triggered when the plugin window is closed.

Deactivate the plugin and callbacks.

Return type:

None

on_cmap_chosen(idx)[source]

Select colormap to use.

Set new default colormap and re-plot all features.

Parameters:

idx (int) – The index of the chosen colormap.

Return type:

None

on_next_page_pressed()[source]

Go to the next page of probes.

If data needs to be loaded for the new page, it will first be loaded before plotting.

Return type:

None

on_normalise_plots()[source]

Normalise all plots to the same color scale.

Return type:

None

on_plot_chosen(idx)[source]

Select feature to plot.

Set new plot name and prepare data for current pids and plot.

Parameters:

idx (int)

Return type:

None

on_prev_page_pressed()[source]

Go to the previous page of probes.

If data needs to be loaded for the new page, it will first be loaded before plotting.

Return type:

None

on_region_chosen(idx)[source]

Select region to display.

Set new chosen region and get the probes that pass through this region.

Parameters:

idx (int) – The index of the chosen region.

Return type:

None

on_reset_levels()[source]

Reset colour levels to default for the selected probe.

Return type:

None

on_slider_released()[source]

Update colorbar levels based on slider values.

Return type:

None

plot_all(pids)[source]

Update all plots for a list of probe ids.

Parameters:

pids (list or np.ndarray) – The list of probe ids to plot.

Return type:

None

plot_features(pids)[source]

Plot the feature data for a list of probe ids.

Parameters:

pids (list or np.ndarray) – The list of probe ids to plot.

Return type:

None

plot_regions(pids)[source]

Plot the region data for a list of probe ids.

Parameters:

pids (list or np.ndarray) – The list of probe ids to plot.

Return type:

None

plot_single_feature()[source]

Plot the feature data for the currently selected probe.

Return type:

None

prepare_feature_data(pids)[source]

Prepare feature data for a list of probe ids.

Parameters:

pids (list) – The list of pids to prepare data for.

Returns:

feature_data – A bunch containing the feature data for each pid.

Return type:

Bunch

prepare_offset_data(pids)[source]

Prepare offset data for a list of probe ids.

Parameters:

pids (list) – The list of pids to prepare data for.

Returns:

offset_data – A bunch containing the offset data for each pid.

Return type:

Bunch

prepare_region_data(pids)[source]

Prepare region data for a list of probe ids.

Parameters:

pids (list) – The list of pids to prepare data for.

Returns:

region_data – A bunch containing the region data for each pid.

Return type:

Bunch

setup()[source]

Set up the ephys features viewer and connect signals.

Return type:

None

update_page_label()[source]

Update the label showing the current page index.

Return type:

None

ibl_alignment_gui.plugins.ephys_features.callback(controller)[source]

Open the ephys features viewer.

Parameters:

controller (AlignmentGUIController) – The main application controller.

Return type:

None

ibl_alignment_gui.plugins.ephys_features.setup(controller)[source]

Set up the ephys features plugin in the controller.

Parameters:

controller (AlignmentGUIController) – The main application controller.

Return type:

None