Skip to main content

Function reference

Models and inference

Load a published model and predict with it.

load_pretrained Load a published model, from the Hugging Face Hub or a local directory.
regionclassifier.RegionClassifier A trained region classifier, ready to predict on a features DataFrame.
models.encoder_inpainting.SpatialEncoder A published spatial encoder, ready to predict features from position.
models.unit_encoder.UnitEncoder A published unit-level model, ready to predict unit phenotypes at brain positions.
models.probe_transformer.ProbeTransformerClassifier A published ProbeTransformer ensemble, ready to predict a region per channel.
model_registry.resolve_model Resolve a model to a local directory by downloading it from the Hugging Face Hub.
model_registry.read_manifest Read a model directory’s manifest, or None when it has none.
model_registry.verify_checksums Re-hash the files checksums.json lists and report every discrepancy at once.

Feature computation

Compute features from a recording. One calculator per source format.

feature_calculators.SpikeGLXFileFeatureCalculator Feature calculator for local SpikeGLX AP/LF files.
feature_calculators.NwbFeatureCalculator Feature calculator for NWB recordings (local, streamed, or DANDI).
feature_calculators.NwbSource Describes how to obtain one SpikeInterface recording from an NWB asset.
feature_calculators.SpikeInterfaceZarrFeatureCalculator Feature calculator for SpikeInterface-native Zarr recordings.
feature_calculators.IBLPIDFeatureCalculator Feature calculator for an IBL probe insertion loaded through ONE.
feature_calculators.LFPackFeatureCalculator Feature calculator for an lfpack-compressed LF archive.
feature_calculators.NumpyArrayFeatureCalculator Feature calculator for an LF array already held in memory.
feature_calculators.BaseFeatureCalculator Abstract base class for source-specific feature calculators.

Computation options

The typed parameters accepted by every calculator.

feature_calculators.SnippetWindow Time window used for one feature-computation snippet.
feature_calculators.FeatureComputationOptions Options controlling one OOP feature-computation call.
feature_calculators.FeatureComputationResult Result returned by one OOP feature computation.
feature_calculators.FeatureParams Typed per-feature parameters forwarded to compute_features_from_raw.
feature_calculators.LfParams Per-feature parameters for the LF feature family.
feature_calculators.CsdParams Per-feature parameters for the CSD feature family.
feature_calculators.WaveformParams Per-feature parameters for the waveforms (spike) feature family.
feature_calculators.DestripeOptions Options used when exposing intermediate destriped snippets.
feature_calculators.DestripedSnippet Raw and destriped AP/LF data for debugging and visual inspection.
feature_calculators.RawSnippet Raw AP/LF voltage arrays and sampling frequencies.

Functional entry points

Procedural wrappers over the calculators, and the underlying engine.

feature_computation.compute_features_from_pid Compute electrophysiological features from a probe ID using the ONE database.
feature_computation.compute_features_from_file Compute features from .cbin files.
feature_computation.compute_features_from_raw Compute electrophysiological features from raw numpy arrays of AP and LF data.
feature_computation.compute_features_from_destriped Compute features from already-destriped AP/LF arrays.
feature_computation.destripe_ap_lf Destripe raw AP and LF snippets with ibldsp.
feature_computation.add_target_coordinates Add target coordinates to channel information using trajectory data.

Feature primitives and schemas

The per-band feature functions and the pandera schemas that validate them.

features.lf Compute LF features from a numpy array.
features.csd Compute CSD and BPR features from a numpy array.
features.cadzow_lfp_kwargs Cadzow parameters used to denoise the LFP before the CSD and BPR.
features.ap Compute AP features from a numpy array.
features.spikes Spike detection and feature extraction with multiple backend support.
features.get_psd_decay_features Extract power spectral density decay features from electrophysiological data.
features.xcor_acor_ratio Compute cross-correlation over auto-correlation ratio.
features.denoise_dataframe Applies total variation filter denoising to the features of a single probe insertion dataframe.
features.voltage_features_set Get list of feature column names by provenance.
features.EphysTransformer
features.EphysDenoiser
features.DartParameters Configuration parameters for Dartsort backend.
features.remap_waveform_shape_features Remap ModelSpikeFeatures’s 18 raw waveform columns onto the sparser ModelSpikeShapeFeatures set.
features.remap_waveform_shape_features_volume Same transform as remap_waveform_shape_features, for a download_encoding_volume array.
features.ModelRawFeatures Combined schema for all raw features.
features.ModelDenoisedFeatures Combined schema for denoised features, after the waveform-shape remap.
features.ModelSpikeFeatures Schema for spike waveform features.
features.ModelSpikeShapeFeatures Schema for the sparse, neuroscientist-facing spike-shape feature set.
features.ModelProbeDetails Schema for probe insertion metadata (df_probe_details.pqt). One row per probe insertion.

