# Time vector for spike waveform averages in Brain Observatory datasets

**URL:** <https://community.brain-map.org/t/time-vector-for-spike-waveform-averages-in-brain-observatory-datasets/2355>\
**Category:** Technical\
**Tags:** software, brain-observatory-visual-coding\
**Created:** [May 23, 2023, 6:16pm UTC](https://community.brain-map.org/t/time-vector-for-spike-waveform-averages-in-brain-observatory-datasets/2355 "2023-05-23T18:16:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![stankov](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@stankov](https://community.brain-map.org/u/stankov)\
**Post date:** [May 23, 2023, 6:16pm UTC](https://community.brain-map.org/t/time-vector-for-spike-waveform-averages-in-brain-observatory-datasets/2355/1 "2023-05-23T18:16:53Z")

</div>

Hi everyone. Does anyone know the time vector concerning the average waveforms that out made by Kilosort2 for the Brain Observatory datasets for the visual and resting state animals (~58 animals in total)? Also is there cell type information concerning all those units? Thanks, Atanas

---

<div class="post-metadata">

**Author:** ![joshs](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/joshs/32/8_2.png) [@joshs](https://community.brain-map.org/u/joshs)\
**Post date:** [May 23, 2023, 11:26pm UTC](https://community.brain-map.org/t/time-vector-for-spike-waveform-averages-in-brain-observatory-datasets/2355/2 "2023-05-23T23:26:44Z")

</div>

The time vector for the waveforms is shown in this [example notebook](https://allensdk.readthedocs.io/en/latest/_static/examples/nb/ecephys_session.html#Waveforms) (cells 30 and 31). The total duration of each waveform is around 2.7 ms.

We haven’t included explicit cell type information in this dataset. To classify cells based on the results of the optotagging stimulus run at the end of each session, you can follow the steps in [this notebook](https://allensdk.readthedocs.io/en/latest/_static/examples/nb/ecephys_optotagging.html). This can be used to identify Pvalb, Sst, or Vip interneurons in different sessions.

---

<div class="post-metadata">

**Author:** ![stankov](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@stankov](https://community.brain-map.org/u/stankov)\
**Post date:** [May 24, 2023, 12:39am UTC](https://community.brain-map.org/t/time-vector-for-spike-waveform-averages-in-brain-observatory-datasets/2355/3 "2023-05-24T00:39:41Z")

</div>

Hello thank you for the quick reply! I was wondering when the spike sorter typically demarcates zero for when the unit fired (usually trough min)?

That’s very helpful for the cell labels! Thanks again.

---

<div class="post-metadata">

**Author:** ![stankov](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@stankov](https://community.brain-map.org/u/stankov)\
**Post date:** [May 24, 2023, 1:04am UTC](https://community.brain-map.org/t/time-vector-for-spike-waveform-averages-in-brain-observatory-datasets/2355/4 "2023-05-24T01:04:53Z")

</div>

Sorry, I had another question. Is any “noise cluster” information available like spike times of rejected templates and/or templates marked as MUAs.

---

<div class="post-metadata">

**Author:** ![joshs](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/joshs/32/8_2.png) [@joshs](https://community.brain-map.org/u/joshs)\
**Post date:** [May 24, 2023, 6:57pm UTC](https://community.brain-map.org/t/time-vector-for-spike-waveform-averages-in-brain-observatory-datasets/2355/5 "2023-05-24T18:57:24Z")

</div>

I believe Kilosort aligns timestamps to the trough minimum, which occurs 20 samples after the start of the spike waveform.

The spike trains for all “noise” units are available in the NWB files for this dataset, but they are hidden by default if you’re using the AllenSDK. To access them, you’ll have to set `filter_by_validity = False` when creating the `EcephysSession` object.

We don’t classify units as MUA, since there’s not an obvious quality threshold that separates multi-unit from single-unit activity. For more info on the quality metrics we use, you can check out [this tutorial](https://allensdk.readthedocs.io/en/latest/_static/examples/nb/ecephys_quality_metrics.html).

---

<div class="post-metadata">

**Author:** ![stankov](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@stankov](https://community.brain-map.org/u/stankov)\
**Post date:** [May 24, 2023, 8:22pm UTC](https://community.brain-map.org/t/time-vector-for-spike-waveform-averages-in-brain-observatory-datasets/2355/6 "2023-05-24T20:22:12Z")

</div>

Thank you! Are the “noise” units accessible via the MATLAB Brain-Observatory-Toolbox? Asking because I’ve been having good success with MATLAB toolbox with the data downloads. EDIT: grammar

---

<div class="post-metadata">

**Author:** ![joshs](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/joshs/32/8_2.png) [@joshs](https://community.brain-map.org/u/joshs)\
**Post date:** [May 24, 2023, 8:46pm UTC](https://community.brain-map.org/t/time-vector-for-spike-waveform-averages-in-brain-observatory-datasets/2355/7 "2023-05-24T20:46:51Z")

</div>

I’m not sure. If you’re having trouble finding this info via that toolbox, you can always open up the NWB files directly using the [MatNWB](https://neurodatawithoutborders.github.io/matnwb/) library.

---

<div class="post-metadata">

**Author:** ![stankov](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@stankov](https://community.brain-map.org/u/stankov)\
**Post date:** [May 26, 2023, 11:20am UTC](https://community.brain-map.org/t/time-vector-for-spike-waveform-averages-in-brain-observatory-datasets/2355/8 "2023-05-26T11:20:17Z")

</div>

No worries and thank for all the feedback! I think the Allen Institute has used some custom modifications to the NWB files and the MatNWB isn’t working with that yet. I think my workaround will be to download the datasets in parallel with python and just pull the data I need from there using the AllenSDK tools and convert the noisy units to “.mat” files within python. I noticed the optotagging data isn’t yet available via the MATLAB toolbox so I’ll need to pull that with the AllenSDK tools and convert to “.mat” there as well.
