psychoinformatics-de / remodnav

Robust Eye Movement Detection for Natural Viewing
Other
61 stars 16 forks source link

Improve input validation #29

Closed adswa closed 3 years ago

adswa commented 3 years ago

Warn if a parameter results in values lower than a single sample

This may help a user to prevent cases where a combination of parameters and sampling rate would result in events shorter than a sample that would not be automatically discarded as implausible. This was the case in #28, where a user reported errors with remodnav on data acquired with a sampling rate of 60Hz. Because the minimal saccade duration of 0.01 seconds was shorter than a single sample, 'saccade' events of zero length were passed to numpy functions instead of skipped, which then resulted in unexpected crashed.

While the log message that would be issues with such a parametrization would not prevent errors, it can help users to resolve them. This is less intrusive than replacing the values, which may have a solid reason for existence and do not in all cases result in crashes.

Here is how a log message looks like:

remodnav input_Data\(1\).txt out.tsv 0.025772 60 --savgol-length=0.16 --noise-factor=3 --lowpass-cutoff-freq=10 --pursuit-velthresh=5                            
WARNING: At the provided sampling rate of 60.0, the timeframe for the parameter 'min-saccade-duration' would be lower than a single sample (0.6 samples). Consider increasing the parameter value to prevent errors.
adswa commented 3 years ago

Restarting the tests after merging the CI fixes from #32

codecov-commenter commented 3 years ago

Codecov Report

Merging #29 (c7d872d) into master (53a950e) will increase coverage by 0.62%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #29      +/-   ##
==========================================
+ Coverage   86.26%   86.88%   +0.62%     
==========================================
  Files           8        8              
  Lines         706      709       +3     
==========================================
+ Hits          609      616       +7     
+ Misses         97       93       -4     
Impacted Files Coverage Δ
remodnav/clf.py 97.82% <100.00%> (+0.01%) :arrow_up:
remodnav/tests/test_detect.py 98.61% <0.00%> (+5.55%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 53a950e...c7d872d. Read the comment docs.

adswa commented 3 years ago

tests pass, let's merge