cleo.ephys module

Contains probes, convenience functions for generating electrode array coordinates, signals, spiking, and LFP

class cleo.ephys.LFPSignalBase(*, name: str = NOTHING)[source]

Bases: Signal, NeoExportable

Base class for LFP Signals.

Injection kwargs:

orientation (np.ndarray, optional) – Array of shape (n_neurons, 3) representing which way is “up,” that is, towards the surface of the cortex, for each neuron. If a single vector is given, it is taken to be the orientation for all neurons in the group. [0, 0, -1] is the default, meaning the negative z axis is “up.”

Method generated by attrs for class Signal.

brian_objects: set

All Brian objects created by the signal. Must be kept up-to-date for automatic injection into the network

lfp: Quantity = _CountingAttr(counter=160, _default=NOTHING, repr=False, eq=True, order=True, hash=None, init=False, on_setattr=None, alias=None, metadata={})

Approximated LFP from every call to get_state(). Shape is (n_samples, n_channels). Stored if save_history on probe

name: str

Unique identifier used to organize probe output. Name of the class by default.

probe: Probe

The probe the signal is configured to record for.

t: Quantity = _CountingAttr(counter=159, _default=NOTHING, repr=False, eq=True, order=True, hash=None, init=False, on_setattr=None, alias=None, metadata={})

Times at which LFP is recorded, with Brian units, stored if save_history on probe

to_neo() AnalogSignal[source]

Return a Neo signal object with the device’s data

Returns:

Neo object representing exported data

Return type:

neo.core.BaseNeo

class cleo.ephys.MultiUnitActivity(r_noise_floor: ~brian2.units.fundamentalunits.Quantity = 80. * umetre, threshold_sigma: int = 4, spike_amplitude_cv: float = 0.05, r0: ~brian2.units.fundamentalunits.Quantity = 5. * umetre, recording_recall_cutoff: float = 0.001, eap_decay_fn: ~typing.Callable[[~brian2.units.fundamentalunits.Quantity], float] = <function Spiking.<lambda>>, simulate_false_positives: bool = True, collision_prob_fn: ~typing.Callable[[~brian2.units.fundamentalunits.Quantity], float] = <function MultiUnitActivity.<lambda>>, *, name: str = NOTHING)[source]

Bases: Spiking

Detects (unsorted) spikes per channel.

Method generated by attrs for class MultiUnitActivity.

collision_prob_fn: Callable[[Quantity], float]

The probability of failing to detect the latter of two overlapping threshold crossings on a given channel, as a function of t2 - t1. Values for t2 - t1 < 0 are ignored.

For SortedSpiking, the default is a decaying exponential. See Garcia et al. (2022) for what this might look like for different sorters.

By default simply enforces a hard 1 ms refractory period per channel for MultiUnitActivity.

get_state() tuple[Int[ndarray, 'n_spikes'], Quantity, Int[ndarray, '{self.n_channels}']][source]

Return spikes since method was last called (i, t, y)

Returns:

(i, t, y) where i is channel (for multi-unit) or neuron (for sorted) spike indices, t is spike times, and y is a spike count vector suitable for control- theoretic uses—i.e., a 0 for every channel/neuron that hasn’t spiked and a 1 for a single spike.

Return type:

tuple[Int[np.ndarray, “n_spikes”], Quantity, Int[np.ndarray, “{self.n}”]]

property n

channels for MultiUnitActivity or sorted neurons for SortedSpiking.

Type:

Number of spike sources

to_neo() Group[source]

Return a Neo signal object with the device’s data

Returns:

Neo object representing exported data

Return type:

neo.core.BaseNeo

class cleo.ephys.Probe(coords: Quantity, signals: list[Signal] = NOTHING, *, name: str = NOTHING, save_history: bool = True)[source]

Bases: Recorder, NeoExportable

Picks up specified signals across an array of electrodes.

Visualization kwargs:
  • marker (str, optional) – The marker used to represent each contact. “x” by default.

  • size (float, optional) – The size of each contact marker. 40 by default.

  • color (Any, optional) – The color of contact markers. “xkcd:dark gray” by default.

Method generated by attrs for class Probe.

