diff --git a/src/ilabs_streamsync/example_script.py b/src/ilabs_streamsync/example_script.py index b1518f6..e38f35e 100644 --- a/src/ilabs_streamsync/example_script.py +++ b/src/ilabs_streamsync/example_script.py @@ -4,13 +4,13 @@ if __name__ == "__main__": # load an MNE raw file raw = None - # cam1 = "/Users/ashtondoane/VideoSync_NonSubject/sinclair_alexis_audiosync_240110_CAM3.mp4" + cam1 = "/Users/user/VideoSync_NonSubject/sinclair_alexis_audiosync_240110_CAM3.mp4" flux1 = None my_events = [] - # extract_audio_from_video(cam1, "/Users/ashtondoane/VideoSync_NonSubject/output") - ss = StreamSync(None, None) - ss.add_stream("/Users/ashtondoane/VideoSync_NonSubject/output/sinclair_alexis_audiosync_240110_CAM3_16bit.wav", channel=1) + extract_audio_from_video(cam1, "/Users/user/VideoSync_NonSubject/output") + ss = StreamSync(None, None) #Raw type not supported yet + ss.add_stream("/Users/user/VideoSync_NonSubject/output/sinclair_alexis_audiosync_240110_CAM3_16bit.wav", channel=1) ss.plot_sync_pulses(tmin=0.998,tmax=1) # subjects = ["146a", "222b"] diff --git a/src/ilabs_streamsync/streamsync.py b/src/ilabs_streamsync/streamsync.py index f57af6d..16bdf55 100644 --- a/src/ilabs_streamsync/streamsync.py +++ b/src/ilabs_streamsync/streamsync.py @@ -1,6 +1,7 @@ from __future__ import annotations import os +import pathlib import subprocess import matplotlib.pyplot as plt @@ -40,7 +41,7 @@ def add_stream(self, stream, channel=None, events=None): def _extract_data_from_stream(self, stream, channel): """Extracts pulses and raw data from stream provided.""" - ext = os.path.splitext(stream)[1] + ext = pathlib.Path(stream).suffix if ext == ".fif": return self._extract_data__from_raw(stream, channel) if ext == ".wav": @@ -69,7 +70,7 @@ def plot_sync_pulses(self, tmin=0, tmax=float('inf')): tt = np.arange(npts) / stream[1] idx = np.where((tt>=tmin) & (tt