Skip to content

Base

LayerBase

Bases: LoggingMixin

Simple base layer implementing methods used by all retinal layers.

add_recorder(name, fpath, function, size=None, codec=None, fps=None, vl=None)

Add a video recorder.

Parameters:

Name Type Description Default
name str

Name of the recorder.

required
fpath str | Path

File to save the recorded video output to.

required
function Callable

A function producing frames.

required
size tuple[int, int] | ndarray | None

Size (height x width) of the frame.

None
codec str | None

The codec to use for the VideoRecorder.

None
fps int | None

The FPS to use for the VideoRecorder.

None
vl VideoLoader | None

An optional VideoLoader instance.

None

Returns:

Type Description
VideoRecorder

A VideoRecorder instance.

convolve(rf, signal)

Convolve the unrolled input vector with the current layer's receptive field.

Parameters:

Name Type Description Default
rf ndarray

Receptive field.

required
signal ndarray

The input signal (unrolled).

required

Returns:

Type Description
ndarray

The convolved signal (unrolled).

forward(*args, **kwargs)

Generic method for processing input. Should be overridden in derived classes.

update_state(dt, *args, **kwargs)

Updates the internal state based on temporal dynamics. Should be be implemented in derived classes.

Parameters:

Name Type Description Default
dt float

The time interval since the last input.

required