add_self_to_plot(ax: Axes3D, axis_scale_unit: Unit, **kwargs) list[Artist][source]

Add device to an existing plot

Should only be called by plot().

Parameters:
  • ax (Axes3D) – The existing matplotlib Axes object

  • axis_scale_unit (Unit) – The unit used to label axes and define chart limits

  • **kwargs (optional)

Returns:

A list of artists used to render the device. Needed for use in conjunction with VideoVisualizer.

Return type:

list[Artist]

add_signals(*signals: Signal) None[source]

Add signals to the probe for recording

Parameters:

*signals (Signal) – signals to add

connect_to_neuron_group(neuron_group: NeuronGroup, **kwparams: Any) None[source]

Configure probe to record from given neuron group

Will call Signal.connect_to_neuron_group() for each signal

Parameters:
  • neuron_group (NeuronGroup) – neuron group to connect to, i.e., record from

  • **kwparams (Any) – Passed in to signals’ connect functions, needed for some signals

coords: Quantity

Coordinates of n electrodes. Must be an n x 3 array (with unit) where columns represent x, y, and z

get_state() dict[source]

Get current state from probe, i.e., all signals

Returns:

{‘signal_name’: value} dict with signal states

Return type:

dict

property n

Number of electrode contacts in the probe

reset(**kwargs)[source]

Reset the probe to a neutral state

Calls reset() on each signal

signals: list[Signal]

Signals recorded by the probe. Can be added to post-init with add_signals().

to_neo() Group[source]

Return a Neo signal object with the device’s data

Returns:

Neo object representing exported data

Return type:

neo.core.BaseNeo

property xs: Quantity

x coordinates of recording contacts

Returns:

x coordinates represented as a Brian quantity, that is, including units. Should be like a 1D array.

Return type:

Quantity

property ys: Quantity

y coordinates of recording contacts

Returns:

y coordinates represented as a Brian quantity, that is, including units. Should be like a 1D array.

Return type:

Quantity

property zs: Quantity

z coordinates of recording contacts

Returns:

z coordinates represented as a Brian quantity, that is, including units. Should be like a 1D array.

Return type:

Quantity

class cleo.ephys.RWSLFPSignalBase(amp_func: callable = <function mazzoni15_nrn>, pop_aggregate: bool = False, wslfp_kwargs: dict = NOTHING, lfp_unit: ~brian2.units.fundamentalunits.Unit = 1, *, name: str = NOTHING)[source]

Bases: LFPSignalBase

Base class for RWSLFPSignalFromSpikes and RWSLFPSignalFromPSCs.

These signals should only be injected into neurons representing pyramidal cells with standard synaptic structure (see Mazzoni, Lindén et al., 2015).

RWSLFP is computed using the wslfp package.

amp_func and pop_aggregate can be overridden on injection.

Method generated by attrs for class RWSLFPSignalBase.

amp_func: callable

Function to calculate LFP amplitudes, by default wslfp.mazzoni15_nrn.

See wslfp documentation for more info.

get_state() ndarray[source]

Get the signal’s current value

pop_aggregate: bool

Whether to aggregate currents across the population (as opposed to neurons having differential contributions to LFP depending on their location). False by default.

reset(**kwargs) None[source]

Reset signal to a neutral state

to_neo() AnalogSignal[source]

Return a Neo signal object with the device’s data

Returns:

Neo object representing exported data

Return type:

neo.core.BaseNeo

wslfp_kwargs: dict

Keyword arguments to pass to the WSLFP calculator, e.g., alpha, tau_ampa_ms, tau_gaba_ms````source_coords_are_somata, source_dendrite_length_um, amp_kwargs, strict_boundaries.

class cleo.ephys.RWSLFPSignalFromPSCs(amp_func: callable = <function mazzoni15_nrn>, pop_aggregate: bool = False, wslfp_kwargs: dict = NOTHING, lfp_unit: ~brian2.units.fundamentalunits.Unit = 1, *, name: str = NOTHING)[source]

Bases: RWSLFPSignalBase

Computes RWSLFP from the currents onto pyramidal cells.

