BaseClock class

(Shortest import: from brian2.core.clocks import BaseClock)

class brian2.core.clocks.BaseClock(*args, **kw)[source]

Bases: VariableOwner, ABC

Abstract base class for all clocks in the simulator.

This class should never be instantiated directly, use one of the subclasses like Clock or EventClock instead.

Parameters:

name : str, optional

An explicit name, if not specified gives an automatically generated name

Methods

advance()

Advance the clock to the next time step.

same_time(other)

Check if two clocks are at the same time (within epsilon).

set_interval(start, end)

Set the start and end time of the simulation.

Details

abstractmethod advance()[source]

Advance the clock to the next time step. Must be implemented by subclasses.

abstractmethod same_time(other)[source]

Check if two clocks are at the same time (within epsilon).

Parameters:

other : BaseClock

The other clock to compare with

Returns:

bool :

True if both clocks are at the same time

abstractmethod set_interval(start, end)[source]

Set the start and end time of the simulation. Must be implemented by subclasses.