skdh.preprocessing.FillGaps#

class skdh.preprocessing.FillGaps(fill_values=None)#

Fill gaps in data so that the data is continuous, which is what is expected by the rest of SKDH.

Parameters:
fill_values{None, dict}, optional

Dictionary with keys and values to fill data streams with. This will determine which data-streams to look for to fill, outside of the main four listed in the Notes section. Additionally, see Notes for default values if not provided.

Methods

convert_timestamps(t)

Convert a timestamp/array of timestamps to a datetime object

predict(*, time[, accel, fs, gyro, ...])

Fill gaps in data streams.

save_results(results, file_name)

Save the results of the processing pipeline to a csv file

Notes

Default fill values are:

  • accel: numpy.array([0.0, 0.0, 1.0])

  • gyro: 0.0

  • temperature: 0.0

  • ecg: 0.0

The default fill values are not NaN in order to not cause issues with filters or other signal processing methods where NaN values may be propagated beyond a data gap and effect results where data is actually available.

predict(*, time, accel=None, fs=None, gyro=None, temperature=None, ecg=None, **kwargs)#

Fill gaps in data streams.

Parameters:
timenumpy.ndarray

(N,) array of timestamps (unix seconds).

accelnumpy.ndarray, optional

(N, 3) array of acceleration data.

fsfloat, optional

Sampling frequency in Hz for the acceleration data.

gyronumpy.ndarray, dict, optional

(N, 3) array of gyroscope data, or a dictionary containing the keys ‘time’, and ‘values’ if not using the same timestamps (time) as accel.

temperaturenumpy.ndarray, dict, optional

(N,) array of temperature data, or a dictionary containing the keys ‘time’, and ‘values’ if not using the same timestamps (time) as accel.

ecgnumpy.ndarray, dict, optional

(N,) array of ECG data, or a dictionary containing the keys ‘time’, and ‘values’ if not using the same timestamps (time) as accel.

**kwargsnumpy.ndarray, dict, optional

Any additional data streams that need to be filled. These will only be filled if they are given fill values with fill_values.