visionsim.emulate.dvs.v2e package¶
Submodules¶
visionsim.emulate.dvs.v2e.emulator module¶
- class visionsim.emulate.dvs.v2e.emulator.EventEmulator(pos_thres: float = 0.2, neg_thres: float = 0.2, sigma_thres: float = 0.03, cutoff_hz: float = 30.0, leak_rate_hz: float = 0.1, refractory_period_s: float = 0.0, shot_noise_rate_hz: float = 5.0, photoreceptor_noise: bool = False, leak_jitter_fraction: float = 0.1, noise_rate_cov_decades: float = 0.1, seed: int | None = None, cs_lambda_pixels: float | None = None, cs_tau_p_ms: float | None = None, hdr: bool = False, scidvs: bool = False)[source]¶
Bases:
objectCompute DVS events from a sequence of intensity frames.
Implements a behavioural model of a Dynamic Vision Sensor (DVS) pixel array, including:
Log-domain contrast-change detection with per-pixel threshold mismatch.
Intensity-dependent first-order low-pass photoreceptor filtering.
Leak current simulation (slow baseline drift -> spurious ON events).
Refractory period enforcement per pixel.
Simple Poisson shot noise or correlated photoreceptor-noise model.
Optional centre-surround (CSDVS) inhibition via a resistive-diffuser surround.
Optional SCIDVS non-linear high-pass amplified photoreceptor.
- MAX_CHANGE_TO_TERMINATE_EULER_SURROUND_STEPPING: float = 1e-05¶
- SCIDVS_GAIN: float = 2¶
- SCIDVS_TAU_S: float = 0.01¶
- SCIDVS_TAU_COV: float = 0.5¶
- SHOT_NOISE_INTEN_FACTOR: float = 0.25¶
- __init__(pos_thres: float = 0.2, neg_thres: float = 0.2, sigma_thres: float = 0.03, cutoff_hz: float = 30.0, leak_rate_hz: float = 0.1, refractory_period_s: float = 0.0, shot_noise_rate_hz: float = 5.0, photoreceptor_noise: bool = False, leak_jitter_fraction: float = 0.1, noise_rate_cov_decades: float = 0.1, seed: int | None = None, cs_lambda_pixels: float | None = None, cs_tau_p_ms: float | None = None, hdr: bool = False, scidvs: bool = False) None[source]¶
Initialise the emulator with sensor and noise parameters.
- Parameters:
pos_thres – Nominal ON-event threshold in log_e intensity units.
neg_thres – Nominal OFF-event threshold in log_e intensity units.
sigma_thres – Standard deviation of the per-pixel threshold distribution in log_e units.
cutoff_hz – 3 dB cutoff frequency of the DVS photoreceptor low-pass filter in Hz. Set to 0 to disable filtering. Defaults to 30.
leak_rate_hz – Nominal leak-event rate per pixel in Hz, modelling junction leakage in the reset switch.
refractory_period_s – Minimum inter-event interval per pixel in seconds. Set to 0 to disable.
shot_noise_rate_hz – Shot-noise event rate per pixel in Hz. Applied as independent Poisson events, or as correlated Gaussian noise at the photoreceptor when photoreceptor_noise is
True. Set to 0 to disable. Defaults to 5.photoreceptor_noise – When
True, model shot noise as correlated Gaussian noise injected at the photoreceptor rather than as independent Poisson events. Requires both shot_noise_rate_hz and cutoff_hz to be non-zero. Defaults toFalse.leak_jitter_fraction – Fractional random variation applied to the per-pixel leak rate to model device mismatch.
noise_rate_cov_decades – Standard deviation (in decades) of the log-normal per-pixel noise-rate distribution.
seed – Random seed for threshold mismatch and noise. Use
Nonefor a new random seed on every run.cs_lambda_pixels – Space constant of the centre-surround surround in pixels. Pass
Noneto disable surround inhibition.cs_tau_p_ms – Time constant of the surround low-pass filter in ms, or
None/ 0 for an instantaneous surround.hdr – When
True, treat the input as HDR floating-point log-encoded grey scale where pixel value 255 corresponds toln(255) ≈ 5.54.scidvs – When
True, simulate the high-gain adaptive photoreceptor of the SCIDVS pixel.
- reset() None[source]¶
Reset the emulator state.
Clears all internal frame buffers and event counters so that the next call to
generate_events()will reinitialise the emulator as if it had just been constructed.
- use_preset(model: Literal['clean', 'noisy']) None[source]¶
Apply a named preset of DVS sensor parameters.
Two presets are available:
"clean"– ideal sensor with no noise or mismatch."noisy"– realistic sensor with typical noise levels.
- Raises:
ValueError – If the model name is not recognized.
- Parameters:
model – Name of the parameter preset (
"clean"or"noisy").
- generate_events(new_frame: npt.NDArray, t_frame: float) npt.NDArray | None[source]¶
Generate DVS events from a new intensity frame.
On the first call the emulator initialises its internal state and returns
None(no events from a single frame). Subsequent calls produce events based on the log-intensity change since the last frame.- Parameters:
new_frame – Intensity frame of shape
[H, W]. Note that the first axis is y (rows) and the second is x (columns), matching the MATLAB / NumPy convention.t_frame – Timestamp of this frame in seconds.
- Raises:
ValueError – If t_frame is earlier than the previous frame’s timestamp.
- Returns:
An
[N, 4]float32array where each row is[timestamp, x, y, polarity]with polarity+1for ON events and-1for OFF events, orNoneif no events were generated.