Pymovements Questions: Attaching trial info & Blink filtering
Good morning, I hope this email finds you well. I have been using pymovements and enjoying it greatly, thanks for your work! As a coding beginner the docs have been very helpful but after going through them, I cannot seem to figure out two things. 1. I am struggling with attaching my trial info to my samples and fixations data as extra columns. I tried capturing it with custom_read_kwargs as well as using the trial columns but it does not seem to work. For reference, I am analysing Eyelink ASC files and my trial info is captured like this:
Generic Eyelink MSG, then the timestamp, then the message
MSG 1419128 TrialId_Overall Practice: 1 - this contains which block type it is, can be practice, experiment or extra, as well as the trial number within that block
MSG 1419129 ImageNumber: 4 - contains presented image for the trial
MSG 1431431 203 - contains event code (here 203) that represents image quality
2. Moreover, I was wondering what the easiest way is to filter out blinks, preferably with a blink padding. I noticed that some blink metrics are stored within the metadata but I cannot find the individual blinks being stored anywhere. I would be very greatful if you could give me some tips on how to do these things with pymovements (if possible!). Thanks a lot! Best, Sofia
Hi Sofia, thank you for reaching out! Great to see people using pymovements!
1. I am struggling with attaching my trial info to my samples and fixations data as extra columns. I tried capturing it with custom_read_kwargs as well as using the trial columns but it does not seem to work.
For reference, I am analysing Eyelink ASC files and my trial info is captured like this:
Generic Eyelink MSG, then the timestamp, then the message
MSG 1419128 TrialId_Overall Practice: 1 - this contains which block type it is, can be practice, experiment or extra, as well as the trial number within that block
MSG 1419129 ImageNumber: 4 - contains presented image for the trial
MSG 1431431 203 - contains event code (here 203) that represents image quality
Parsing trial info is currently not well documented. I plan to add some more documentation in the next weeks to clarify more of the details. Regarding your example messages I would recommend this to use for the `patterns` argument when calling the `from_asc()` function: patterns = [ r'TrialId_Overall\s+(?P<block_type>\w+):\s+(?P<trial_id>\d+), r'ImageNumber:\s+(?P<image_id>\d+), r'(?P<event_code>\d+), ] For custom_read_kwargs in the DatasetDefinition this would be: custom_read_kwargs = { 'patterns': [ r'TrialId_Overall\s+(?P<block_type>\w+):\s+(?P<trial_id>\d+), r'ImageNumber:\s+(?P<image_id>\d+), r'(?P<event_code>\d+), ], } These block_type, trial_id, image_id and event_code will then appear as columns in Gaze.samples and Gaze.events. For more info on regular expressions in python see this page: https://docs.python.org/3/howto/regex.html
*2. Moreover, I was wondering what the easiest way is to filter out blinks, preferably with a blink padding. *I noticed that some blink metrics are stored within the metadata but I cannot find the individual blinks being stored anywhere.
You will need to set `events` to `True` in `from_asc()`/`custom_read_kwargs`. The blinks are then placed in `Gaze.events`, and will have the value `blink_eyelink` in the `name` column. If you just want to get the blinks, you can use `Gaze.events.blinks`. In case you want to set data in `Gaze.samples` to `null` during timesteps that are marked as blinks in `Gaze.events`, this is currently unfortunately not directly possible although we plan to implement this in the future. You can follow this issue if you want updates on this: https://github.com/aeye-lab/pymovements/issues/971 I hope this clarifies some of your issues. Best regards, Daniel On 9/17/25 10:31, Sofia Karageorgiou via pymovements wrote:
Good morning,
I hope this email finds you well. I have been using pymovements and enjoying it greatly, thanks for your work! As a coding beginner the docs have been very helpful but after going through them, I cannot seem to figure out two things.
I would be very greatful if you could give me some tips on how to do these things with pymovements (if possible!). Thanks a lot!
Best, Sofia
_______________________________________________ pymovements mailing list -- pymovements@python.org To unsubscribe send an email to pymovements-leave@python.org https://mail.python.org/mailman3//lists/pymovements.python.org Member address: daniel@krakowczyk.tech
participants (2)
-
Daniel Krakowczyk -
Sofia Karageorgiou