Consecutive spikes within 1ms in the brain observatory electrophysiology data

Hi all,

I’m interested in working with the brain observatory neuropixel data. I followed this quickstart tutorial and started exploring the data.
Looking at single units spike times I noticed that in all sessions some units have consecutive spikes that are less than one millisecond from each other. I was wondering if this means that I have a mistake in the way I process the data.
Here is an example of my code:

import os
import numpy as np
import pandas as pd
from allensdk.brain_observatory.ecephys.ecephys_project_cache import EcephysProjectCache

session_id = 719161530 
unit_id = 950951872

manifest_path = os.path.join('ecephys_cache_dir/', "manifest.json")
cache = EcephysProjectCache.from_warehouse(manifest=manifest_path)
session = cache.get_session_data(session_id)
presentationwise_spike_times = session.presentationwise_spike_times() 
spike_times_df = pd.DataFrame(presentationwise_spike_times['unit_id']).reset_index()
spike_times = spike_times_df[spike_times_df['unit_id'] == unit_id]['spike_time'].to_numpy()
spike_times_diff = np.diff(spike_times)

print(f'unit {unit_id} in session {session_id} has {(spike_times_diff < 1e-3).sum()} spike pairs within 1ms')

Thanks,
Yoni

Hi Yoni – you haven’t made any mistakes…sub-millisecond inter-spike intervals are expected in this dataset. Unlike with some methods for spike detection/sorting, Kilosort doesn’t impose an absolute refractory period. So there can be consecutive spike times that are separated by very short time intervals.

We use the isi_violations metric to quantify the fraction of spikes for a given unit that are less than 1.5 ms away from their neighbors – we assume that these are likely spikes from other neurons that have contaminated the spike train. By default, the AllenSDK will only return units with an isi_violations score less than 0.5. But if you’d like to impose a stricter threshold, you can filter the units table with the value of your choice. Going all the way down to 0 will ensure you’re only analyzing units with no contamination, but this will greatly decrease the overall number of available units. The appropriate threshold will depend on the type of analysis you’re doing – I recommend reading through this tutorial to learn more about the various quality metrics that are available.