Skip to content

Samples at the very start/end of a CWA file may not receive unique timestamps #2

@danielgjackson

Description

@danielgjackson

Issue:

  • Only one timestamp per sector (40/80/120 samples)
  • The interpolation to generate the other timestamps does not extrapolate beyond the very first/last timestamps
  • The very first/last few samples can receive the same timestamp from the interpolation.

To recreate with the PyPI version of the package:

python -m pip install openmovement
python

Then, in Python:

from openmovement.load import CwaData
end = 10
filename = 'AX6-Sample.cwa'
with CwaData(filename, include_gyro=True, include_temperature=False) as cwa_data:
    # As an ndarray of [time,accel_x,accel_y,accel_z,temperature]
    sample_values = cwa_data.get_sample_values()
    print('\nAs ndarray:')
    print(sample_values[:end])
    
    # As a pandas DataFrame
    df = cwa_data.get_samples()
    print('\nAs a pandas DataFrame')
    print(df[:end])

Output:

As ndarray:
[[ 1.53029520e+09 -2.14843750e-02  1.00317383e+00 -5.17578125e-02
   2.78320312e+01  1.22070312e+01  9.27734375e+00]
 [ 1.53029520e+09 -3.85742188e-02  9.86328125e-01 -7.32421875e-02
   2.00195312e+01  2.25830078e+00  3.05175781e+00]
 [ 1.53029520e+09 -1.66015625e-02  1.01367188e+00 -2.83203125e-02
   1.41601562e+01  7.93457031e-01 -6.71386719e-01]
 [ 1.53029520e+09  4.88281250e-04  1.04956055e+00  3.14941406e-02
   1.24511719e+01 -1.95312500e+00 -2.86865234e+00]
 [ 1.53029520e+09 -3.71093750e-02  1.08081055e+00  9.15527344e-02
   1.31835938e+01 -1.13525391e+01 -6.59179688e+00]
 [ 1.53029520e+09 -5.32226562e-02  1.07006836e+00  1.91406250e-01
   1.33666992e+01 -2.54516602e+01 -7.99560547e+00]
 [ 1.53029520e+09 -1.97753906e-02  1.06103516e+00  2.80517578e-01
   1.07421875e+01 -3.72924805e+01 -5.37109375e+00]
 [ 1.53029520e+09 -1.78222656e-02  1.05419922e+00  2.81250000e-01
   1.07421875e+01 -4.90112305e+01 -5.85937500e+00]
 [ 1.53029520e+09 -9.76562500e-02  1.02343750e+00  2.13623047e-01
   1.42211914e+01 -6.41479492e+01 -1.09252930e+01]
 [ 1.53029520e+09 -1.34033203e-01  9.83154297e-01  1.72363281e-01
   1.39160156e+01 -7.33642578e+01 -1.38549805e+01]]

As a pandas DataFrame
                           time   accel_x   accel_y   accel_z     gyro_x     gyro_y     gyro_z
0 2018-06-29 18:00:00.703765760 -0.021484  1.003174 -0.051758  27.832031  12.207031   9.277344
1 2018-06-29 18:00:00.703765760 -0.038574  0.986328 -0.073242  20.019531   2.258301   3.051758
2 2018-06-29 18:00:00.703765760 -0.016602  1.013672 -0.028320  14.160156   0.793457  -0.671387
3 2018-06-29 18:00:00.703765760  0.000488  1.049561  0.031494  12.451172  -1.953125  -2.868652
4 2018-06-29 18:00:00.703765760 -0.037109  1.080811  0.091553  13.183594 -11.352539  -6.591797
5 2018-06-29 18:00:00.703765760 -0.053223  1.070068  0.191406  13.366699 -25.451660  -7.995605
6 2018-06-29 18:00:00.703765760 -0.019775  1.061035  0.280518  10.742188 -37.292480  -5.371094
7 2018-06-29 18:00:00.709426944 -0.017822  1.054199  0.281250  10.742188 -49.011230  -5.859375
8 2018-06-29 18:00:00.715087872 -0.097656  1.023438  0.213623  14.221191 -64.147949 -10.925293
9 2018-06-29 18:00:00.720748800 -0.134033  0.983154  0.172363  13.916016 -73.364258 -13.854980

Note the first 8 samples are at the same timestamp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions