ezmsg.simbiophys.system.velocity2spike#
Convert polar velocity coordinates to simulated spike waveforms.
This module provides a system that encodes velocity (in polar coordinates) into spike activity using a cosine tuning model, then generates spike events and inserts realistic waveforms.
- Pipeline:
polar coords (magnitude, angle) -> cosine encoder -> clip -> Poisson events -> waveforms
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.velocity2lfp: Velocity to LFP encoding.
ezmsg.simbiophys.system.velocity2ecephys: Combined spike + LFP encoding.
Classes
- class Velocity2Spike(*args, settings=None, **kwargs)[source]#
Bases:
CollectionEncode velocity (polar coordinates) into simulated spike waveforms.
This system converts polar velocity coordinates into multi-channel spike activity:
Cosine tuning: Each channel has a preferred direction; firing rate is modulated by the cosine of the angle between velocity and preferred direction, scaled by velocity magnitude.
Poisson spike generation: Converts firing rates to discrete spike events using an inhomogeneous Poisson process.
Waveform insertion: Inserts realistic spike waveforms at event times.
- 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 spike waveforms at output_fs sampling rate.
- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
Velocity2SpikeSettings
- INPUT_SIGNAL = InputStream:unlocated[AxisArray]()#
- RATE_ENCODER = <ezmsg.simbiophys.cosine_encoder.CosineEncoderUnit object>#
- CLIP_RATE = <ezmsg.sigproc.math.clip.Clip object>#
- SPIKE_EVENT = <ezmsg.event.poissonevents.PoissonEventUnit object>#
- WAVEFORMS = <ezmsg.event.kernel_insert.SparseKernelInserterUnit object>#
- OUTPUT_SIGNAL = OutputStream:unlocated[AxisArray](self.num_buffers=32, self.force_tcp=False)#
- 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:
- network()[source]#
Override this method and have the definition return a NetworkDefinition which defines how InputStreams and OutputStreams from member Units will be connected.
The NetworkDefinition specifies the message routing between components by connecting output streams to input streams.
- Returns:
Network definition specifying stream connections
- Return type:
NetworkDefinition
- class Velocity2SpikeSettings(output_fs=30000.0, output_ch=256, baseline_rate=10.0, modulation_depth=0.06369426751592357, min_rate=0.0, seed=6767)[source]#
Bases:
SettingsSettings for
Velocity2Spike.- Parameters: