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 RMS

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

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

# 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]

Example 2: Find low frequency PSD of LFP signal

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

from brainbox.ephys_plots import image_lfp_spectrum_plot

data, fig, ax = image_lfp_spectrum_plot(lf_psd['power'], lf_psd['freqs'], display=True)

Other relevant examples