Skip to content

Instantly share code, notes, and snippets.

@papr
Created July 10, 2020 08:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save papr/079a520a1f2a31b1b73963feb7037995 to your computer and use it in GitHub Desktop.
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.
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