Aggregation

Combine per-snippet features into a per-channel table, then denoise it.

feature_calculators.compute_aggregated_features Compute features on several snippets, then aggregate and denoise them.
feature_calculators.get_snippet_start_times Spread snippet start times over a recording, away from its start and end.
feature_calculators.check_snippet_overlap Raise or warn when snippet windows overlap.
feature_calculators.aggregate_snippets Aggregate and denoise snippets already computed by compute_snippet.
aggregation.produce_output_dataframes Orchestrate the complete pipeline to produce aggregated and denoised electrophysiological data.
aggregation.get_aggregated_raw_features Process and aggregate raw features for multiple probe IDs (PIDs) across all their snippets.
aggregation.denoise_raw_features_data Apply denoising to aggregated raw electrophysiological features for each probe ID (PID).
aggregation.apply_waveform_remap Apply waveform shape feature remapping to replace ModelSpikeFeatures with ModelSpikeShapeFeatures.
aggregation.get_aggregated_features_per_pid Process and aggregate raw features for a single probe ID (PID) across all its snippets.
aggregation.aggregate_all_probes Aggregate snippet-level data from multiple probe directories into a single DataFrame.
aggregation.concatenate_channels_data Aggregate and validate channel-level metadata from multiple probe directories into a single DataFrame.
utils.get_aggregated_snippets_df Get a dataframe of metadata info for all snippets in the probe level directory.
utils.add_metadata_to_parquet_files Add metadata attributes to all Parquet files in a snippet-level directory.

Data access

Download and read the published IBL ephys-atlas aggregates.

data.download_tables Download electrophysiology data tables from AWS S3.
data.read_features_from_disk Read electrophysiology features from disk and merge with channel information.
data.download_cells_features Download cluster-level aggregates from S3 (cells_aggregates/{label}/ subfolder, ~1 GB).
data.read_cells_features Read cluster-level features and associated arrays from cells_aggregates/.
data.download_probe_details Download probe insertion metadata (df_probe_details.pqt) for a project from S3.
data.read_probe_details Read probe insertion metadata from disk.
data.download_project_data Download all project data (probe details + cell aggregates) from S3.
data.download_lfp_features Download the merged LFP-compressed HDF5 archive (lfpack v04) from AWS S3.
data.read_lfp_features Open a decompressed LFP reader for one insertion from the merged HDF5 archive.
data.download_encoding_volume Download a pre-computed ephys atlas encoding volume from AWS S3.
data.download_edges_volume Download the ephys edges volume of an encoding volume vintage from AWS S3.
data.alpha_outlier_columns First group of ALPHA_OUTLIER_CANDIDATE_GROUPS fully present in df, else an empty list.
data.list_available_projects Get the list of available projects.
data.list_available_labels List available labels on AWS S3.
data.get_latest_label Get the latest label on AWS S3.

Encoding-volume edges

Where the ephys signature changes fastest: the local gradient of an encoding volume.

edges.compute_edges_volume Encoding volume file -> edges volume file, next to it.
edges.load_whitened_pcs Whitened PCA of an encoding volume.
edges.edge_strength Gradient magnitude of whitened PCs, aggregated across PCs, per mm.
edges.save_edges_volume Save an edges volume in the encoding volume layout, as published on S3.

Alignment

Place a probe’s channels in the brain with the published models, with or without histology.

alignment.align_histology Align a probe’s recorded channels to a histology trace.
alignment.align_histology_with_units Channel-only and channel + unit alignments of one probe along its histology trace.
alignment.EphysOnlyLocalizer Localize probes without histology (see the module doc for the method).
alignment.localize_ephys_only One-call form of :meth:EphysOnlyLocalizer.localize (kwargs go to the localizer).
alignment.AlignmentResult Where one probe’s channels are, according to one method.
alignment.alignment_metrics Per-probe scores of estimated channel positions against the reference positions.
alignment.plot_alignment_result Draw an :class:~.result.AlignmentResult (see the module doc for the layout).
alignment.ChannelModel The published channel-level model, with array-level helpers used by every alignment method.
alignment.UnitModel The released unit-level model over the prepared unit dataset (offline runs only).

