skdh.preprocessing.GetDayWindowIndices#
- class skdh.preprocessing.GetDayWindowIndices(bases=None, periods=None)#
Get the indices corresponding to days.
- Parameters:
- bases{None, int, list-like}, optional
Base hours [0, 23] in which to start a window of time. Default is None, which will not do any windowing. Both base and period must be defined in order to window. Can use multiple, but the number of bases must match the number of periods.
- periods{None, int, list-like}, optional
Periods for each window, in [1, 24]. Defines the number of hours per window. Default is None, which will do no windowing. Both period and base must be defined to window. Can use multiple but the number of periods must match the number of bases.
Methods
convert_timestamps(t)Convert a timestamp/array of timestamps to a datetime object
predict(*, time[, fs])Compute the indices for days.
save_results(results, file_name)Save the results of the processing pipeline to a csv file
window_days(time, fs)Get the indices for days based on the windowing parameters.
- predict(*, time, fs=None)#
Compute the indices for days.
- Parameters:
- timenumpy.ndarray
(N, ) array of unix timestamps, in seconds.
- fsfloat, optional
Sampling frequency in Hz. If not provided, it is calculated from the timestamps.
- tz_name{None, str}, optional
Timezone name. If none provided, timestamps are assumed to be naive in local time.
- Returns:
- datadict
Dictionary with the key day_ends, which itself is a dictionary of (N, 2) indices corresponding to [start, stop] of days. Keys are tuples of (base, period).
- window_days(time, fs)#
Get the indices for days based on the windowing parameters.
- Parameters:
- timenumpy.ndarray
(N, ) array of unix timestamps, in seconds.
- fsfloat, optional
Sampling frequency in Hz. If not provided, it is calculated from the timestamps.
- Returns:
- daysdict
Dictionary of day starts and ends