sampling_rate: Estimate sampling rate for multi-channel signal

View source: R/helper.R

sampling_rateR Documentation

Estimate sampling rate for multi-channel signal

Description

sampling_rate estimates the sampling rate based on the average time intervals between adjacent samples for the input multi-channel signal.

Usage

sampling_rate(df)

Arguments

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.

Details

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.

Value

number. The estimated sampling rate in Hz.

How is it used in MIMS-unit algorithm?

This function is a utility function that was used in various part in the algorithm whenever we need to know the sampling rate.

See Also

Other utility functions: clip_data(), cut_off_signal(), interpolate_signal(), parse_epoch_string(), segment_data(), simulate_new_data()

Examples

# Get the test data
df = sample_raw_accel_data

# Default sampling rate is 80Hz
sampling_rate(df)

# Downsample to 30Hz
output = bandlimited_interp(df, 80, 30)
sampling_rate(output)

# Upsampling to 100Hz
output = bandlimited_interp(df, 80, 100)
sampling_rate(output)

MIMSunit documentation built on June 21, 2022, 5:06 p.m.