ibl_alignment_gui.handlers.shank_handler

Classes

ShankHandler

Model for handling data on a shank of a probe for a given recording configuration.

class ibl_alignment_gui.handlers.shank_handler.ShankHandler(loaders, shank_idx)[source]

Bases: object

Model for handling data on a shank of a probe for a given recording configuration.

Parameters:
  • loaders (Bunch) – A Bunch object containing all the relevant loaders and uploaders to read and write data.

  • shank_idx (int) – The index of the shank in the probe

property chn_max: float

Return the maximum y channel value for the currently active shank.

Returns:

The maximum channel value

Return type:

float

property chn_min: float

Return the minimum y channel value for the currently active shank.

Returns:

The minimum channel value, or 0 if the minimum is positive.

Return type:

float

property feature: ndarray

See AlignmentHandler.feature() for details.

feature2track_lin(depths, feature, track)[source]

Estimate values of depth according to linear fit between feature and track reference lines.

Parameters:
  • depths (np.ndarray) – The depths to estimate the new depths for

  • feature (np.ndarray) – The feature line positions

  • track (np.ndarray) – The track line positions

Returns:

The new estimated depths

Return type:

np.ndarray

property feature_plots: Bunch[str, Bunch]

Access the feature plots from the current shank’s plot loader.

Returns:

A bunch of available feature plots.

Return type:

Bunch

property feature_prev: ndarray

Return the previous feature from the alignment loader for the currently active shank.

Returns:

Previous feature array.

Return type:

np.ndarray

filter_units(filter_type)[source]

Filter the spikesorting data by selected unit type and recompute plot data.

The levels applied to the plots are kept, so that changing the filter doesn’t discard the levels chosen by the user.

Parameters:

filter_type (str) – The type of unit to filter by

Return type:

None

get_mapping_regions(*args, **kwargs)[source]

See AlignmentHandler.get_mapping_regions() for details.

Return type:

tuple

get_reference_histology(*args, **kwargs)[source]

See AlignmentHandler.get_reference_histology() for details.

Return type:

Bunch

get_scaled_histology()[source]

See AlignmentHandler.get_scaled_histology() for details.

Return type:

None

property image_plots: Bunch[str, ImageData]

Access the image plots for the currently active shank.

Returns:

A bunch of available slice plots.

Return type:

Bunch

property line_plots: Bunch[str, LineData]

Access the slice plots for the currently active shank.

Returns:

A bunch of available slice plots.

Return type:

Bunch

load_data()[source]

Load the geometry, ephys and alignment data.

Return type:

None

load_ephys_features(loader)[source]

Load this shank’s ephys-atlas features with loader and keep them.

A features file may hold every channel of a multi-shank probe; loader splits it down to this shank’s channels.

Parameters:

loader (FeatureLoader or None) – The features to use, e.g. the session’s or a features file chosen by the user; None for no features.

Returns:

The features, as stored in raw_data['features'] (exists False when none).

Return type:

Bunch

load_plots()[source]

Load all the plot data for the current shank.

property probe_plots: Bunch[str, ProbeData]

Access the probe plots for the currently active shank.

Returns:

A bunch of available probe plots.

Return type:

Bunch

reset_features_and_tracks()[source]

See AlignmentHandler.reset_features_and_tracks() for details.

Return type:

None

reset_levels()[source]

Reset the levels for all image, scatter, line and probe plots.

Return type:

None

save_progress()[source]

Save the current alignment to file so it can be recovered if the GUI crashes.

Returns:

Message containing information about the save result.

Return type:

str

scale_hist_data(*args, **kwargs)[source]

See AlignmentHandler.scale_hist_data() for details.

Return type:

None

property scatter_plots: Bunch[str, ScatterData]

Access the scatter plots for the currently active shank.

Returns:

A bunch of available slice plots.

Return type:

Bunch

set_init_alignment()[source]

Set the initial alignment based on previous features and tracks.

Return type:

None

set_mapping(mapping)[source]

Show the histology regions in an atlas mapping.

Parameters:

mapping (str) – The atlas mapping, e.g. ‘Allen’, ‘Beryl’ or ‘Cosmos’.

Return type:

None

property slice_plots: Bunch[str, Bunch]

Access the slice plots from the current shank’s plot loader.

Returns:

A bunch of available slice plots.

Return type:

Bunch

property tip_location: ndarray

See AlignmentHandler.tip_location() for details.

property track: ndarray

See AlignmentHandler.track() for details.

property track_lines: list[ndarray]

See AlignmentHandler.track_lines() for details.

upload_data()[source]

Upload the data, save the channels and the alignments.

Return type:

str

values_on_channels(probe)[source]

Get the values of a probe plot on the channels shown on the histology slice.

The probe plots can be on other sites than the channels, e.g. all the electrodes of the metadata when the spike sorting has fewer channels, and in another order, so the values are matched to the channels by their raw channel.

Parameters:

probe (ProbeData or None) – The probe plot.

Returns:

A value per channel, in the order of xyz_channels, NaN where the plot has none. None when the plot has no values, or they cannot be matched to the channels.

Return type:

np.ndarray or None

property xyz_channels: ndarray

See AlignmentHandler.xyz_channels() for details.

property xyz_clusters: ndarray

Return the xyz cluster locations estimated using the fit from the track and feature lines.

The values in the current index in the circular buffer for the currently active shank are used.

Returns:

xyz positions of clusters in 3D space

Return type:

np.ndarray

property xyz_picks: ndarray

Return the xyz picks from the alignment loader for the currently active shank.

Returns:

An array of xyz pick coordinates.

Return type:

np.ndarray

property xyz_track: ndarray

See AlignmentHandler.xyz_track() for details.

property y_max: float

Return the maximum y channel value.

Returns:

The maximum channel value

Return type:

float

property y_min: float

Return the minimum y channel value.

Returns:

The minimum channel value

Return type:

float