Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

large negative jump in timestamps #1449

Closed
cboulay opened this issue Feb 23, 2019 · 4 comments
Closed

large negative jump in timestamps #1449

cboulay opened this issue Feb 23, 2019 · 4 comments

Comments

@cboulay
Copy link
Contributor

cboulay commented Feb 23, 2019

Some of our data folders are refusing to load in Pupil Player. The printed error is "Could not generate world timestamps from eye timestamps. This is an invalid recording.". This is because we're failing the assertion in player_methods.py at Line 687 that min_ts < max_ts. Our timestamps start really high, then after 1100-1200 samples there is a large jump from ~74701 to ~34.

fname0 = '000\\eye0_timestamps.npy'
fname1 = '000\\eye1_timestamps.npy'
eye_ts0 = np.load(fname0)
eye_ts1 = np.load(fname1)
eye_ts0[1270:1280]
array([7.47012500e+04, 7.47012612e+04, 7.47012836e+04, 7.47012948e+04,
       7.47013060e+04, 7.47013284e+04, 3.39829990e+01, 3.40053990e+01,
       3.40277990e+01, 3.40501990e+01])
eye_ts1[1130:1140]
array([7.47012929e+04, 7.47013153e+04, 7.47013265e+04, 3.39810890e+01,
       3.39922890e+01, 3.40146890e+01, 3.40258890e+01, 3.40706890e+01,
       3.40930890e+01, 3.41154890e+01])

I also have simultaneous LabstreamingLayer recordings.

stream['time_series'][528:532]
Out[55]: 
[["{'topic': 'pupil.0', 'confidence': 0.8238804936408997, 'ellipse': {'center': [365.3705368041992, 326.51734161376953], 'axes': [57.71068572998047, 74.57137298583984], 'angle': 89.38726043701172}, 'diameter': 74.57137298583984, 'norm_pos': [0.5708914637565613, 0.31975553830464676], 'timestamp': 74701.305987, 'method': '2d c++', 'id': 0}"],
 ["{'topic': 'pupil.0', 'confidence': 0.8706846237182617, 'ellipse': {'center': [365.2934265136719, 326.48206329345703], 'axes': [58.15135955810547, 75.40060424804688], 'angle': 88.56385040283203}, 'diameter': 75.40060424804688, 'norm_pos': [0.5707709789276123, 0.3198290348052979], 'timestamp': 74701.328387, 'method': '2d c++', 'id': 0}"],
 ["{'topic': 'pupil.0', 'confidence': 0.9050938487052917, 'ellipse': {'center': [365.1299285888672, 326.54576873779297], 'axes': [58.36911392211914, 75.26219940185547], 'angle': 88.9308090209961}, 'diameter': 75.26219940185547, 'norm_pos': [0.570515513420105, 0.31969631512959795], 'timestamp': 33.982998999999836, 'method': '2d c++', 'id': 0}"],
 ["{'topic': 'pupil.0', 'confidence': 0.9414516687393188, 'ellipse': {'center': [365.0822219848633, 326.2925109863281], 'axes': [58.4393196105957, 75.45659637451172], 'angle': 88.37746429443362}, 'diameter': 75.45659637451172, 'norm_pos': [0.5704409718513489, 0.3202239354451497], 'timestamp': 34.00539900000149, 'method': '2d c++', 'id': 0}"]]

stream['time_stamps'][528:532]
Out[56]: array([74701.344911 , 74701.3616819, 74701.3933302, 74701.4104163])

stream['info']['name']
Out[57]: ['Pupil Python Representation - Eye 0']

It looks like the pupil internal timestamps started off using the same clock that LSL uses, then abruptly switched to something that looks like 'time since start'.

Can I safely modify the timestamps to remove this large step? Do I need to modify eye0_, eye1_, gaze_, and pupil_ or will Pupil Player rewrite the latter 2 as long as I fix the first 2?

How can we stop this from happening in the future?

@papr
Copy link
Contributor

papr commented Mar 18, 2019

@cboulay Sorry for the delayed response. Have you been using hmd-eyes for this recording? Yes, you can readjust the timestamps. If you use offline pupil detection and calibration you will only need to adjust eye0_ and eye1_. If you want to make use of the recorded data, you will have to adjust pupil_ and gaze_, too.

@cboulay
Copy link
Contributor Author

cboulay commented Mar 18, 2019

Hi Pablo. Yes, this is using hmd-eyes.

@papr
Copy link
Contributor

papr commented Mar 20, 2019

As it turns out, Pupil Capture does allow time resets during a recording via Pupil Remote. Hmd-eyes uses this method to synchronize time before each calibration. This will be fixed in the upcoming versions of hmd-eyes and Capture.

Until then, use this script to readjust the eye timestamps: https://gist.github.com/papr/c945076fa0fbea9c679646a335509486

Call fix_negative_time_jumps() and pass the path to your inconsistent recording as string.

Caveats

This script does not adjust your gaze and pupil data. It is recommended to rerun offline pupil detection after running this script.

@papr
Copy link
Contributor

papr commented Jun 10, 2019

@papr papr closed this as completed Jun 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants