-
Notifications
You must be signed in to change notification settings - Fork 6
Electrophysiology notes
Demetris Roumis edited this page Aug 9, 2023
·
14 revisions
Extracellular electrophysiology, or "ephys", often refers to methods for recording the electrical activity of neurons in the brain through tiny electrodes. This can involve a range of techniques and levels of recording, from single units (inferred individual neurons), through multi-unit activity (grouped spiking from small clusters of neurons), to local field potentials (the average synaptic activity of large numbers of neurons).
- Ephys recording sessions can vary widely in duration, from minutes to hours, or even days in some long-term studies. My recordings were typically between 1-5 hours per session.
- Channel count can vary from single channels in single unit recordings, to hundreds of channels in multi-electrode arrays. The bleeding edge research systems are pushing on the thousands (but still uncommon).
- Typically, experiments are performed on animal models, often rodents, but can also include non-human primates, or in some cases, human patients.
- Passive Recordings: Recordings of spontaneous neuronal activity.
- Evoked Potentials: Neuronal responses to specific, controlled stimuli.
- Behavioral Tasks: Neuronal activity is recorded while the subject performs a specific task, which can be anything from simple movements to complex cognitive tasks.
- Neuromodulation: Includes recordings during electrical or optogenetic stimulation.
- Brain-Machine Interface (BMI): Neural activity is used to control external devices.
- Calcium Imaging: Allows for the visualization of neural activity via calcium dynamics (direct voltage imaging is still in infancy).
- Behavioral Tracking: To correlate neural activity with behavior.
- Optogenetics: For targeted activation or inhibition of specific neurons.
- Intracellular Recordings: For direct recording of membrane potentials.
- The data size in ephys can grow large quickly, especially with high-channel-count recordings and long recording durations. A typical one-hour recording from a 512-channel system sampled at 30 kHz can easily reach more memory than is available on most workstations.
- Typically, voltage data is stored as 16-bit integers and timestamps are 64-bit floats
- Historically, extracellular ephys data was typically stored in binary formats, often with accompanying metadata in separate files or headers. There were other file formats for spike sorted (processed spike id and time) data and extracted (:1000 Hz) LFP data.
- More recently, the field is starting to converge on NWB 2.0 (NWB):
- From open-ephys:
- Advantages:
- Limitations:
- HDF5 files must be closed gracefully, so data may be irrecoverable if the recording software crashes during acquisition.
- The HDF5 C++ library is not thread-safe, so you cannot write to the NWB format from multiple Record Nodes simultaneously.
- From open-ephys:
- Units: Ephys data is typically recorded in microvolts (µV).
- Typical Signal Range: This can vary, but often falls within a range of plus or minus 100 µV. Larger signals may be recorded, particularly during spike events. It really depends on where you are in the brain, noise isolation, and proximity to neuron sources.
- Sampling Rate: Commonly between 10 to 30 kHz for spike data, and around 1 kHz for local field potentials (LFP).
-
Frequency Ranges of interest: From the 30 KHz raw signal.. several signals are often studied:
- Spikes:
- Features waveform snippets at full raw sampling (~30KHz) of action potential (spike) waveforms are used in spike sorting to attribute spikes to specific neurons. Features of the waveform for a given neuron are also helpful in categorizing neuron types.
- When spikes are sorted into neurons, spike times (peak or center of waveform snippet) are usually saved at 1 kHz (1 ms resolution).
- LFP:
- Delta Waves (0.5 - 4 Hz): Delta waves are associated with deep sleep, anesthesia, and some abnormal brain states.
- Theta Waves (4 - 8 Hz): Theta waves are observed during states such as drowsiness, REM sleep, and certain cognitive processes like memory formation and spatial navigation.
- Alpha Waves (8 - 13 Hz): Alpha waves are prominent during relaxed wakefulness, with eyes closed but not asleep. They can be attenuated by opening the eyes or engaging in cognitive tasks.
- Beta Waves (13 - 30 Hz): Beta waves are generally associated with active wakefulness and cognitive processing. They can be further divided into low beta (13 - 20 Hz) and high beta (20 - 30 Hz) ranges.
- Gamma Waves (30 - 100+ Hz): Gamma waves are high-frequency oscillations that are involved in various cognitive functions such as attention, sensory processing, and memory. They can be further divided into low gamma (30 - 70 Hz) and high gamma (70 - 100+ Hz) ranges.
- Sharp wave ripples: SWRs are characterized by several spectral components: a slow (5–15 Hz) sharp-wave, a high-frequency “ripple” oscillation (150–200 Hz), and a slow “gamma” oscillation (20–40 Hz)
- Spikes:
-
Characteristics of the signal that we want to see:
- action potentials (spikes)
- local field potential (LFP)
- noise
-
Characteristics that we want to control:
- sampling rate
- duration
- number of channels/electrodes
- noise level (maybe)
-
Models:
- Neuron Models: Hodgkin-Huxley, integrate-and-fire
- Network Models: Can generate more complex activity by simulating interconnected neurons.
-
Noise:
- sources: thermal noise, electrical interference, and biological variability
- Noise Models: often modeled as Gaussian.
-
Allen Brain Observatory: Offers high-quality ephys and calcium imaging datasets with attempted best practices
- cheatsheet
- Working with Allen data approach is tempting because:
- maintained sdk
- utilizes the neuropixel probes which are pretty cutting edge
- Spike-sorted data and metadata are available via the AllenSDK as Neurodata Without Borders (NWBV 2.0) files which is becoming an increasingly common data format.
- The CEBRA project has code using the Allen data that might be helpful to look at:
- This script seems to provide functionalities to access, process, filter, and transform data. The transformation is specific to the CEBRA project goals because I think the idea behind creating a 'pseudomouse' dataset might be to increase the sample size for statistical analyses or to create a representative dataset that captures general patterns across multiple sessions or animals, without focusing on the idiosyncrasies of individual sessions or mice. This is not a common thing for researchers to do, but just to note a caveat of this script.
- Human cortex using neuropixel probes (~200 units). [paper, data]
- I'm pretty sure that tools such as Brian2, NEURON, NEST, Elephant, NetPyNE, LFPy are focused on simulating the biophysics of neurons and neuronal networks, which might be more detailed and complex than what we are looking for.
- I think I just want traces that mimic the frequency profile of LFP data, with poisson action potentials layered on.
- Laurent Perrinet has scripts for simulating neural motifs, project ongoing
- ViSAPy seems useful but hasn't been maintained.
- MEArec looks really promising.. I will add it as a TODO
- OpenBehavior - Toolboxes for Spike and LFP Analysis
- open-ephys-python-tools: Intended for reading NWB2.0 (and other) data that was recorded with their system (but hopefully also works for most NWB2.0-formatted data)
- Elephant: Python-based. Elephant package analyses all sorts of neurophysiological data: spike trains, LFP, analog signals. The input-output data format is either Neo, Quantity or Numpy array. Has a sister visualization package: Viziphant
- SpikeInterface: A unified Python framework for spike sorting.
- Neo: A package for representing electrophysiology data in Python.
- Open Ephys: An open-source platform for multichannel electrophysiology.
- Brainstorm, Chronux, FieldTrip, gramm, Spike Viewer, SPIKY
- Matplotlib and Seaborn
- Phy: A Python tool specifically for visualizing ephys data.
- Viziphant
- Data Cleaning: Similar to EEG, ephys data often need to be cleaned, including removing noise, handling missing data, and removing artifacts.
- Spike Sorting: This is a key step in ephys analysis, where the raw signals are processed to identify the activity of individual neurons.
- Feature Extraction: Different features of interest, such as spike rate, inter-spike intervals, spectral properties, or covariate properties (e.g. spatial selectivity) are calculated (ideally per neuron).
- Statistical Analysis: Statistical techniques are used to compare neuronal activity across different conditions or groups.
- How should we deal with display electrode-groups like tetrodes, octrodes, etc? They are almost always used together in processing like spike sorting and often only 1 of the electrodes (identified as having good-quality) in such a group is used for LFP analysis. Maybe accordian per group within the raw viewer? alt just display them all and color-code.. This is often the solution for other viz software.