Reveal Module
The reveal module provides high-level interfaces for creating comprehensive analysis figures and visualizations using the AtlasReveal class.
Module Overview
This module includes: * Comprehensive figure generation for electrophysiological data * Multi-panel visualization layouts * Feature visualization with histology integration * Classifier result visualization * Quality control and data validation plots
Core Classes
AtlasReveal Class
- ephysatlas.reveal.AtlasReveal.__delattr__(self, name, /)
Implement delattr(self, name).
- ephysatlas.reveal.AtlasReveal.__dir__(self, /)
Default dir() implementation.
- ephysatlas.reveal.AtlasReveal.__eq__(self, value, /)
Return self==value.
- ephysatlas.reveal.AtlasReveal.__format__(self, format_spec, /)
Default object formatter.
- ephysatlas.reveal.AtlasReveal.__ge__(self, value, /)
Return self>=value.
- ephysatlas.reveal.AtlasReveal.__getattribute__(self, name, /)
Return getattr(self, name).
- ephysatlas.reveal.AtlasReveal.__getstate__(self, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__gt__(self, value, /)
Return self>value.
- ephysatlas.reveal.AtlasReveal.__hash__(self, /)
Return hash(self).
- ephysatlas.reveal.AtlasReveal.__init_subclass__()
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- ephysatlas.reveal.AtlasReveal.__le__(self, value, /)
Return self<=value.
- ephysatlas.reveal.AtlasReveal.__lt__(self, value, /)
Return self<value.
- ephysatlas.reveal.AtlasReveal.__ne__(self, value, /)
Return self!=value.
- ephysatlas.reveal.AtlasReveal.__new__(*args, **kwargs)
Create and return a new object. See help(type) for accurate signature.
- ephysatlas.reveal.AtlasReveal.__reduce__(self, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__reduce_ex__(self, protocol, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__repr__(self, /)
Return repr(self).
- ephysatlas.reveal.AtlasReveal.__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- ephysatlas.reveal.AtlasReveal.__sizeof__(self, /)
Size of object in memory, in bytes.
- ephysatlas.reveal.AtlasReveal.__str__(self, /)
Return str(self).
- ephysatlas.reveal.AtlasReveal.__subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
Core Visualization Methods
Feature Visualization
- ephysatlas.reveal.AtlasReveal.__delattr__(self, name, /)
Implement delattr(self, name).
- ephysatlas.reveal.AtlasReveal.__dir__(self, /)
Default dir() implementation.
- ephysatlas.reveal.AtlasReveal.__eq__(self, value, /)
Return self==value.
- ephysatlas.reveal.AtlasReveal.__format__(self, format_spec, /)
Default object formatter.
- ephysatlas.reveal.AtlasReveal.__ge__(self, value, /)
Return self>=value.
- ephysatlas.reveal.AtlasReveal.__getattribute__(self, name, /)
Return getattr(self, name).
- ephysatlas.reveal.AtlasReveal.__getstate__(self, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__gt__(self, value, /)
Return self>value.
- ephysatlas.reveal.AtlasReveal.__hash__(self, /)
Return hash(self).
- ephysatlas.reveal.AtlasReveal.__init_subclass__()
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- ephysatlas.reveal.AtlasReveal.__le__(self, value, /)
Return self<=value.
- ephysatlas.reveal.AtlasReveal.__lt__(self, value, /)
Return self<value.
- ephysatlas.reveal.AtlasReveal.__ne__(self, value, /)
Return self!=value.
- ephysatlas.reveal.AtlasReveal.__new__(*args, **kwargs)
Create and return a new object. See help(type) for accurate signature.
- ephysatlas.reveal.AtlasReveal.__reduce__(self, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__reduce_ex__(self, protocol, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__repr__(self, /)
Return repr(self).
- ephysatlas.reveal.AtlasReveal.__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- ephysatlas.reveal.AtlasReveal.__sizeof__(self, /)
Size of object in memory, in bytes.
- ephysatlas.reveal.AtlasReveal.__str__(self, /)
Return str(self).
- ephysatlas.reveal.AtlasReveal.__subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
Classifier Results
- ephysatlas.reveal.AtlasReveal.__delattr__(self, name, /)
Implement delattr(self, name).
- ephysatlas.reveal.AtlasReveal.__dir__(self, /)
Default dir() implementation.
- ephysatlas.reveal.AtlasReveal.__eq__(self, value, /)
Return self==value.
- ephysatlas.reveal.AtlasReveal.__format__(self, format_spec, /)
Default object formatter.
- ephysatlas.reveal.AtlasReveal.__ge__(self, value, /)
Return self>=value.
- ephysatlas.reveal.AtlasReveal.__getattribute__(self, name, /)
Return getattr(self, name).
- ephysatlas.reveal.AtlasReveal.__getstate__(self, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__gt__(self, value, /)
Return self>value.
- ephysatlas.reveal.AtlasReveal.__hash__(self, /)
Return hash(self).
- ephysatlas.reveal.AtlasReveal.__init_subclass__()
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- ephysatlas.reveal.AtlasReveal.__le__(self, value, /)
Return self<=value.
- ephysatlas.reveal.AtlasReveal.__lt__(self, value, /)
Return self<value.
- ephysatlas.reveal.AtlasReveal.__ne__(self, value, /)
Return self!=value.
- ephysatlas.reveal.AtlasReveal.__new__(*args, **kwargs)
Create and return a new object. See help(type) for accurate signature.
- ephysatlas.reveal.AtlasReveal.__reduce__(self, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__reduce_ex__(self, protocol, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__repr__(self, /)
Return repr(self).
- ephysatlas.reveal.AtlasReveal.__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- ephysatlas.reveal.AtlasReveal.__sizeof__(self, /)
Size of object in memory, in bytes.
- ephysatlas.reveal.AtlasReveal.__str__(self, /)
Return str(self).
- ephysatlas.reveal.AtlasReveal.__subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
Histology Integration
- ephysatlas.reveal.AtlasReveal.__delattr__(self, name, /)
Implement delattr(self, name).
- ephysatlas.reveal.AtlasReveal.__dir__(self, /)
Default dir() implementation.
- ephysatlas.reveal.AtlasReveal.__eq__(self, value, /)
Return self==value.
- ephysatlas.reveal.AtlasReveal.__format__(self, format_spec, /)
Default object formatter.
- ephysatlas.reveal.AtlasReveal.__ge__(self, value, /)
Return self>=value.
- ephysatlas.reveal.AtlasReveal.__getattribute__(self, name, /)
Return getattr(self, name).
- ephysatlas.reveal.AtlasReveal.__getstate__(self, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__gt__(self, value, /)
Return self>value.
- ephysatlas.reveal.AtlasReveal.__hash__(self, /)
Return hash(self).
- ephysatlas.reveal.AtlasReveal.__init_subclass__()
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- ephysatlas.reveal.AtlasReveal.__le__(self, value, /)
Return self<=value.
- ephysatlas.reveal.AtlasReveal.__lt__(self, value, /)
Return self<value.
- ephysatlas.reveal.AtlasReveal.__ne__(self, value, /)
Return self!=value.
- ephysatlas.reveal.AtlasReveal.__new__(*args, **kwargs)
Create and return a new object. See help(type) for accurate signature.
- ephysatlas.reveal.AtlasReveal.__reduce__(self, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__reduce_ex__(self, protocol, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__repr__(self, /)
Return repr(self).
- ephysatlas.reveal.AtlasReveal.__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- ephysatlas.reveal.AtlasReveal.__sizeof__(self, /)
Size of object in memory, in bytes.
- ephysatlas.reveal.AtlasReveal.__str__(self, /)
Return str(self).
- ephysatlas.reveal.AtlasReveal.__subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
Quality Control
- ephysatlas.reveal.AtlasReveal.__delattr__(self, name, /)
Implement delattr(self, name).
- ephysatlas.reveal.AtlasReveal.__dir__(self, /)
Default dir() implementation.
- ephysatlas.reveal.AtlasReveal.__eq__(self, value, /)
Return self==value.
- ephysatlas.reveal.AtlasReveal.__format__(self, format_spec, /)
Default object formatter.
- ephysatlas.reveal.AtlasReveal.__ge__(self, value, /)
Return self>=value.
- ephysatlas.reveal.AtlasReveal.__getattribute__(self, name, /)
Return getattr(self, name).
- ephysatlas.reveal.AtlasReveal.__getstate__(self, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__gt__(self, value, /)
Return self>value.
- ephysatlas.reveal.AtlasReveal.__hash__(self, /)
Return hash(self).
- ephysatlas.reveal.AtlasReveal.__init_subclass__()
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- ephysatlas.reveal.AtlasReveal.__le__(self, value, /)
Return self<=value.
- ephysatlas.reveal.AtlasReveal.__lt__(self, value, /)
Return self<value.
- ephysatlas.reveal.AtlasReveal.__ne__(self, value, /)
Return self!=value.
- ephysatlas.reveal.AtlasReveal.__new__(*args, **kwargs)
Create and return a new object. See help(type) for accurate signature.
- ephysatlas.reveal.AtlasReveal.__reduce__(self, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__reduce_ex__(self, protocol, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__repr__(self, /)
Return repr(self).
- ephysatlas.reveal.AtlasReveal.__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- ephysatlas.reveal.AtlasReveal.__sizeof__(self, /)
Size of object in memory, in bytes.
- ephysatlas.reveal.AtlasReveal.__str__(self, /)
Return str(self).
- ephysatlas.reveal.AtlasReveal.__subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
Utility Methods
- ephysatlas.reveal.AtlasReveal.__delattr__(self, name, /)
Implement delattr(self, name).
- ephysatlas.reveal.AtlasReveal.__dir__(self, /)
Default dir() implementation.
- ephysatlas.reveal.AtlasReveal.__eq__(self, value, /)
Return self==value.
- ephysatlas.reveal.AtlasReveal.__format__(self, format_spec, /)
Default object formatter.
- ephysatlas.reveal.AtlasReveal.__ge__(self, value, /)
Return self>=value.
- ephysatlas.reveal.AtlasReveal.__getattribute__(self, name, /)
Return getattr(self, name).
- ephysatlas.reveal.AtlasReveal.__getstate__(self, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__gt__(self, value, /)
Return self>value.
- ephysatlas.reveal.AtlasReveal.__hash__(self, /)
Return hash(self).
- ephysatlas.reveal.AtlasReveal.__init_subclass__()
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- ephysatlas.reveal.AtlasReveal.__le__(self, value, /)
Return self<=value.
- ephysatlas.reveal.AtlasReveal.__lt__(self, value, /)
Return self<value.
- ephysatlas.reveal.AtlasReveal.__ne__(self, value, /)
Return self!=value.
- ephysatlas.reveal.AtlasReveal.__new__(*args, **kwargs)
Create and return a new object. See help(type) for accurate signature.
- ephysatlas.reveal.AtlasReveal.__reduce__(self, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__reduce_ex__(self, protocol, /)
Helper for pickle.
- ephysatlas.reveal.AtlasReveal.__repr__(self, /)
Return repr(self).
- ephysatlas.reveal.AtlasReveal.__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- ephysatlas.reveal.AtlasReveal.__sizeof__(self, /)
Size of object in memory, in bytes.
- ephysatlas.reveal.AtlasReveal.__str__(self, /)
Return str(self).
- ephysatlas.reveal.AtlasReveal.__subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
Module Functions
- ephysatlas.reveal.save_figure(func)[source]
Decorator that optionally saves figures returned by methods.
The decorated method should return a figure or a list of figures as its first return value.
- Parameters:
func – The function to be decorated.
- Returns:
Wrapped function with figure saving capability.
- Return type:
function
Note
The decorated method should return a tuple where the first element is a figure or list of figures. The decorator will automatically save figures if save_dir is provided.
- class ephysatlas.reveal.AtlasReveal(one=None, pid=None, df_pid=None)[source]
Bases:
object- STREAM = True
- property x_list
- property xy
- static _aggregate_dephs(df_pid)[source]
Aggregate data by depths.
- Parameters:
df_pid (pd.DataFrame) – DataFrame containing probe data.
- Returns:
- DataFrame aggregated by axial_um with mean values for numeric columns
and mode values for label columns (Cosmos_id, Allen_id).
- Return type:
pd.DataFrame
- figure_01_features_with_histology_columns(scaler=None, df_pid=None)[source]
Create feature visualization with histology columns.
This method creates a comprehensive visualization showing electrophysiological features plotted in channel space with histology overlays.
- Parameters:
scaler (sklearn.preprocessing.StandardScaler, optional) – Scaler for normalizing features. If provided, features are scaled to [-1.2, 1.2] range. Defaults to None.
df_pid (pd.DataFrame, optional) – DataFrame containing probe data. If None, uses self.df_pid. This is useful for displaying raw features if needed. Defaults to None.
- Returns:
- A tuple containing:
fig (matplotlib.figure.Figure): The created figure.
axs (matplotlib.axes.Axes): The axes containing the plot.
- Return type:
- static _plot_raw_ephys(voltage, fs, xy, regions=None, df_pid=None, **kwargs)[source]
Plot raw electrophysiological data with brain regions and voltage traces.
- Parameters:
voltage (np.ndarray) – Voltage data array.
fs (float) – Sampling frequency in Hz.
xy (np.ndarray) – Channel coordinates array.
regions (iblatlas.regions.BrainRegions, optional) – Brain regions object for plotting. Defaults to None.
df_pid (pd.DataFrame, optional) – DataFrame containing probe data. Defaults to None.
**kwargs – Additional keyword arguments passed to plotting functions.
- Returns:
- A tuple containing:
fig (matplotlib.figure.Figure): The created figure.
axs (matplotlib.axes.Axes): Array of axes containing the plots.
- Return type:
- figure_02_classifier_results(df_predictions=None, path_model=None)[source]
Create classifier results visualization.
This method creates a comprehensive visualization showing the results of the channel regions classifier, including true labels, predictions, confidence scores, and cumulative probabilities.
- Parameters:
df_predictions (pd.DataFrame, optional) – DataFrame containing classifier predictions. If None, predictions are computed using the loaded model. Defaults to None.
path_model (Path, optional) – Path to the trained model directory. Required if df_predictions is None. Defaults to None.
- Returns:
- A tuple containing:
fig (matplotlib.figure.Figure): The created figure.
axs (matplotlib.axes.Axes): Array of axes containing the plots.
- Return type:
Note
The figure shows: - Brain regions with Allen labels - True labels (Allen and Cosmos) - Classifier predictions - Confidence scores - Cumulative probabilities across depths
- figure_03_histology_slices()[source]
Create histology slice visualization with probe trajectories.
This method creates a visualization showing three orthogonal slices through the brain atlas with overlaid probe trajectories, including both planned and aligned coordinates.
- Returns:
- A tuple containing:
fig (matplotlib.figure.Figure): The created figure.
axs (matplotlib.axes.Axes): Array of axes containing the three slice views.
- Return type:
Note
The figure shows: - Coronal slice (AP view) at median y-coordinate - Sagittal slice (ML view) at median x-coordinate - Horizontal slice (DV view) at median z-coordinate - Both planned (target) and aligned (actual) probe trajectories
- figure_04_ap_voltage()[source]
Create AP band voltage visualization.
This method creates visualizations showing AP band voltage traces, comparing raw and preprocessed data. The data is filtered and destriped to show the effects of preprocessing.
- Returns:
- A tuple containing:
figs (list): List of two figures showing raw and preprocessed AP data.
axs (list): List of axes arrays for each figure.
- Return type:
Note
The method shows: - Raw AP voltage traces with high-pass filtering - Preprocessed AP voltage traces after destriping - Both visualizations include brain region overlays and channel information - Data is extracted from a 1-second window starting at 600 seconds
- figure_05_lfp_voltage()[source]
Create LFP voltage and CSD visualization.
This method creates visualizations showing LFP voltage traces and current source density (CSD) analysis. The data is filtered, destriped, and processed to show both voltage and CSD representations.
- Returns:
- A tuple containing:
figs (list): List of two figures showing preprocessed LFP and CSD data.
axs (list): List of axes arrays for each figure.
- Return type:
Note
The method shows: - Preprocessed LFP voltage traces after filtering and destriping - Current source density (CSD) analysis with Cadzow denoising - Both visualizations include brain region overlays and channel information - Data is extracted from a 4-second window starting at 600 seconds - CSD is computed with 5x decimation and 200 Hz maximum frequency
- figure_06_bad_channels()[source]
Create bad channel detection visualization.
This method creates a visualization showing the results of bad channel detection on AP band voltage data, including channel labels and feature analysis.
- Returns:
- A tuple containing:
fig (matplotlib.figure.Figure): The created figure.
axs (matplotlib.axes.Axes): The axes containing the bad channel analysis.
- Return type:
Note
The method shows: - Raw AP voltage traces - Bad channel detection results - Channel features used for detection - Data is extracted from a 1-second window starting at 600 seconds