Use this if your model already simulates synaptic current dynamics. Iampa_var_names and Igaba_var_names are lists of variable names to include and must be passed in as kwargs on injection or else the target neuron group will not contribute to this signal (desirable for interneurons).

RWSLFP refers to the Reference Weighted Sum of synaptic currents LFP proxy from Mazzoni, Lindén et al., 2015.

Injection kwargs:
  • Iampa_var_names (list[str]) – List of variable names in the neuron group representing AMPA currents.

  • Igaba_var_names (list[str]) – List of variable names in the neuron group representing GABA currents.

Method generated by attrs for class RWSLFPSignalFromPSCs.

connect_to_neuron_group(neuron_group: NeuronGroup, **kwparams)[source]

Configure signal to record from specified neuron group

Parameters:

neuron_group (NeuronGroup) – group to record from

reset(**kwargs) None[source]

Reset signal to a neutral state

class cleo.ephys.RWSLFPSignalFromSpikes(amp_func: callable = <function mazzoni15_nrn>, pop_aggregate: bool = False, wslfp_kwargs: dict = NOTHING, lfp_unit: ~brian2.units.fundamentalunits.Unit = 1, tau1_ampa: ~brian2.units.fundamentalunits.Quantity = 2. * msecond, tau2_ampa: ~brian2.units.fundamentalunits.Quantity = 0.4 * msecond, tau1_gaba: ~brian2.units.fundamentalunits.Quantity = 5. * msecond, tau2_gaba: ~brian2.units.fundamentalunits.Quantity = 250. * usecond, syn_delay: ~brian2.units.fundamentalunits.Quantity = 1. * msecond, I_threshold: float = 0.001, weight: str = 'w', *, name: str = NOTHING)[source]

Bases: RWSLFPSignalBase

Computes RWSLFP from the spikes onto pyramidal cell.

Use this if your model does not simulate synaptic current dynamics directly. The parameters of this class are used to synthesize biexponential synaptic currents using wslfp.spikes_to_biexp_currents(). ampa_syns and gaba_syns are lists of Synapses or SynapticSubgroup objects and must be passed as kwargs on injection, or else this signal will not be recorded for the target neurons (useful for ignoring interneurons). Attributes set on the signal object serve as the default, but can be overridden on injection. Also, in the case that parameters (e.g., tau1_ampa or weight) vary by synapse, these can be overridden by passing a tuple of the Synapses or SynapticSubgroup object and a dictionary of the parameters to override.

RWSLFP refers to the Reference Weighted Sum of synaptic currents LFP proxy from Mazzoni, Lindén et al., 2015.

Injection kwargs:
  • ampa_syns (list[Synapses | SynapticSubgroup | tuple[Synapses|SynapticSubgroup, dict]]) – Synapses or SynapticSubgroup objects representing AMPA synapses (delivering excitatory currents). Or a tuple of the Synapses or SynapticSubgroup object and a dictionary of parameters to override.

  • gaba_syns (list[Synapses | SynapticSubgroup | tuple[Synapses|SynapticSubgroup, dict]]) – Synapses or SynapticSubgroup objects representing GABA synapses (delivering inhibitory currents). Or a tuple of the Synapses or SynapticSubgroup object and a dictionary of parameters to override.

  • weight (str | float, optional) – Name of the weight variable or parameter in the Synapses or SynapticSubgroup objects, or a float in the case of a single weight for all synapses. Default is ‘w’.

Method generated by attrs for class RWSLFPSignalFromSpikes.

I_threshold: float

Threshold, as a proportion of the peak current, below which spikes’ contribution to synaptic currents (and thus LFP) is ignored, by default 1e-3.

connect_to_neuron_group(neuron_group: NeuronGroup, **kwparams)[source]

Configure signal to record from specified neuron group

Parameters:

neuron_group (NeuronGroup) – group to record from

syn_delay: Quantity

The synaptic transmission delay, i.e., between a spike and the onset of the postsynaptic current. 1 ms by default.

tau1_ampa: Quantity

The fall time constant of the biexponential current kernel for AMPA synapses. 2 ms by default.

tau1_gaba: Quantity

The fall time constant of the biexponential current kernel for GABA synapses. 5 ms by default.

tau2_ampa: Quantity

The time constant of subtracted part of the biexponential current kernel for AMPA synapses. 0.4 ms by default.

tau2_gaba: Quantity

The time constant of subtracted part of the biexponential current kernel for GABA synapses. 0.25 ms by default.

weight: str

Name of the weight variable or parameter in the Synapses or SynapticSubgroup objects. Default is ‘w’.

class cleo.ephys.Signal(*, name: str = NOTHING)[source]

Bases: ABC

Base class representing something an electrode can record

Method generated by attrs for class Signal.

brian_objects: set

All Brian objects created by the signal. Must be kept up-to-date for automatic injection into the network

abstract connect_to_neuron_group(neuron_group: NeuronGroup, **kwparams)[source]

Configure signal to record from specified neuron group

Parameters:

neuron_group (NeuronGroup) – group to record from

abstract get_state() Any[source]

Get the signal’s current value

init_for_probe(probe: Probe) None[source]

Called when attached to a probe.

Ensures signal can access probe and is only attached to one

Parameters:

probe (Probe) – Probe to attach to

Raises:

ValueError – When signal already attached to another probe

name: str

Unique identifier used to organize probe output. Name of the class by default.

probe: Probe

The probe the signal is configured to record for.

reset(**kwargs) None[source]

Reset signal to a neutral state

class cleo.ephys.SortedSpiking(r_noise_floor: ~brian2.units.fundamentalunits.Quantity = 80. * umetre, threshold_sigma: int = 4, spike_amplitude_cv: float = 0.05, r0: ~brian2.units.fundamentalunits.Quantity = 5. * umetre, recording_recall_cutoff: float = 0.001, eap_decay_fn: ~typing.Callable[[~brian2.units.fundamentalunits.Quantity], float] = <function Spiking.<lambda>>, simulate_false_positives: bool = True, snr_cutoff: float = 6, collision_prob_fn: ~typing.Callable[[~brian2.units.fundamentalunits.Quantity], float] = <function SortedSpiking.<lambda>>, *, name: str = NOTHING)[source]

Bases: Spiking

Detect spikes identified by neuron indices.

The indices used by the probe do not correspond to those coming from neuron groups, since the probe must consider multiple potential groups and within a group ignores those neurons that are too far away to be easily detected.

Method generated by attrs for class SortedSpiking.

collision_prob_fn: Callable[[Quantity], float]

The probability of failing to detect the latter of two overlapping threshold crossings on a given channel, as a function of t2 - t1. Values for t2 - t1 < 0 are ignored.

For SortedSpiking, the default is a decaying exponential. See Garcia et al. (2022) for what this might look like for different sorters.

By default simply enforces a hard 1 ms refractory period per channel for MultiUnitActivity.

connect_to_neuron_group(neuron_group, **kwparams)[source]

Configure signal to record from specified neuron group

Parameters:

neuron_group (NeuronGroup) – Neuron group to record from

get_state() tuple[Int[ndarray, 'n_spikes'], Quantity, Int[ndarray, '{self.n}']][source]

Return spikes since method was last called (i, t, y)

Returns:

(i, t, y) where i is channel (for multi-unit) or neuron (for sorted) spike indices, t is spike times, and y is a spike count vector suitable for control- theoretic uses—i.e., a 0 for every channel/neuron that hasn’t spiked and a 1 for a single spike.

Return type:

tuple[Int[np.ndarray, “n_spikes”], Quantity, Int[np.ndarray, “{self.n}”]]

property i_ng_by_i_sorted: list[tuple[NeuronGroup, int]]

Get a list of (ng, i_ng) tuples for all sorted neurons, in order.

That is, this maps from sorted indices back to the original neuron group and indices.

i_sorted_by_ng(ng: NeuronGroup) Int[ndarray, '{ng.N}'][source]

Get the sorted indices for a given neuron group.

-1 means recorded, but not sorted. -2 means not recorded.

property n

channels for MultiUnitActivity or sorted neurons for SortedSpiking.

Type:

Number of spike sources

property n_sorted

Number of sorted neurons

property r_cutoff: Quantity

