SMAC-Group / gmwm

Generalized Method of Wavelet Moments (GMWM) is an estimation technique for the parameters of time series models. It uses the wavelet variance in a moment matching approach that makes it particularly suitable for the estimation of certain state-space models.
Other
28 stars 14 forks source link

time column in imu.data #182

Open philippcla opened 8 years ago

philippcla commented 8 years ago

Hello, by using the "imu.data = read.imu(file = imu.file_path , type = imu.type);" the data is assembled in 6 collums being Gyro.X, Gyro.Y, Gyro.Z, Accel.X, Accel.Y and Accel.Z. That is ok. BUT there is no column with the time data. it should look like the following Time [s]\ - GX - GY - GZ - AX - AY - AZ

so it would be 7 columns

coatless commented 8 years ago

Work around for the moment is to use read_imu() note the _ which gives direct access to the cpp function. The cpp function returns time in the first column and the others as is from the second on to the seventh. (See ?read_imu for more details.)

coatless commented 8 years ago

Okay, would something along the lines of embedding the time information in the rowname of the matrix be acceptable?

e.g.

a = matrix(c(1,0,0,1), nrow = 4)

# No names
a
     [,1]
[1,]    1
[2,]    0
[3,]    0
[4,]    1
# Fake times
rownames(a) = c(.3,.5,.6,.7)

# Named
a
    [,1]
0.3    1
0.5    0
0.6    0
0.7    1
## I'll write a better handler (e.g. imu_time() ) to get this info. 
# Extract times for manipulation
times = as.numeric(rownames(a))

times*2
0.6 1.0 1.2 1.4
coatless commented 8 years ago

@philippcla Thoughts on the above? Would the proposed change be okay on your end?

philippcla commented 8 years ago

Yes

Once I have the indexes of the desired timespan (e.g. indexes 456 through 9857643, because I want to treat only data between two specific timestamps) can I apply it on the IMU dataset?

original_imu_data = read.imu(file = imu.file_path , type = imu.type)
cutted_imu_data = original_imu_data[indexes,]

I keep the original, and will create a truncated dataset thanks to the indexes-vector... Is this possible?

coatless commented 8 years ago

@philippcla Yes. You can subset under the current imu structure exactly like a matrix.

original_imu_data = read.imu(file = imu.file_path , type = imu.type)
cutted_imu_data = original_imu_data[456:9857643,]
coatless commented 8 years ago

Per ddd7327, we have:

original_imu_data = read.imu(file = imu.file_path , type = imu.type)
imu_time(original_imu_data)

(Might need to tweak print output to avoid renaming rownames in the presence of pre-assigned names.)