timeseries.SpaceCurve.accel

SpaceCurve.accel(rate)[source]

Change time parametrization, to represent a constant tangential acceleration (or deceleration). Locations, initial time, and arc-length are preserved.

The first timestep is changed to have (1-rate) times the speed of the original’s first timestep. The last timestep is changed to have (1+rate) times the speed of the original’s last timestep. That is, if S is a SpaceCurve of constant speed, then S.accel(-0.1) will start 10% faster and end 10% slower than S.

If speed[i] changes to speed[i]*q[i], then delta_t[i] changes to delta_t[i]*p[i], where p[i] = 1 / q[i]

Examples

>>> tn = np.arange(0, 5*1e9, 1e9)
>>> s = SpaceCurve(tn=tn, px=10.0*tn/1e9) # drive straight at 10m/s
>>> s
SpaceCurve with 5 entries and duration 4.000000000
>>> s.data
            time  pos_x  pos_y  pos_z  quality
0            0.0    0.0    0.0    0.0       -1
1000000000   1.0   10.0    0.0    0.0       -1
2000000000   2.0   20.0    0.0    0.0       -1
3000000000   3.0   30.0    0.0    0.0       -1
4000000000   4.0   40.0    0.0    0.0       -1
>>> s.compute()
>>> s.info['speed']
0             10.0
1000000000    10.0
2000000000    10.0
3000000000    10.0
4000000000    10.0
Name: speed, dtype: float64
>>> a = s.accel(0.25)
>>> a
SpaceCurve with 5 entries and duration 4.147319347
>>> a.compute()
>>> a.info['speed']
0              7.500000
1333333333     8.250000
2424242424     9.930556
3347319347    11.607143
4147319347    12.500000
Name: speed, dtype: float64
>>> a.data
                time  pos_x  pos_y  pos_z  quality
0           0.000000    0.0    0.0    0.0       -1
1333333333  1.333333   10.0    0.0    0.0       -1
2424242424  2.424242   20.0    0.0    0.0       -1
3347319347  3.347319   30.0    0.0    0.0       -1
4147319347  4.147319   40.0    0.0    0.0       -1
>>> b = s.accel(-0.25) 
>>> b
SpaceCurve with 5 entries and duration 4.147319347
>>> b.compute()
>>> b.info['speed']
0             12.500000
800000000     11.607143
1723076923     9.930556
2813986013     8.250000
4147319347     7.500000
Name: speed, dtype: float64
>>> b.data
                time  pos_x  pos_y  pos_z  quality
0           0.000000    0.0    0.0    0.0       -1
800000000   0.800000   10.0    0.0    0.0       -1
1723076923  1.723077   20.0    0.0    0.0       -1
2813986013  2.813986   30.0    0.0    0.0       -1
4147319347  4.147319   40.0    0.0    0.0       -1