This function is used to reduce the time span of data by cropping out any data that falls before and after two time cues.

interp2length(X, Z, fs_in = NULL, fs_out = NULL, n_out = NULL)

Arguments

X

A sensor list, vector, or matrix. If x is or contains matrix, each column is treated as an independent signal.

Z

is a sensor structure, vector or matrix whose sampling rate and length is to be matched.

fs_in

is the sampling rate in Hz of the data in X. This is only needed if X is not a sensor structure.

fs_out

is the required new sampling rate in Hz. This is only needed if Z is not given.

n_out

is an optional length for the output data. If n_out is not given, the output data length will be the input data length * fs_out/fs_in.

Value

Y is a sensor structure, vector or matrix of interpolated data with the same number of columns as X.

Examples

         plott(X = list(harbor_seal$P), fsx = 5) 
         # get an idea of what the data looks like
         P_dec <- decdc(harbor_seal$P, 5)
         
         # note: you would not really want to decimate and then linearly interpolate. 
         # only doing so here to create an example from existing datasets 
         # that have uniform sampling rates across sensors
         
         P_interp <- interp2length(X = P_dec, Z = harbor_seal$A)
         plott(X = list(P_interp$data), fsx = 1) 
         # compare to original plot. should be pretty close