The distance from a contact at which the SNR is high enough for a neuron to be included.

snr_cutoff: float

The signal-to-noise ratio a unit must have for its spikes to be reported. SNR is defined as the mean spike amplitude divided by the standard deviation of the background noise for the peak (closest) channel.

Should be higher than threshold_sigma. Spikes from units with SNR < snr_cutoff still factor into collision sampling and are reported as unsorted (index -1), essentially “multi-unit activity”.

property sorted_units_snr: Float[ndarray, '{self.n_sorted}']

The SNR for each sorted neuron, in order.

class cleo.ephys.Spiking(r_noise_floor: ~brian2.units.fundamentalunits.Quantity = 80. * umetre, threshold_sigma: int = 4, spike_amplitude_cv: float = 0.05, r0: ~brian2.units.fundamentalunits.Quantity = 5. * umetre, recording_recall_cutoff: float = 0.001, eap_decay_fn: ~typing.Callable[[~brian2.units.fundamentalunits.Quantity], float] = <function Spiking.<lambda>>, collision_prob_fn: ~typing.Callable[[~brian2.units.fundamentalunits.Quantity], float] = None, simulate_false_positives: bool = True, *, name: str = NOTHING)[source]

Bases: Signal, NeoExportable

Base class for probabilistically detecting spikes.

See notebooks/spike_detection.py for an interactive explanation of the methods and parameters involved.

Method generated by attrs for class Spiking.

collision_prob_fn: Callable[[Quantity], float]

The probability of failing to detect the latter of two overlapping threshold crossings on a given channel, as a function of t2 - t1. Values for t2 - t1 < 0 are ignored.

For SortedSpiking, the default is a decaying exponential. See Garcia et al. (2022) for what this might look like for different sorters.

By default simply enforces a hard 1 ms refractory period per channel for MultiUnitActivity.

connect_to_neuron_group(neuron_group: NeuronGroup, **kwparams)[source]

Configure signal to record from specified neuron group

Parameters:

neuron_group (NeuronGroup) – Neuron group to record from

eap_decay_fn: Callable[[Quantity], float]

The function describing the decay of the measured extracellular action potential amplitude. By default 1/r^2.

This inverse square decay is a good approximation in accordance with the detailed simulations by Pettersen et al. (2008), though they find the exponent ranges from 2 to 3 depending on the cell type and distance.

abstract get_state() tuple[Int[ndarray, 'n_spikes'], Quantity, Int[ndarray, '{self.n}']][source]

Return spikes since method was last called (i, t, y)

Returns:

(i, t, y) where i is channel (for multi-unit) or neuron (for sorted) spike indices, t is spike times, and y is a spike count vector suitable for control- theoretic uses—i.e., a 0 for every channel/neuron that hasn’t spiked and a 1 for a single spike.

Return type:

tuple[Int[np.ndarray, “n_spikes”], Quantity, Int[np.ndarray, “{self.n}”]]

i: Int[np.ndarray, 'n_recorded_spikes']

Channel (for multi-unit) or neuron (for sorted) indices of spikes, stored if save_history on probe

i_ng_by_i_probe: list[tuple[NeuronGroup, int]]

n_neurons-length list indexed by i_probe returning a neuron_group, i_ng tuple to map from i_probe to neuron group and index.

i_probe_by_ng: dict[NeuronGroup, Int[np.ndarray, 'ng_N']]

neuron_group keys, i_probe values for every neuron in group.

abstract property n

channels for MultiUnitActivity or sorted neurons for SortedSpiking.

Type:

Number of spike sources

property n_channels: int

Number of channels on probe

property n_neurons: int

Number of neurons recorded by probe

r0: Quantity

A small distance added to r before computing the amplitude to avoid division by 0 for the power law decay. 5 μm by default.

It also makes some physical sense as the minimum distance from the current source it is possible to place an electrode, 5 μm being reasonable as the radius of a typical soma.

r_for_recall(recall: float, resolution: Quantity = 100. * nmetre, upper_limit: Quantity = None) Quantity[source]

The distance from a contact at which the single-channel recall (detection probability) equals the specified value.

