dyad

class AnnotatedDyad(trajectory, trajectory_other, *, observations, categories, background_category)

Bases: Dyad, AnnotatedSampleableMixin

Annotated dyad.

Parameters:
  • trajectory (Trajectory) – The trajectory of the actor.

  • trajectory_other (Trajectory) – The other trajectory of the recipient.

  • observations (DataFrame) – Observations for the dyad.

  • categories (tuple[str, ...]) – Categories of the observations.

  • background_category (str) – Background category of the observations.

class Dyad(trajectory, trajectory_other)

Bases: BaseSampleable

A dyad is a sampleable pair of trajectories (Trajectory).

Parameters:
  • trajectory (Trajectory) – The first trajectory in the dyad (i.e., the actor of social behaviors).

  • trajectory_other (Trajectory) – The second trajectory in the dyad (i.e., the recipient).

annotate(observations, *, categories, background_category)

Annotates the dyad with the given observations.

Parameters:
  • observations (DataFrame) – The observations.

  • categories (tuple[str, ...]) – Categories of the observations.

  • background_category (str) – The background category of the observations.

Return type:

AnnotatedDyad

Returns:

The annotated dyad.

classmethod prepare_paired_trajectories(trajectory, trajectory_other)

Helper function to prepare paired trajectories for a dyad.

The trajectories are temporally aligned with slicing (see slice_window()) and returned as a view. Note that the trajectories should already be complete and sorted.

Parameters:
  • trajectory (Trajectory) – The trajectory of the actor (first individual of the dyad)

  • trajectory_other (Trajectory) – The trajectory of the recipient (second individual of the dyad)

Return type:

tuple[Trajectory, Trajectory]

Returns:

The aligned trajectories.

See also

Trajectory for more details on handling trajectory data.