allensdk.brain_observatory.ecephys.lfp_subsampling.subsampling module

allensdk.brain_observatory.ecephys.lfp_subsampling.subsampling.remove_lfp_noise(lfp, surface_channel, channel_numbers, channel_max=384, channel_limit=380)[source]

Subtract mean of channels out of brain to remove noise

lfp : numpy.ndarray
2D array of LFP values (time x channels)
surface_channel : int
Surface channel (relative to original probe)
channel_numbers : numpy.ndarray
Channel numbers in ‘lfp’ array (relative to original probe)

Returns:

lfp_noise_removed : numpy.ndarray
New 2D array of LFP values
allensdk.brain_observatory.ecephys.lfp_subsampling.subsampling.remove_lfp_offset(lfp, sampling_frequency, cutoff_frequency, filter_order)[source]

High-pass filters LFP data to remove offset

lfp : numpy.ndarray
2D array of LFP values (time x channels)
sampling_frequency : float
Sampling frequency in Hz
cutoff_frequency : float
Cutoff frequency for highpass filter
filter_order : int
Butterworth filter order

Returns:

lfp_filtered : numpy.ndarray
New 2D array of LFP values
allensdk.brain_observatory.ecephys.lfp_subsampling.subsampling.select_channels(total_channels, surface_channel, surface_padding, start_channel_offset, channel_stride, channel_order, noisy_channels=array([], dtype=float64), remove_noisy_channels=False, reference_channels=array([], dtype=float64), remove_references=False)[source]

Selects a subset of channels for spatial downsampling

total_channels : int
Number of channels in the original data file
surface_channel : int
Index of channel at brain surface
surface_padding : int
Number of channels above surface to save
start_channel_offset : int
First channel to save
channel_stride : int
Number of channels to skip in output
channel_order : np.ndarray
Actual order of LFP channels (needed to account for the bug in NPX extraction)
noisy_channels : numpy.ndarray
Array indicating noisy channels
remove_noisy_channels : bool
Flag to remove noisy channels
reference_channels : numpy.ndarray
Array indicating refence channels
remove_references : bool
Flag to remove reference channels
allensdk.brain_observatory.ecephys.lfp_subsampling.subsampling.subsample_lfp(lfp_raw, selected_channels, subsampling_factor)[source]

Subsamples LFP data

lfp_raw : numpy.ndarray
2D array of LFP values (time x channels)
selected_channels : numpy.ndarray
Indices of channels to select (spatial subsampling)
downsampling_factor : int
Factor by which to subsample in time

Returns:

lfp_subsampled : numpy.ndarray
New 2D array of LFP values
allensdk.brain_observatory.ecephys.lfp_subsampling.subsampling.subsample_timestamps(timestamps, subsampling_factor)[source]

Subsamples an array of timestamps

timestamps : numpy.ndarray
1D array of timestamp values
downsampling_factor : int
Factor by which to subsample the timestamps

Returns:

timestamps_sub : numpy.ndarray
New 1D array of timestamps