catalystneuro / IBL-to-nwb

Conversion of IBL data to NWB format.
BSD 3-Clause "New" or "Revised" License
2 stars 4 forks source link

CN TODO: Correct raw timestamps #63

Closed CodyCBakerPhD closed 1 month ago

CodyCBakerPhD commented 2 months ago

SpikeSortingLoader has a method that gives a mapping from frame indices in raw recording to timestamps used for spike sorting, etc.

Maybe Mayo can send explicit code

CodyCBakerPhD commented 1 month ago

@mayofaulkner Would you be so kind as to copy/paste a code segment here showing how to get the synchronized frame to global timestamp mapping?

mayofaulkner commented 1 month ago

Here is a snippet that shows how you can get the raw data timestamps

from brainbox.io.one import SpikeSortingLoader
from one.api import ONE
import numpy as np
one = ONE()
ssl = SpikeSortingLoader(pid=pid, one=one)
sr_ap = ssl.raw_electrophysiology(band="ap", stream=True)
sr_times = ssl.samples2times(np.arange(0, sr_ap.ns), direction='forward')