-
Notifications
You must be signed in to change notification settings - Fork 16
Need some advice #53
Description
Hello,
First of all, I'd like to thank you for all your hard work on this script. I wanted to get your advice on the final adjustments to the script and some of the difficulties encountered when using it.
- As far as I know, the script doesn't provide the option of calculating the median of all fixation and saccade points. I have tried to include this portion by relying on the input and output ocular coordinates of each ocular event: (start_x, start_y, end_x, end_y) :
Create an instance of the EyegazeClassifier class
classifier = EyegazeClassifier(px2deg=px2deg, sampling_rate=120.0, pursuit_velthresh=1000)
all_events = [] # Unique list to store all events
for trial, trial_data in data_maison_result.groupby('trial'):
trial_data = trial_data.sort_values('time').reset_index(drop=True)
preprocessed_data_maison = classifier.preproc(trial_data.drop('trial', axis=1), savgol_length=0.025)
events = classifier(preprocessed_data_maison)
for event in events:
event['trial'] = trial
# Find start/end indices
start_mask = (
(preprocessed_data_maison['x'] == event['start_x']) &
(preprocessed_data_maison['y'] == event['start_y'])
)
end_mask = (
(preprocessed_data_maison['x'] == event['end_x']) &
(preprocessed_data_maison['y'] == event['end_y'])
)
start_indices = np.where(start_mask)[0]
end_indices = np.where(end_mask)[0]
if len(start_indices) == 0 or len(end_indices) == 0:
print(f"Warning: Coordinates not found for event {event}")
continue
start_idx = start_indices[0]
end_idx = end_indices[-1]
fixation_data = preprocessed_data_maison[start_idx:end_idx+1]
event['median_x'] = np.median(fixation_data['x'])
event['median_y'] = np.median(fixation_data['y'])
event['event_duration'] = (event['end_time'] - event['start_time']) * 1000
all_events.append(event) # Add the event to the unique list
Create a DataFrame from all the events
events_data_maison_result = pd.DataFrame(all_events)
Calculating the median of the x and y coordinates from the timestamps proved (start_time; end_time) imprecise for my purposes.
- For one of my subjects, with frequent data loss (every one or two entries, with a 120Hz sampling rate) Remodnav seems to delete almost all the data after the pre-processing stage. I have not been able to solve this problem by decreasing the parameters “min-blink-duration”, “dilate-nan”, “median-filter-length”, “min-saccade_duration”, or increasing the parameter “noise_factor”. Finally, my savgol-lenght is set to 0.025 (120 Hz eye-tracking). Do you have any other solutions for me?
- Finally, even for subjects with little data loss, I get a few fixations below 50 ms (far from the minimum threshold of fixations found in the literature 80-100 ms). I don't know whether this is due to poor management of the algorithm's parameters or to the characteristics of my task (rapid comparison between two visual scenes to identify a difference, with one scene at the top and one at the bottom).
Thank you for taking the time to reply, in the hope that it will help optimize the script or help other users.


