dspk.synapse.spatial
Space: where each spike comes from on the probe (four localisers), and how the probe drifted (rigid or by depth blocks). Positions and depths are µm, in the probe’s coordinates.
drift |
How the probe moved over the recording, from where and when spikes occurred. |
localize |
Where each spike comes from on the probe. |
Functions
Section titled “Functions”drift( samples, depths_um, amplitudes_uv, total_samples: int, sample_rate: float, *, depth_min_um: float, depth_max_um: float, time_bin_s: float = DEFAULT_DRIFT_TIME_BIN_S, depth_bin_um: float = DEFAULT_DRIFT_DEPTH_BIN_UM, max_drift_um: float = DEFAULT_MAX_DRIFT_UM, depth_blocks: int = DEFAULT_DRIFT_DEPTH_BLOCKS, rigid: bool = True,) -> dictHow the probe moved over the recording, from where and when spikes occurred.
Parameters
samples:array_like
Sample of every spike.depths_um:array_like
Depth of every spike, in µm.amplitudes_uv:array_like
Amplitude of every spike, in µV.total_samples:int
Samples in the recording.sample_rate:float
Sample rate in Hz.depth_min_um:float
The depth range considered.depth_max_um:float
The depth range considered.time_bin_s:float, defaultDEFAULT_DRIFT_TIME_BIN_S(2.0)
Time resolution of the estimate.depth_bin_um:float, defaultDEFAULT_DRIFT_DEPTH_BIN_UM(5.0)
Depth resolution of the activity map.max_drift_um:float, defaultDEFAULT_MAX_DRIFT_UM(50.0)
Largest shift searched.depth_blocks:int, defaultDEFAULT_DRIFT_DEPTH_BLOCKS(5)
Blocks along depth, each with its own drift (rigid=False).rigid:bool, defaultTrue
One drift for the whole probe, or one per depth block.
Returns
dict— Rigid:times_s,drift_um,activity(time bins, depth bins). Non-rigid:times_s,block_centers_um,drift_um(depth_blocks, time bins).
localize
Section titled “localize”localize( snippets: dict, probe: Probe, *, method: str = 'center_of_mass', power: float = DEFAULT_COM_POWER, max_iterations: int | None = None, xy_radius_um: float = DEFAULT_GRID_XY_RADIUS_UM, xy_step_um: float = DEFAULT_GRID_XY_STEP_UM, z_values_um=DEFAULT_GRID_Z_VALUES_UM, softmax_temperature: float = DEFAULT_GRID_SOFTMAX_TEMPERATURE,) -> np.ndarrayWhere each spike comes from on the probe.
Parameters
snippets:dict
waveforms(spikes, k, samples)andchannels(spikes, k), the spike’s own channel first, assynapse.extraction.snippetsreturns them.probe:Probe
The probe.method:{"center_of_mass", "monopolar", "grid_convolution", "dipole"}, default'center_of_mass'
"center_of_mass": the sites weighted by peak-to-peak height topower."monopolar": a point source fitted by Levenberg–Marquardt."grid_convolution": a grid of candidate sources, weighted by a softmax."dipole": a dipole fitted to the signed peaks.power:float, defaultDEFAULT_COM_POWER(1.0)
Exponent of the weights ("center_of_mass").max_iterations:int, defaultNone
Fit iterations ("monopolar","dipole"); by defaultDEFAULT_MONOPOLAR_ITERATIONSorDEFAULT_DIPOLE_ITERATIONS.xy_radius_um:float, defaultDEFAULT_GRID_XY_RADIUS_UM(30.0)
Extent and step of the candidate grid ("grid_convolution").xy_step_um:float, defaultDEFAULT_GRID_XY_STEP_UM(5.0)
Extent and step of the candidate grid ("grid_convolution").z_values_um:sequence of float, defaultDEFAULT_GRID_Z_VALUES_UM([5.0, 10.0, 20.0, 35.0, 50.0])
Candidate distances from the probe plane ("grid_convolution").softmax_temperature:float, defaultDEFAULT_GRID_SOFTMAX_TEMPERATURE(0.05)
Sharpness of the grid weights ("grid_convolution").
Returns
np.ndarray— Positions(spikes, 3)in µm, in the probe’s coordinates.
Raises
ValueError: For an unknownmethod.