Insertion quality control

Flag the insertions whose recording is unusual for their brain regions, or more typical elsewhere.

fixtures.pid_qc_filter.excluded_pids Insertions bad (or, with include_review, also to review) on any of components.
fixtures.pid_qc_filter.qc_labels {component: label} of an insertion (all good when unlisted) and checks.
qc.levels.calibrate {test: {"median", "sd"}} of every test of :data:TESTS, on every probe with a value: no
qc.levels.zscores z of every test of :data:TESTS; larger is worse.
qc.levels.all_levels ({level name: label table}, z-scores); review = bad at the next more sensitive
qc.levels.level_table df with the z-scores (z_<test>), every level’s labels (<level>_<column>: the
qc.levels.detection The share each level marks bad of the insertions as recorded and of each kind of planted
qc.levels.Level Bad when a band test is beyond k robust SDs, a position test beyond k_position, or more
qc.regions.RegionReference What the probes record in each region.
qc.regions.bin_probe [B, F] median over the channels with a signal of each depth bin (NaN with fewer than half
qc.measures.band_scores {"<band>_level": score, "<band>_shape": score} of the residuals [B, F] of a probe;
qc.measures.scan How much better a probe follows its regions elsewhere.
qc.measures.swap_gains How much better each of two probes follows the track of the other than its own (positive when
qc.pipeline.QCSettings
qc.pipeline.fake_sources n insertions drawn at random (without replacement, with seed) from pids, all
qc.pipeline.stage_levels The z-scores and the labels at every level (:mod:.levels), from the outputs of
qc.cases.render_examples {pid: path} of the figures of the insertions pids in out_dir.
qc.fixture.write_fixture Write the labels of table (a :func:~.levels.level_table, e.g. qc_levels.pqt) at

Cells

Per-unit features: coupling, autocorrelograms, burstiness.

cells.spike_triggered_population_coupling Population coupling of each cluster to its local, spatially-restricted
cells.spike_triggered_population_coupling_df df_clusters / spikes-Bunch convenience wrapper around
cells.spike_triggered_lfp
cells.compute_log_acg Compute a long autocorrelogram with log-spaced bins.
cells.compute_3d_acgs Firing-rate-decile x log-time-lag 3D autocorrelogram, one per cluster.
cells.compute_burstiness_and_memory Computes the burstiness (B) and memory (M) metrics from a neuronal spike train.
cells.select_good_units_relaxed_rp Good-unit mask with a relaxed sliding-refractory-period inclusion criterion.
cells.ModelClusters Schema for cluster-level features (good_clusters.pqt / all_clusters.pqt). pid is a plain column.

Anatomy

The brain atlas and region mappings used by the classifier.

anatomy.ClassifierAtlas The Encoding Atlas is a version of the Allen Atlas where the regions labels volume is reworked.
anatomy.ClassifierRegions
anatomy.regions_transition_matrix Computes transition matrices between brain regions based on vertical adjacency.

Plotting

Figures for features, probes and model results.

plots.figure_features_channel_space Create a figure displaying electrophysiological features and brain regions along a probe.
plots.figure_features_heatmap Z-scored features of one probe against depth, beside its histology.
plots.figure_predictions_along_probe Region predictions along one probe: histology, predicted region and probabilities.
plots.figure_voltage_snippets Voltage images (channels × time) of one or several snippets, side by side.
plots.figure_encoder_coronal Features predicted by the spatial encoder on a coronal plane, one panel per feature.
plots.plot_region_bar Draw brain regions as a coloured bar along the probe depth.
plots.plot_features_heatmap Draw the features of one probe as an image: channels sorted by depth, one column each.
plots.plot_features_distributions Create a grid of histograms displaying the distribution of electrophysiological features.
plots.plot_results Visualize model prediction results and feature distributions.
plots.plot_cumulative_probas Plot cumulative probabilities of brain regions along probe depths.
plots.plot_histogram Create histograms with quantile-based color coding.
plots.plot_probe_rect Plot probe channels as rectangles with specified colors.
plots.plot_probe_rect2 Plot probe channels using imshow for better visualization.
plots.get_color_feat Generate colors for feature values using colormaps.
plots.get_color_br Generate colors for brain regions.
plots.select_series Select data series based on features and brain region criteria.
reveal.AtlasReveal