ibl_alignment_gui.plugins.ephys_features
Functions
Open the ephys features viewer. |
|
Set up the ephys features plugin in the controller. |
Classes
A view for displaying ephys features within regions. |
|
A plugin for visualising ephys features within brain regions. |
- class ibl_alignment_gui.plugins.ephys_features.EphysFeatureView(title, controller, step=10)[source]
Bases:
PopupWindowA 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.
- Variables:
plots_hist (list) – A list of plot items for the histology regions.
plots_feat (list) – A list of plot items for the ephys features.
plots_cbar (list) – A list of plot items for the colorbars.
fig_areas (list) – A list of graphics layout widgets for each probe.
step (int) – The number of probes to show per page.
controller (AlignmentGUIController) – The main application controller.
- property aligned: bool
Whether the plots are aligned.
- 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, label=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.
label (str, optional) – A label to display above the colorbar (used to mark the reference column).
- 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
- class ibl_alignment_gui.plugins.ephys_features.EphysFeatures(title, controller)[source]
Bases:
objectA plugin for visualising ephys features within brain regions.
- Parameters:
title (str) – The title of the popup window.
controller (AlignmentGUIController) – The main application controller.
- Variables:
page_num (int) – The total number of pages.
page_idx (int) – The current page index.
step (int) – The number of probes to show per page.
max_idx (int) – The maximum index of probes.
levels (list) – The current color levels.
max_levels (list) – The maximum color levels across all probes within the region.
plot_name (str) – The name of the feature to plot.
plot_idx (int) – The index of the feature to plot.
cmap (str) – The name of the colormap to use.
chosen_region (int) – The id of the currently selected region.
pids (list) – The list of probe ids that pass through the chosen region.
current_pids (list) – The list of probe ids for the current page.
selected_pid (str) – The currently selected probe id.
selected_idx (int) – The index of the currently selected probe within the current page.
reference_pid (str or None) – The GUI’s currently selected insertion, pinned as a fixed reference in column 0 on every page.
Noneif the insertion is unavailable or absent from the features table.feature_data (Bunch) – A bunch containing the feature data for each pid.
region_data (Bunch) – A bunch containing the region data for each pid.
offset_data (Bunch) – A bunch containing the offset data for each pid.
- property aligned: bool
Whether the plots are aligned.
- get_features()[source]
Load the full ephys atlas features table.
Reuses the same table downloaded by
FeatureLoaderOnewhile loading the insertion, reading every insertion’s rows rather than only the selected pid’s.- Returns:
The ephys atlas features table for all insertions.
- Return type:
pd.DataFrame
- get_pids()[source]
Get the list of probe ids for the current page.
When a reference insertion is set it is prepended so that it always occupies the first column, with the remaining columns holding the paginated probes.
- 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_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
- property page_step: int
Number of paginated probes per page, reserving column 0 for the reference.
- 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
- 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