sampling_rate
estimates the sampling rate based on the average time
intervals between adjacent samples for the input multi-channel signal.
sampling_rate(df)
dataframe. Input dataframe of the multi-channel signal. The first column is the timestamps in POSXlct format and the following columns are accelerometer values.
number. The estimated sampling rate in Hz.
This function accepts a dataframe of multi-channel signal, computes the duration of the sequence, and gets the sampling rate by dividing the number of samples by it.
This function is a utility function that was used in various part in the algorithm whenever we need to know the sampling rate.
Other utility functions:
clip_data()
,
cut_off_signal()
,
interpolate_signal()
,
parse_epoch_string()
,
segment_data()
,
simulate_new_data()
# Get the test data
df = sample_raw_accel_data
# Default sampling rate is 80Hz
sampling_rate(df)
#> [1] 80
# Downsample to 30Hz
output = bandlimited_interp(df, 80, 30)
sampling_rate(output)
#> [1] 30
# Upsampling to 100Hz
output = bandlimited_interp(df, 80, 100)
sampling_rate(output)
#> [1] 100