sit2standpy.process_timestamps¶
-
sit2standpy.
process_timestamps
(times, accel, time_units=None, conv_kw=None, window=False, hours=('08:00', '20:00'))¶ Convert timestamps into pandas datetime64 objects, and window as appropriate.
Parameters: - times : array_like
N-length array of timestamps to convert.
- accel : {numpy.ndarray, pd.Series}
(N, 3) array of acceleration values. They will be windowed the same way as the timestamps if window is set to True.
- time_units : {None, str}, optional
Time units. Useful if conversion is from unix timestamps in seconds (s), milliseconds (ms), microseconds (us), or nanoseconds (ns). If not None, will override the value in conv_kw, though one or the other must be provided. Default is None.
- conv_kw : {None, dict}, optional
Additional key-word arguments for the pandas.to_datetime function. If time_units is not None, that value will be used and overwrite the value in conv_kw. If the timestamps are in unix time, it is unlikely this argument will be necessary. Default is None.
- window : bool, optional
Window the timestamps into the selected hours per day.
- hours : array_like, optional
Length two array_like of hours (24-hour format) as strings, defining the start (inclusive) and end (exclusive) times to include in the processing. Default is (‘08:00’, ‘20:00’).
Returns: - timestamps : {pandas.DatetimeIndex, pandas.Series, dict}
Array_like of timestamps. DatetimeIndex if times was a numpy.ndarray, or list. pandas.Series with a dtype of ‘datetime64’ if times was a pandas.Series. If window is set to True, then a dictionary of timestamps for each day is returned.
- dt : float
Sampling time in seconds.
- accel : {numpy.ndarray, pd.Series, dict}, optional
Acceleration windowed the same way as the timestamps (dictionary of acceleration for each day), if window is True. If window is False, then the acceleration is not returned.