ezmsg.simbiophys.system.velocity2ecephys#
Convert 2D cursor velocity to simulated extracellular electrophysiology.
This module provides a complete system that encodes cursor velocity into realistic ecephys signals containing both spike waveforms and LFP-like background activity.
- Pipeline:
- velocity (x,y) -> CART2POL –+–> Velocity2Spike –> spikes –|
- +–> Add –> ecephys
+–> Velocity2LFP —-> lfp —–|
The coordinate transformation from Cartesian to polar is done once at the input, then shared by both spike and LFP encoding branches.
This is the top-level system for velocity-encoded neural simulation. Use this when you need full ecephys-like output suitable for testing BCI decoders.
See also
ezmsg.simbiophys.system.velocity2spike: Spike-only encoding.
ezmsg.simbiophys.system.velocity2lfp: LFP-only encoding.
Classes
- class VelocityEncoder(*args, settings=None, **kwargs)[source]#
Bases:
CollectionEncode cursor velocity into simulated extracellular electrophysiology.
This system combines spike and LFP encoding to produce realistic ecephys signals. It runs two parallel pipelines:
Spike branch (
Velocity2Spike): Generates cosine-tuned spike waveforms based on velocity direction and magnitude.LFP branch (
Velocity2LFP): Generates velocity-modulated colored noise representing local field potentials.
The outputs are summed to produce the final ecephys signal.
- Input:
AxisArray with shape (N, 2) containing cursor velocity in pixels/second. Dimension 0 is time, dimension 1 is [vx, vy].
- Output:
AxisArray with shape (M, output_ch) containing combined spike and LFP signals at output_fs sampling rate.
Example
>>> encoder = VelocityEncoder(VelocityEncoderSettings( ... output_fs=30_000.0, ... output_ch=256, ... seed=42, ... ))
- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
VelocityEncoderSettings
- INPUT_SIGNAL = InputStream:unlocated[<class 'ezmsg.util.messages.axisarray.AxisArray'>]()#
- COORDS = <ezmsg.sigproc.coordinatespaces.CoordinateSpaces object>#
- SPIKES = <ezmsg.simbiophys.system.velocity2spike.Velocity2Spike object>#
- LFP = <ezmsg.simbiophys.system.velocity2lfp.Velocity2LFP object>#
- ADD = <ezmsg.sigproc.math.add.Add object>#
- OUTPUT_SIGNAL = OutputStream:unlocated[<class 'ezmsg.util.messages.axisarray.AxisArray'>](self.num_buffers=32, self.force_tcp=False)#
- class VelocityEncoderSettings(output_fs=30000.0, output_ch=256, seed=6767)[source]#
Bases:
SettingsSettings for
VelocityEncoder.
- class VelocityEncoderSettings(output_fs=30000.0, output_ch=256, seed=6767)[source]#
Bases:
SettingsSettings for
VelocityEncoder.
- class VelocityEncoder(*args, settings=None, **kwargs)[source]#
Bases:
CollectionEncode cursor velocity into simulated extracellular electrophysiology.
This system combines spike and LFP encoding to produce realistic ecephys signals. It runs two parallel pipelines:
Spike branch (
Velocity2Spike): Generates cosine-tuned spike waveforms based on velocity direction and magnitude.LFP branch (
Velocity2LFP): Generates velocity-modulated colored noise representing local field potentials.
The outputs are summed to produce the final ecephys signal.
- Input:
AxisArray with shape (N, 2) containing cursor velocity in pixels/second. Dimension 0 is time, dimension 1 is [vx, vy].
- Output:
AxisArray with shape (M, output_ch) containing combined spike and LFP signals at output_fs sampling rate.
Example
>>> encoder = VelocityEncoder(VelocityEncoderSettings( ... output_fs=30_000.0, ... output_ch=256, ... seed=42, ... ))
- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
VelocityEncoderSettings
- INPUT_SIGNAL = InputStream:unlocated[<class 'ezmsg.util.messages.axisarray.AxisArray'>]()#
- COORDS = <ezmsg.sigproc.coordinatespaces.CoordinateSpaces object>#
- SPIKES = <ezmsg.simbiophys.system.velocity2spike.Velocity2Spike object>#
- LFP = <ezmsg.simbiophys.system.velocity2lfp.Velocity2LFP object>#
- ADD = <ezmsg.sigproc.math.add.Add object>#
- OUTPUT_SIGNAL = OutputStream:unlocated[<class 'ezmsg.util.messages.axisarray.AxisArray'>](self.num_buffers=32, self.force_tcp=False)#