m3resp.interpolate_to_time#

m3resp.interpolate_to_time(signal, time)[source]#

Return a copy of signal with its values at the time points time.

signal.time and time must be on the same clock: synchronize the recordings first. This function cannot check that.

Each new value is linearly interpolated between the two original samples around it. Values with more than one number per time point (channels, EIT pixel frames) are interpolated per number along the time axis.

Time points before the signal’s first sample or after its last sample get NaN, with a warning that says how many there are.

Parameters:
  • signal (SignalT) – Signal or TimeSeries with at least two samples and a strictly increasing time axis in seconds.

  • time (ArrayLike) – New time points in seconds, on the same clock as signal.time, strictly increasing. Pass another signal’s time to put both on the same time points.

Returns:

A copy of signal with the new time, the interpolated values (as floats), sample_frequency set to 1 / the median time step of time, rounded to 9 significant digits (in Hz; None for a single time point) and metadata["interpolation"] = "linear". All other fields are copied.

Raises:

ValueError – If time is not one-dimensional, is empty, holds NaN or infinite values, or is not strictly increasing; if signal has fewer than two samples; or if signal.time holds NaN or infinite values or is not strictly increasing.

Return type:

SignalT