brainscore_core.supported_data_standards.brainio.assemblies

ASSEMBLIES MODULE - Core data structures for Brain-Score

PURPOSE:

This module provides the fundamental data structures used throughout Brain-Score for representing experimental and computational data. These are xarray-based containers that maintain metadata alongside numeric data.

KEY CLASSES:

  • DataAssembly: Base class for all data containers

  • NeuroidAssembly: Neural recordings (neurons x stimuli x time)

  • BehavioralAssembly: Behavioral responses (subjects x stimuli)

  • PropertyAssembly: Model properties and features

  • StimulusSet: Collections of experimental stimuli

CORE UTILITIES:

  • walk_coords(): Navigate through coordinate metadata

  • merge_data_arrays(): Combine multiple data arrays

  • gather_indexes(): Manage multi-level indexing

  • Assembly loaders: Load data from NetCDF files with stimulus metadata

This replaces the full BrainIO assemblies module but keeps all functionality actually used by Brain-Score models, benchmarks, and data processing.

Functions

array_is_element(arr, element)

coords_for_dim(assembly, dim)

gather_indexes(assembly)

This is only necessary as long as xarray cannot persist MultiIndex to netCDF.

get_levels(assembly)

get_metadata(assembly[, dims, names_only, ...])

get_metadata_after_2022_06(assembly[, dims, ...])

Return coords and/or indexes or index levels from an assembly, yielding either name or (name, dims, values).

get_metadata_before_2022_06(assembly[, ...])

Return coords and/or indexes or index levels from an assembly, yielding either name or (name, dims, values).

is_fastpath(*args, **kwargs)

checks whether a set of args and kwargs would be interpreted by DataArray.__init__

merge_data_arrays(data_arrays)

walk_coords(assembly)

walks through coords and all levels, just like the __repr__ function, yielding (name, dims, values).

Classes

AssemblyLoader(cls, file_path[, group])

Loads a DataAssembly from a file.

BehavioralAssembly(*args, **kwargs)

A BehavioralAssembly is a DataAssembly containing behavioral data.

DataAssembly(*args, **kwargs)

A DataAssembly represents a set of data a researcher wishes to work with for an analysis or benchmarking task.

DataPoint(value, neuroid, presentation)

A DataPoint represents one value, usually a recording from one neuron or node, in response to one presentation of a stimulus.

GroupAppendAssemblyLoader(cls, file_path[, ...])

Loads an assembly plus any included metadata assemblies and a pointer to a stimulus set.

GroupbyBridge(groupby, assembly, dim, ...)

Wraps an xarray GroupBy object to allow grouping on multiple coordinates.

MetadataAssembly(*args, **kwargs)

A MetadataAssembly is a DataAssembly containing metadata, pertaining to another DataAssembly, that is best described by a DataAssembly but has different dimensions from the DataAssembly it describes.

ModelFeaturesAssembly(*args, **kwargs)

A ModelFeaturesAssembly is a NeuroidAssembly containing data captured from nodes in a machine learning model.

NeuroidAssembly(*args, **kwargs)

A NeuroidAssembly is a DataAssembly containing data recorded from either neurons or neuron analogues.

NeuronRecordingAssembly(*args, **kwargs)

A NeuronRecordingAssembly is a NeuroidAssembly containing data recorded from neurons.

PropertyAssembly(*args, **kwargs)

A PropertyAssembly is a DataAssembly containing single neuronal properties data.

SpikeTimesAssembly(*args, **kwargs)

A SpikeTimesAssembly is a DataAssembly containing a one-dimensional array of neural spike event timestamps.

StimulusMergeAssemblyLoader(cls, file_path)

Loads an assembly and merges in metadata from a stimulus set.

StimulusReferenceAssemblyLoader(cls, file_path)

Loads an assembly and adds a pointer to a stimulus set.

Exceptions

GroupbyError