c4dynamics.states.state.state.timestate

Contents

c4dynamics.states.state.state.timestate#

state.timestate(t)[source]#

Returns the state as stored at time t.

The method searches the closest time to time t in the sampled histories and returns the state that stored at the time.

If data were not stored returns None.

Parameters:

t (float or int) – The time at the required sample.

Returns:

X (numpy.array) – An array of the state vector state.X at time t.

Examples

>>> s = c4d.state(x = 0, y = 0, z = 0)
>>> for t in np.linspace(0, 1, 3):
...   s.X += 1
...   s.store(t)
>>> s.timestate(0.5) 
[2  2  2]
>>> s = c4d.state(x = 1, y = 0, z = 0)
>>> s.timestate(0.5)  
Warning: no history of state samples.
None