ibl_alignment_gui.plugins.cluster_features
Functions
|
Return a zeroed array to accumulate correlograms into. |
|
Return the difference between arr and a copy shifted by steps. |
|
Increment some indices in a 1D vector of non-negative integers. |
|
Replace scalars in an array by their indices in a lookup table. |
|
Return the symmetrized version of the cross-correlogram arrays. |
Triggered when a cluster in a scatter plot is clicked. |
|
Compute time vectors for autocorrelogram and template waveform plots. |
|
Compute the autocorrelogram for a specific cluster. |
|
Retrieve the template waveform for a specific cluster. |
|
Set up the Cluster Features plugin. |
|
Compute all pairwise cross-correlograms among the clusters in spike_clusters. |
Classes
A popup qt window per cluster. |
|
Manager for multiple cluster popups in the GUI. |
- class ibl_alignment_gui.plugins.cluster_features.ClusterPopup(title, view, data=None)[source]
Bases:
PopupWindowA popup qt window per cluster.
Shows plots of the cluster autocorrelogram and template waveform.
- Parameters:
title (str) – The title of the popup window.
data (dict or None) – A dictionary containing data to be plotted in the popup.
parent (QtWidgets.QMainWindow or None) – The parent window of the popup.
- class ibl_alignment_gui.plugins.cluster_features.ClusterPopupManager(controller)[source]
Bases:
objectManager for multiple cluster popups in the GUI.
- Variables:
parent_view (QtWidgets.QMainWindow) – The main window of the application.
cluster_popups (list) – A list of currently open cluster popups.
popup_status (bool) – Status indicating whether popups are minimised or shown.
- add_popup(shank, clust_no, config, data)[source]
Add a new cluster popup to the manager and set up its signals.
- Parameters:
shank (str) – The name of shank
clust_no (int) – The cluster number.
config (str) – The config of the shank
data (dict) – A dict containing data to be plotted in the popup.
- Return type:
None
- minimise_popups()[source]
Toggle between minimizing and restoring all cluster popups.
- Return type:
None
- popup_closed(popup)[source]
Triggered when a popup is closed by the user.
- Parameters:
popup (ClusterPopup) – The cluster popup that was closed.
- Return type:
None
- teardown(_controller)[source]
Close all cluster popups when the session changes.
Invoked via
execute_plugins('teardown', controller)at the start of a session rebuild so popups tied to the previous session do not linger or get reused.- Parameters:
_controller (AlignmentGUIController) – The main application controller. Accepted to match the plugin hook signature but unused.
- Return type:
None
- ibl_alignment_gui.plugins.cluster_features.callback(controller, items, _, point)[source]
Triggered when a cluster in a scatter plot is clicked.
Computes autocorrelation and template waveform for the selected cluster and opens a popup showing the plots.
- Parameters:
controller (AlignmentGUIController) – The main application controller.
items (ShankController) – The shank controller containing cluster data.
point (pg.ScatterPlotItem) – The clicked scatter item in the scatter plot.
- Return type:
None
- ibl_alignment_gui.plugins.cluster_features.compute_timescales(plot_loader)[source]
Compute time vectors for autocorrelogram and template waveform plots.
- Parameters:
plot_loader (PlotLoader) – The plot loader object containing spike and cluster data.
- Return type:
tuple[ndarray,ndarray]- Returns:
t_autocorr (np.ndarray) – The time vector for autocorrelogram (ms).
t_template (np.ndarray) – The time vector for template waveform (ms).
- ibl_alignment_gui.plugins.cluster_features.get_autocorr(plot_loader, clust_idx)[source]
Compute the autocorrelogram for a specific cluster.
- Parameters:
plot_loader (PlotLoader) – The plot loader object containing spike and cluster data.
clust_idx (int) – Index of the cluster
- Return type:
tuple[ndarray,int]- Returns:
autocorr (np.ndarray) – The autocorrelogram of the selected cluster
clust_id (int) – The cluster id of the selected cluster
- ibl_alignment_gui.plugins.cluster_features.get_template_wf(plot_loader, clust_idx)[source]
Retrieve the template waveform for a specific cluster.
- Parameters:
plot_loader (PlotLoader) – The plot loader object containing spike and cluster data.
clust_idx (int) – Index of the cluster
- Returns:
template_wf – The template waveform of the selected cluster
- Return type:
np.ndarray
- ibl_alignment_gui.plugins.cluster_features.setup(controller)[source]
Set up the Cluster Features plugin.
Adds a submenu to the main GUI for managing the cluster popups.
- Parameters:
controller (AlignmentGUIController) – The main application controller.
- Return type:
None
- ibl_alignment_gui.plugins.cluster_features.xcorr(spike_times, spike_clusters, bin_size=None, window_size=None)[source]
Compute all pairwise cross-correlograms among the clusters in spike_clusters.
- Parameters:
spike_times (np.ndarray) – Spike times in seconds. Must be sorted in increasing order.
spike_clusters (np.ndarray) – Spike-cluster mapping, same shape as spike_times.
bin_size (float) – Size of the bin, in seconds.
window_size (float) – Size of the window, in seconds.
- Returns:
An (n_clusters, n_clusters, winsize_samples) array holding all pairwise cross-correlograms.
- Return type:
np.ndarray