Stats

class MoodPeriod

This class represents a period of moods.

start_date: datetime.date
end_date: datetime.date
duration: int

Length of the period as a number of days.

avg_mood: float

Average mood for the whole period.

class Stats(entries, config=None)

A class for computing various stats from the entries.

Parameters:
  • entries (List[Entry]) – A list of parsed entries

  • config (MoodConfig) – MoodConfig for the parser (if none is provided, a default one will be created)

average_moods() List[Tuple[datetime.date, float]]

Computes average mood for each day.

activity_moods() Dict[str, Tuple[float, float]]

Computes average mood and standard deviation for each activity. The returned dict has mood name as a key and (mean, std) as value.

mean() Tuple[float, float]

Returns (mean, std) for all entries.

rolling_mean(N=5)

Computes a rolling mean for the entries.

Parameters:

N (int) – Window size

find_high_periods(threshold=4, min_duration=4) List[MoodPeriod]

Find all periods of high moods.

Parameters:
  • threshold (float) – Find moods higher than this

  • min_duration (int) – Find periods longer than this

find_low_periods(threshold=3, min_duration=5) List[MoodPeriod]

Find all periods of low moods.

Parameters:
  • threshold (float) – Find moods higher than this

  • min_duration (int) – Find periods longer than this