SimpleBreathingMotionModule#

class SimpleBreathingMotionModule(sub_trajectory, breathing_curve, breathing_cycle_duration)[source]#

Trajectory module wrapping another trajectory module with a global pure translational breathing motion. Arbitrary 3D breathing curves can be specified on a regular time grid. This curve is linearly interpolated on calling the module.

The wrapped trajectory module is assumed to gracefully handle potential out-of bound time-points (e.g. by assuming periodicity)

Parameters:
  • sub_trajectory (BaseTrajectoryModule) – Instance of a BaseTrajectoryModule-subclass

  • breathing_curve (Tensor) – (t, 3) Tensor containing the 3D points of the breathing trajectory assumed to be on a uniform temporal grid

  • breathing_cycle_duration (Tensor) – Duration of the given breathing trajectory in milliseconds

Methods:

__call__(initial_positions, timing, **kwargs)

Evaluates the positions for particles at given initial positions for all times specified in the timing argument.

current_offset()

Returns the positional breathing offset for the current time

from_sinosoidal_motion(sub_trajectory, ...)

Instantiates a SimpleBreathingMotionModule from a sinusodial breathing curve

increment_particles(particle_positions, dt, ...)

Evaluates the new position of particles at given locations r for a temporal step width dt.

Attributes:

breathing_curve

(t, 3) Tensor containing the 3D points of the breathing trajectory assumed to be on a uniform temporal grid

breathing_cycle_duration

Duration of the given breathing trajectory in milliseconds

current_time_ms

Keeps track of the current timing when increment_particles is called.

sub_trajectory

Reference to the wrapped trajectory module

__call__(initial_positions, timing, **kwargs)[source]#

Evaluates the positions for particles at given initial positions for all times specified in the timing argument. For implementations using the increment_particles function in a loop the maximal time-delta must be specified.

Parameters:
  • initial_positions (Tensor) – (N, 3)

  • timing (Tensor) – (T, )

  • kwargs – Can vary in concrete implementation

Return type:

(Tensor, Dict)

Returns:

  • r_new [tf.Tensor, (T, N, 3)]

  • additional_fields [dict] containing the lookup values for each step

current_offset()[source]#

Returns the positional breathing offset for the current time

classmethod from_sinosoidal_motion(sub_trajectory, breathing_period, breathing_direction, breathing_amplitude)[source]#

Instantiates a SimpleBreathingMotionModule from a sinusodial breathing curve

Parameters:
  • sub_trajectory (BaseTrajectoryModule) –

  • breathing_period (Quantity) –

  • breathing_direction (ndarray) –

  • breathing_amplitude (Quantity) –

increment_particles(particle_positions, dt, **kwargs)[source]#

Evaluates the new position of particles at given locations r for a temporal step width dt. If the concrete implementation involves a look up (e.g. velocity fields) the values at the old location is also returned as dictionary.

Note

concrete implementations must be compatible with tf.function decoration

Parameters:
  • particle_positions (Tensor) – (N, 3) Current particle positions.

  • dt (Tensor) – (,) Temporal step width in milliseconds to evaluate the next positions

  • kwargs – Can vary in concrete implementation

Return type:

(Tensor, Dict)

Returns:

r_new [tf.Tensor, (N, 3)], additional_fields [dict] containing the lookup values

breathing_curve: Tensor#

(t, 3) Tensor containing the 3D points of the breathing trajectory assumed to be on a uniform temporal grid

breathing_cycle_duration: Tensor#

Duration of the given breathing trajectory in milliseconds

current_time_ms: Variable#

Keeps track of the current timing when increment_particles is called.

sub_trajectory: BaseTrajectoryModule#

Reference to the wrapped trajectory module