Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P300 update lsl #266

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/explorepy/stream_processor.py
Expand Up @@ -186,6 +186,17 @@ def _get_sw_marker_time(self):
with lock:
return self._last_packet_timestamp + get_local_time() - self._last_packet_rcv_time

def _estimate_external_marker_time(self, external_time):
"""Estimates a timestamp to be used in software marker

This method gives an estimation of a timestamp relative to Explore internal clock. This timestamp can be used
for generating a software marker.
"""
with lock:
marker_time = self._last_packet_timestamp + external_time - self._last_packet_rcv_time
print('marker time{}'.format(marker_time))
return marker_time

def dispatch(self, topic, packet):
"""Dispatch a packet to subscribers

Expand Down Expand Up @@ -295,7 +306,7 @@ def set_ext_marker(self, time_lsl, marker_string):
"""Set an external marker in the stream"""
logger.info(f"Setting a software marker with code: {marker_string}")

marker = ExternalMarker.create(time_lsl, marker_string)
marker = ExternalMarker.create(self._estimate_external_marker_time(time_lsl), marker_string)
self.process(marker)

def compare_device_info(self, new_device_info):
Expand Down