| import csv |
|
|
| def analyze_gaze_data(csv_file): |
| inconsistent_data = [] |
| irregular_blinks = [] |
|
|
| with open(csv_file, 'r') as csvfile: |
| csv_reader = csv.reader(csvfile) |
| next(csv_reader) |
|
|
| for row in csv_reader: |
| frame_count, gaze_direction, left_pupil, right_pupil = row |
| |
| |
| if gaze_direction != "Blinking": |
| if left_pupil == "(None, None)" or right_pupil == "(None, None)": |
| inconsistent_data.append(frame_count) |
| |
| |
| if gaze_direction == "Blinking": |
| irregular_blinks.append(frame_count) |
| |
| return inconsistent_data, irregular_blinks |
|
|
| def main(): |
| csv_file = 'fake_gaze_data.csv' |
| inconsistent_data, irregular_blinks = analyze_gaze_data(csv_file) |
|
|
| print("Inconsistent eye movement with pupil coordinates detected in frames:", inconsistent_data) |
| print("Irregular blinks detected in frames:", irregular_blinks) |
|
|
| if __name__ == "__main__": |
| main() |
|
|