resistics.time.interp module

resistics.time.interp.fillGap(timeData1, timeData2)[source]

Fill gap between time series

Fill gaps between two different recordings. The intent is to fill the gap when recording has been interrupted and there are two data files. Both times series must have the same sampling frequency.

Parameters
timeDat1TimeData

Time series data

timeData2TimeData

Time series data

Returns
TimeData

Time series data with gap filled

resistics.time.interp.interpolateToSecond(timeData: resistics.time.data.TimeData, inplace: bool = True) → resistics.time.data.TimeData[source]

Interpolate data to be on the second

Some formats of time data (e.g. SPAM) do not start on the second with their sampling. This method interpolates so that sampling starts on the second and improves interoperability with other recording formats.

Parameters
timeDataTimeData

Time data to interpolate onto the second

inplacebool, optional

Whether to do the interpolation inplace or not. Default is True.

Returns
TimeData

Time data interpolated to start on the second

resistics.time.interp.interpolateToSecondData(data: Dict[str, numpy.ndarray], sampleFreq: float, startTime: datetime.datetime) → Dict[str, numpy.ndarray][source]

Interpolate data to be on the second

Interpolates the sampling so that it coincides with full seconds. The function also shifts the start point to the next full second WARNING: Do not use this method on data recording with a sampling frequency of less than 1Hz

Parameters
dataDict

Dictionary with channel as keys and data as values

sampleFreqfloat

Sampling frequency of the data

startTimedatetime

Time of first sample

Returns
dataDict

Dictionary with channel as keys and data as values

Notes

This function will truncate the data to the next second.

todo: This function needs to be more robust for low (< 1Hz) sample frequencies as the use of microseconds and seconds makes no sense for this