experanto.interpolators.Interpolator

class Interpolator(root_folder)[source]

Bases: object

Abstract base class for time series interpolation.

Interpolators load data from a modality folder and map time points to data values. Each modality (e.g., screen, responses, eye_tracker, treadmill) is assigned to a separate interpolator object belonging to one of the Interpolator subclasses (e.g., SequenceInterpolator, ScreenInterpolator, etc.), but multiple modalities can belong to the same class, such as treadmill and eye_tracker both being assigned to the SequenceInterpolator subclass.

Parameters:

root_folder (str) – Path to the modality directory containing data and metadata files.

root_folder

Path to the modality directory.

Type:

pathlib.Path

start_time

Earliest timestamp in the data.

Type:

float

end_time

Latest timestamp in the data.

Type:

float

valid_interval

Time range for which interpolation is valid.

Type:

TimeInterval

See also

SequenceInterpolator

For time series data (responses, behaviors).

ScreenInterpolator

For visual stimuli (images, videos).

TimeIntervalInterpolator

For labeled time intervals (e.g., train/test splits).

Experiment

High-level interface that manages multiple interpolators.

Methods

__init__(root_folder)

close()

create(root_folder[, cache_data])

Factory method to create the appropriate interpolator for a modality.

interpolate(times[, return_valid])

Map an array of time points to interpolated data values.

load_meta()

valid_times(times)

__init__(root_folder)[source]
load_meta()[source]
abstractmethod interpolate(times, return_valid=False)[source]

Map an array of time points to interpolated data values.

static create(root_folder, cache_data=False, **kwargs)[source]

Factory method to create the appropriate interpolator for a modality.

Reads the meta.yml file in the folder to determine the modality type and instantiates the corresponding interpolator subclass.

Parameters:
  • root_folder (str) – Path to the modality directory.

  • cache_data (bool, default=False) – If True, loads all data into memory for faster access.

  • **kwargs – Additional arguments passed to the interpolator constructor.

Returns:

An instance of the appropriate interpolator subclass.

Return type:

Interpolator

Raises:

ValueError – If the modality type is not supported.

valid_times(times)[source]
close()[source]