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, max_out_of_brain_channels=50)[source]

Subtract mean of channels out of brain to remove noise

Parameters:

lfpnumpy.ndarray

2D array of LFP values (time x channels)

surface_channelint

Surface channel (relative to original probe)

channel_numbersnumpy.ndarray

Channel numbers in ‘lfp’ array (relative to original probe)

max_out_of_brain_channels: int

Rereferencing can sometimes fail for experiments with shallow probe insertions as the uppermost channels are in air and not agar. This places a limit on the number of channels to use for re-referencing.

Returns:

lfp_noise_removednumpy.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

Parameters:

lfpnumpy.ndarray

2D array of LFP values (time x channels)

sampling_frequencyfloat

Sampling frequency in Hz

cutoff_frequencyfloat

Cutoff frequency for highpass filter

filter_orderint

Butterworth filter order

Returns:

lfp_filterednumpy.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

Parameters:

total_channelsint

Number of channels in the original data file

surface_channelint

Index of channel at brain surface

surface_paddingint

Number of channels above surface to save

start_channel_offsetint

First channel to save

channel_strideint

Number of channels to skip in output

channel_ordernp.ndarray

Actual order of LFP channels (needed to account for the bug in NPX extraction)

noisy_channelsnumpy.ndarray

Array indicating noisy channels

remove_noisy_channelsbool

Flag to remove noisy channels

reference_channelsnumpy.ndarray

Array indicating refence channels

remove_referencesbool

Flag to remove reference channels

allensdk.brain_observatory.ecephys.lfp_subsampling.subsampling.subsample_lfp(lfp_raw, selected_channels, subsampling_factor)[source]

Subsamples LFP data

Parameters:

lfp_rawnumpy.ndarray

2D array of LFP values (time x channels)

selected_channelsnumpy.ndarray

Indices of channels to select (spatial subsampling)

downsampling_factorint

Factor by which to subsample in time

Returns:

lfp_subsamplednumpy.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

Parameters:

timestampsnumpy.ndarray

1D array of timestamp values

downsampling_factorint

Factor by which to subsample the timestamps

Returns:

timestamps_subnumpy.ndarray

New 1D array of timestamps