ezmsg.simbiophys.system.velocity2lfp#
Convert polar velocity coordinates to simulated LFP-like colored noise.
This module provides a system that encodes velocity (in polar coordinates) into the spectral properties of colored (1/f^beta) noise, producing LFP-like signals.
- Pipeline:
- polar coords (magnitude, angle) -> cosine encoder (beta values) -> clip
-> colored noise -> mix to channels
The velocity is encoded using a cosine tuning model where multiple noise sources have different preferred directions. Each source’s spectral exponent (beta) is modulated by the velocity direction and magnitude. These sources are then mixed across output channels using a spatial mixing matrix.
Note
This system expects polar coordinates as input. Use CoordinateSpaces with mode=CART2POL upstream to convert Cartesian velocity (vx, vy) to polar coordinates (magnitude, angle).
See also
ezmsg.simbiophys.system.velocity2spike: Velocity to spike encoding.
ezmsg.simbiophys.system.velocity2ecephys: Combined spike + LFP encoding.
Classes
- class Velocity2LFP(*args, settings=None, **kwargs)[source]#
Bases:
CollectionEncode velocity (polar coordinates) into LFP-like colored noise.
This system converts polar velocity coordinates into multi-channel LFP-like signals:
Cosine encoder: Each of n_lfp_sources has a different preferred direction. The spectral exponent beta (0-1.95) is modulated by the cosine of the angle between velocity and preferred direction, scaled by speed.
Clip: Ensures beta values stay within valid range [0, 1.95]. The ceiling is kept just below 2.0 to keep the noise filter stable (see
configure).Colored noise: Generates 1/f^beta noise where beta is dynamically modulated per source.
Baseline drift: Adds always-on slow 1/f wander to each source, giving a shared low-frequency field drift once mixed (present even at rest).
Spatial mixing: Projects the n_lfp_sources onto output_ch channels using a sinusoidal mixing matrix with random perturbations.
- Input:
AxisArray with shape (N, 2) containing polar velocity coordinates. Dimension 0 is time, dimension 1 is [magnitude, angle]. Use CoordinateSpaces(mode=CART2POL) upstream if starting from (vx, vy).
- Output:
AxisArray with shape (M, output_ch) containing LFP-like colored noise at output_fs sampling rate.
- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
Velocity2LFPSettings
- INPUT_SIGNAL = InputTopicStream:unlocated[AxisArray]()#
- BETA_ENCODER = <ezmsg.simbiophys.cosine_encoder.CosineEncoderUnit object>#
- CLIP_BETA = <ezmsg.sigproc.math.clip.Clip object>#
- PINK_NOISE = <ezmsg.simbiophys.dynamic_colored_noise.DynamicColoredNoiseUnit object>#
- BASELINE_DRIFT = <ezmsg.simbiophys.baseline_drift.BaselineDriftUnit object>#
- MIX_NOISE = <ezmsg.sigproc.affinetransform.AffineTransform object>#
- OUTPUT_SIGNAL = OutputTopicStream:unlocated[AxisArray]()#
- configure()[source]#
A lifecycle hook that runs when the Collection is instantiated.
This is the best place to call
Unit.apply_settings()on each member Unit of the Collection. Override this method to perform collection-specific configuration of child components.- Return type:
- class Velocity2LFPSettings(output_fs=30000.0, output_ch=256, n_lfp_sources=8, max_velocity=315.0, drift_scale=4.0, drift_fs=50.0, seed=6767)[source]#
Bases:
SettingsSettings for
Velocity2LFP.- Parameters:
- n_lfp_sources: int = 8#
Number of cosine-encoded LFP sources. Each source has a different preferred direction and generates colored noise with velocity-modulated spectral exponent.
- drift_scale: float = 4.0#
Amplitude of always-on slow 1/f drift added to each LFP source before mixing, so it appears as a shared low-frequency field drift across output channels. Velocity-independent, so baseline wander is present even at rest. Set to 0 to disable. Roughly ~20% of the per-channel LFP std at defaults.