Alarm Clock

Base Class

The abstract base class for all alarm clocks is defined below.

class popgames.alarm_clock.AlarmClockABC[source]

Bases: ABC

Abstract base class for alarm clocks.

abstractmethod __call__(size)[source]

Subclasses must implement this method to enable the alarm clock to be called as a function.

Parameters:

size (int) – Number of samples to retrieve from the clock.

Returns:

The revision times.

Return type:

Union[float, np.ndarray]

Poisson Alarm Clock

An alarm clock where inter-revision times are independently sampled from an exponential distribution.

class popgames.alarm_clock.Poisson(rate=1.0)[source]

Bases: AlarmClockABC

Poisson alarm clock.

Initialize the Poisson alarm clock.

Parameters:

rate (float) – The rate of the alarm clock. Defaults to 1.0.

__call__(size)[source]

Call the Poisson alarm clock.

Parameters:

size (int) – Number of samples to retrieve from the clock.

Returns:

The revision times.

Return type:

Union[float, np.ndarray]

Examples

>>> from popgames.alarm_clock import Poisson
>>> clock = Poisson(rate=1.0)
>>> clock(3)
array([2.34438986, 0.53956626, 0.80216914])