# Trajectory¶

class acoular.trajectory.Trajectory

Bases: traits.has_traits.HasPrivateTraits

Describes a trajectory from sampled points.

Based on a discrete number of points in space and time, a continuous trajectory is calculated using spline interpolation of positions between samples.

points = Dict(key_trait = Float, value_trait = Tuple(Float, Float, Float), …

Dictionary that assigns discrete time instants (keys) to sampled (x, y, z) positions along the trajectory (values).

interval = Property()

Tuple of the start and end time, is set automatically (depending on points).

tck = Property()

Spline data, internal use.

location(t, der=0)

Returns the positions for one or more instants in time.

Parameters
tarray of floats

Instances in time to calculate the positions at.

derinteger

The order of derivative of the spline to compute, defaults to 0.

Returns
(x, y, z)tuple with arrays of floats

Positions at the given times; x, y and z have the same shape as t.

traj(t_start, t_end=None, delta_t=None, der=0)

Python generator that yields locations along the trajectory.

Parameters
t_startfloat

Starting time of the trajectory, defaults to the earliest time in points.

t_endfloat

Ending time of the trajectory, defaults to the latest time in points.

delta_tfloat

Time interval between yielded trajectory points, defaults to earliest time in points.

Returns
(x, y, z)tuples of floats

Positions at the desired times are yielded.

Examples

x.traj(0.1)

Yields the position every 0.1 s within the given interval.

x.traj(2.5, 4.5, 0.1)

Yields the position every 0.1 s between 2.5 s and 4.5 s.

x.traj(0.1, der=1)

Yields the 1st derivative of the spline (= velocity vector) every 0.1 s within the given interval.