Skip to content

Affect

emotional_memory.affect.CoreAffect

Bases: BaseModel

A point in the valence-arousal-dominance (PAD) space.

valence : [-1.0, +1.0] negative → positive arousal : [ 0.0, 1.0] calm → highly activated dominance : [ 0.0, 1.0] submissive → dominant/in-control

References: Mehrabian & Russell (1974) for the PAD space including the dominance dimension; Russell (1980) for the valence-arousal circumplex.

distance(other: CoreAffect) -> float

Euclidean distance in valence-arousal-dominance space.

Source code in src/emotional_memory/affect.py
def distance(self, other: CoreAffect) -> float:
    """Euclidean distance in valence-arousal-dominance space."""
    return math.sqrt(
        (self.valence - other.valence) ** 2
        + (self.arousal - other.arousal) ** 2
        + (self.dominance - other.dominance) ** 2
    )

lerp(other: CoreAffect, alpha: float) -> CoreAffect

Linear interpolation. alpha=0 → self, alpha=1 → other.

Source code in src/emotional_memory/affect.py
def lerp(self, other: CoreAffect, alpha: float) -> CoreAffect:
    """Linear interpolation. alpha=0 → self, alpha=1 → other."""
    alpha = max(0.0, min(1.0, alpha))
    return CoreAffect(
        valence=self.valence + alpha * (other.valence - self.valence),
        arousal=self.arousal + alpha * (other.arousal - self.arousal),
        dominance=self.dominance + alpha * (other.dominance - self.dominance),
    )

emotional_memory.affect.AffectiveMomentum

Bases: BaseModel

Time-derivatives of CoreAffect.

Captures the direction and speed of affective change — velocity and acceleration in valence-arousal-dominance space (inspired by the view that affect is inherently a process of transition, cf. Spinoza).

d_valence / d_arousal / d_dominance : first derivatives (velocity) dd_valence / dd_arousal / dd_dominance: second derivatives (acceleration)

magnitude() -> float

Speed in affect-space (norm of 3D velocity vector).

Source code in src/emotional_memory/affect.py
def magnitude(self) -> float:
    """Speed in affect-space (norm of 3D velocity vector)."""
    return math.sqrt(self.d_valence**2 + self.d_arousal**2 + self.d_dominance**2)