r_for_snr(snr: float, resolution: Quantity = 100. * nmetre, upper_limit: Quantity = None) Quantity[source]

The distance from a contact at which the SNR equals the specified value.

r_noise_floor: Quantity

Radius (with Brian unit) at which the measured spike amplitude equals the background noise standard deviation. i.e., spike_amplitude(r_noise_floor) = sigma_noise = 1. 80 μm by default.

property r_threshold: Quantity

The distance from a contact at which the SNR equals the detection threshold. This also means 50% single-channel recall.

recall_by_distance(r: Quantity) float[source]

Probability of detecting a spike at distance r from the neuron as a function of distance.

recall_by_snr(snr: float) float[source]

Probability of detecting a spike at distance r from the neuron as a function of SNR.

recording_recall_cutoff: float

Multi-channel recall, above which neurons will be considered. I.e., the probability a spike is detected on at least one channel.

You shouldn’t need to change this; it’s mainly for efficiency, allowing amplitude sampling and threshold crossing to operate on fewer spikes by ignoring neurons very unlikely to produce a spike that crosses the threshold.

reset(**kwargs) None[source]

Reset signal to a neutral state

simulate_false_positives: bool

Whether to simulate false positives from noise. In the case of SortedSpiking, these aren’t reported, but still affect collision sampling.

snr_by_distance(r: Quantity) float[source]

The mean extracellular action potential amplitude as a function of distance from the neuron, in units of background noise standard deviation.

spike_amplitude_cv: float

Coefficient of variation of the spike amplitude, i.e., |sigma_amp/mu_amp|. From what we have seen in Allen Cell Types data, this ranges from 0 to 0.2, but is most often very low. 0.05 by default.

t: Quantity

Spike times with Brian units, stored if save_history on probe

t_samp: Quantity

Sample times with Brian units when each spike was recorded, stored if save_history on probe

threshold_sigma: int

Spike detection threshold, as a multiple of sigma_noise. Values in real experiments typically range from 3 to 6. 4 by default.

to_neo() Group[source]

Return a Neo signal object with the device’s data

Returns:

Neo object representing exported data

Return type:

neo.core.BaseNeo

class cleo.ephys.TKLFPSignal(uLFP_threshold: Quantity = 1. * nvolt, lfp_unit: Unit = uvolt, *, name: str = NOTHING)[source]

Bases: LFPSignalBase

Records the Teleńczuk kernel LFP approximation.

Requires tklfp_type='exc'|'inh' to specify cell type on injection.

TKLFP is computed from spikes using the tklfp package.

Injection kwargs:

tklfp_type (str) – Either ‘exc’ or ‘inh’ to specify the cell type.

Method generated by attrs for class TKLFPSignal.

connect_to_neuron_group(neuron_group: NeuronGroup, **kwparams)[source]

Configure signal to record from specified neuron group

Parameters:

neuron_group (NeuronGroup) – group to record from

get_state() ndarray[source]

Get the signal’s current value

reset(**kwargs) None[source]

Reset signal to a neutral state

uLFP_threshold: Quantity

Threshold, in microvolts, above which the uLFP for a single spike is guaranteed to be considered, by default 1e-3. This determines the buffer length of past spikes, since the uLFP from a long-past spike becomes negligible and is ignored.

cleo.ephys.linear_shank_coords(array_length: Quantity, channel_count: int, start_location: Quantity = array([0., 0., 0.]) * metre, direction: Tuple[float, float, float] = (0, 0, 1)) Quantity[source]

Generate coordinates in a linear pattern

Parameters:
  • array_length (Quantity) – Distance from the first to the last contact (with a Brian unit)

  • channel_count (int) – Number of coordinates to generate, i.e. electrode contacts

  • start_location (Quantity, optional) – x, y, z coordinate (with unit) for the start of the electrode array, by default (0, 0, 0)*mm

  • direction (Tuple[float, float, float], optional) – x, y, z vector indicating the direction in which the array extends, by default (0, 0, 1), meaning pointing straight down

Returns:

channel_count x 3 array of coordinates, where the 3 columns represent x, y, and z

Return type:

Quantity

