Created
July 10, 2020 08:24
-
-
Save papr/079a520a1f2a31b1b73963feb7037995 to your computer and use it in GitHub Desktop.
Example Pupil Capture plugin that publishes custom data and stores it during a recording.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from plugin import Plugin | |
CUSTOM_TOPIC = "custom_topic" | |
class CustomDataExample(Plugin): | |
def recent_events(self, events): | |
custom_datum = { | |
"topic": CUSTOM_TOPIC, | |
"timestamp": self.g_pool.get_timestamp(), # Timestamp in pupil time | |
"custom field": 42, | |
# Further fields can be added here. | |
# Their values should be serializable with msgpack. | |
} | |
events[CUSTOM_TOPIC] = [custom_datum] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment