PyTrack
PyTrack copied to clipboard
Fix IndexError when data has a single blink occurring at the start of the sequence
Previously, if the data contained only one blink, and the blink occured at the start of the sequence (ie. pupil size is -1 for first index), blink onset would be empty, but length_blinks would be greater than zero because blink offset would not be empty. This would cause an IndexError when attempting to access blink_onset[0]. This change adds a guard clause to handle this edge case and prevent the error.