cleo.ephys.poly2_shank_coords(array_length: Quantity, channel_count: int, intercol_space: Quantity, start_location: Quantity = array([0., 0., 0.]) * metre, direction: Tuple[float, float, float] = (0, 0, 1)) Quantity[source]

Generate NeuroNexus-style Poly2 array coordinates

Poly2 refers to 2 parallel columns with staggered contacts. See https://www.neuronexus.com/products/electrode-arrays/up-to-15-mm-depth for more detail.

Parameters:
  • array_length (Quantity) – Length from the beginning to the end of the two-column array, as measured in the center

  • channel_count (int) – Total (not per-column) number of coordinates (recording contacts) desired

  • intercol_space (Quantity) – Distance between columns (with Brian unit)

  • start_location (Quantity, optional) – Where to place the beginning of the array, by default (0, 0, 0)*mm

  • direction (Tuple[float, float, float], optional) – x, y, z vector indicating the direction in which the two columns extend; by default (0, 0, 1), meaning straight down.

Returns:

channel_count x 3 array of coordinates, where the 3 columns represent x, y, and z

Return type:

Quantity

cleo.ephys.poly3_shank_coords(array_length: Quantity, channel_count: int, intercol_space: Quantity, start_location: Quantity = array([0., 0., 0.]) * metre, direction: Tuple[float, float, float] = (0, 0, 1)) Quantity[source]

Generate NeuroNexus Poly3-style array coordinates

Poly3 refers to three parallel columns of electrodes. The middle column will be longest if the channel count isn’t divisible by three and the side columns will be centered vertically with respect to the middle.

Parameters:
  • array_length (Quantity) – Length from beginning to end of the array as measured along the center column

  • channel_count (int) – Total (not per-column) number of coordinates to generate (i.e., electrode contacts)

  • intercol_space (Quantity) – Spacing between columns, with Brian unit

  • start_location (Quantity, optional) – Location of beginning of the array, that is, the first contact in the center column, by default (0, 0, 0)*mm

  • direction (Tuple[float, float, float], optional) – x, y, z vector indicating the direction along which the array extends, by default (0, 0, 1), meaning straight down

Returns:

channel_count x 3 array of coordinates, where the 3 columns represent x, y, and z

Return type:

Quantity

cleo.ephys.tetrode_shank_coords(array_length: Quantity, tetrode_count: int, start_location: Quantity = array([0., 0., 0.]) * metre, direction: Tuple[float, float, float] = (0, 0, 1), tetrode_width: Quantity = 25. * umetre) Quantity[source]

Generate coordinates for a linear array of tetrodes

See https://www.neuronexus.com/products/electrode-arrays/up-to-15-mm-depth to visualize NeuroNexus-style arrays.

Parameters:
  • array_length (Quantity) – Distance from the center of the first tetrode to the last (with a Brian unit)

  • tetrode_count (int) – Number of tetrodes desired

  • start_location (Quantity, optional) – Center location of the first tetrode in the array, by default (0, 0, 0)*mm

  • direction (Tuple[float, float, float], optional) – x, y, z vector determining the direction in which the linear array extends, by default (0, 0, 1), meaning straight down.

  • tetrode_width (Quantity, optional) – Distance between contacts in a single tetrode. Not the diagonal distance, but the length of one side of the square. By default 25*umeter, as in NeuroNexus probes.

Returns:

(tetrode_count*4) x 3 array of coordinates, where 3 columns represent x, y, and z

Return type:

Quantity

cleo.ephys.tile_coords(coords: Quantity, num_tiles: int, tile_vector: Quantity) Quantity[source]

Tile (repeat) coordinates to produce multi-shank/matrix arrays

Parameters:
  • coords (Quantity) – The n x 3 coordinates array to tile

  • num_tiles (int) – Number of times to tile (repeat) the coordinates. For example, if you are tiling linear shank coordinates to produce multi-shank coordinates, this would be the desired number of shanks

  • tile_vector (Quantity) – x, y, z array with Brian unit determining both the length and direction of the tiling

Returns:

(n * num_tiles) x 3 array of coordinates, where the 3 columns represent x, y, and z

Return type:

Quantity