Loading Ephys Data (AP and LFP band)

Electrophysiology features computed on AP and LFP band of raw ephys data

Relevant Alf objects

  • ephysTimeRmsAP

  • ephysSpectralDensityAP

  • ephysTimeRmsLF

  • ephysSpectralDensityLF

Loading

Loading RMS

[2]:
from one.api import ONE
one = ONE()
pid = 'da8dfec1-d265-44e8-84ce-6ae9c109b8bd'
eid, name = one.pid2eid(pid)

ap_rms = one.load_object(eid, f'ephysTimeRmsAP', collection=f'raw_ephys_data/{name}')

Loading Spectral Density

[3]:
lf_psd = one.load_object(eid, f'ephysSpectralDensityLF', collection=f'raw_ephys_data/{name}')

More Details

Useful modules

Exploring Ephys Data

Example 1: Removing non electophysiological channels

[4]:
# The objects ephysTimeRms and ephysSpectralDensity contain data for all channels on the probe including the channel used
# for syncing

# The indices of the ephys channels can be found using the following
from neuropixel import trace_header
inds = trace_header()['ind']

lf_psd['power'] = lf_psd['power'][:, inds]
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/one/alf/files.py:10: FutureWarning: `one.alf.files` will be removed in version 3.0. Use `one.alf.path` instead.
  warnings.warn(

Example 2: Find low frequency PSD of LFP signal

[5]:
import numpy as np

# Define frequency range of interest 8-20 Hz
freq_range = [8, 20]

freq_idx = np.bitwise_and(lf_psd['freqs'] >= freq_range[0], lf_psd['freqs'] <= freq_range[1])

lfp_dB = 10 * np.log(lf_psd['power'][freq_idx, :])

Example 3: Plot LFP PSD spectrum

[6]:
from brainbox.ephys_plots import image_lfp_spectrum_plot

data, fig, ax = image_lfp_spectrum_plot(lf_psd['power'], lf_psd['freqs'], display=True)
../_images/notebooks_external_loading_ephys_data_17_0.png

Other relevant examples

  • COMING SOON