ezmsg.simbiophys.dnss.spike#

Produce data mimicking Blackrock Neurotech’s Digital Neural Signal Simulator

Functions

spike_event_generator(mode='hdmi', n_chans=4)[source]#

Generator yielding spike event indices for the DNSS pattern.

This is a send-able generator. After priming with next(), use send(n_samples) to get spikes for the next n_samples window. The generator maintains internal state tracking the current sample position.

Parameters:
  • mode (str) – “hdmi” to reproduce HDMI bugs, “ideal” for ideal pattern.

  • n_chans (int) – Number of channels in the slow-phase rotation (default 4).

Yields:

Tuple of (coords, waveform_ids)

  • coords: Shape (2, n_spikes) array of [sample_indices, channel_indices]

  • waveform_ids: Waveform shape identifiers (1, 2, or 3)

Return type:

Generator[tuple[ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]]], int, None]

Example

gen = spike_event_generator() next(gen) # Prime the generator coords, waveforms = gen.send(30000) # Get spikes in first 30000 samples coords, waveforms = gen.send(15000) # Get spikes in next 15000 samples

Classes

class DNSSSpikeProducer(*args, **kwargs)[source]#

Bases: BaseClockDrivenProducer[DNSSSpikeSettings, DNSSSpikeState]

Produces DNSS spike signal synchronized to clock ticks.

Each clock tick produces a block of spike data as sparse COO arrays based on the sample rate (fs) and chunk size (n_time) settings.

class DNSSSpikeSettings(fs=30000, n_time=None, n_ch=256, mode='hdmi')[source]#

Bases: ClockDrivenSettings

Settings for DNSS spike producer.

Parameters:
fs: float = 30000#

Sample rate in Hz. DNSS is fixed at 30kHz.

n_ch: int = 256#

Number of channels.

mode: str = 'hdmi'#

“hdmi” reproduces HDMI bugs, “ideal” for ideal pattern.

Type:

Mode

__init__(fs=30000, n_time=None, n_ch=256, mode='hdmi')#
Parameters:
Return type:

None

class DNSSSpikeState[source]#

Bases: ClockDrivenState

State for DNSS spike producer.

spike_gen: Optional[Generator] = None#
template: AxisArray | None = None#
class DNSSSpikeUnit(*args, settings=None, **kwargs)[source]#

Bases: BaseClockDrivenUnit[DNSSSpikeSettings, DNSSSpikeProducer]

Unit for generating DNSS spikes from clock input.

Parameters:

settings (Settings | None)

SETTINGS#

alias of DNSSSpikeSettings

spike_event_generator(mode='hdmi', n_chans=4)[source]#

Generator yielding spike event indices for the DNSS pattern.

This is a send-able generator. After priming with next(), use send(n_samples) to get spikes for the next n_samples window. The generator maintains internal state tracking the current sample position.

Parameters:
  • mode (str) – “hdmi” to reproduce HDMI bugs, “ideal” for ideal pattern.

  • n_chans (int) – Number of channels in the slow-phase rotation (default 4).

Yields:

Tuple of (coords, waveform_ids)

  • coords: Shape (2, n_spikes) array of [sample_indices, channel_indices]

  • waveform_ids: Waveform shape identifiers (1, 2, or 3)

Return type:

Generator[tuple[ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]]], int, None]

Example

gen = spike_event_generator() next(gen) # Prime the generator coords, waveforms = gen.send(30000) # Get spikes in first 30000 samples coords, waveforms = gen.send(15000) # Get spikes in next 15000 samples

class DNSSSpikeSettings(fs=30000, n_time=None, n_ch=256, mode='hdmi')[source]#

Bases: ClockDrivenSettings

Settings for DNSS spike producer.

Parameters:
fs: float = 30000#

Sample rate in Hz. DNSS is fixed at 30kHz.

n_ch: int = 256#

Number of channels.

mode: str = 'hdmi'#

“hdmi” reproduces HDMI bugs, “ideal” for ideal pattern.

Type:

Mode

__init__(fs=30000, n_time=None, n_ch=256, mode='hdmi')#
Parameters:
Return type:

None

class DNSSSpikeState[source]#

Bases: ClockDrivenState

State for DNSS spike producer.

spike_gen: Optional[Generator] = None#
template: AxisArray | None = None#
class DNSSSpikeProducer(*args, **kwargs)[source]#

Bases: BaseClockDrivenProducer[DNSSSpikeSettings, DNSSSpikeState]

Produces DNSS spike signal synchronized to clock ticks.

Each clock tick produces a block of spike data as sparse COO arrays based on the sample rate (fs) and chunk size (n_time) settings.

class DNSSSpikeUnit(*args, settings=None, **kwargs)[source]#

Bases: BaseClockDrivenUnit[DNSSSpikeSettings, DNSSSpikeProducer]

Unit for generating DNSS spikes from clock input.

Parameters:

settings (Settings | None)

SETTINGS#

alias of DNSSSpikeSettings