aeye-lab / pymovements

A python package for processing eye movement data
https://pymovements.readthedocs.io
MIT License
57 stars 11 forks source link

make all arguments in experiment optional #717

Closed dkrako closed 2 months ago

dkrako commented 2 months ago

Description of the problem

Currently there is no way to specify for example only the sampling rate of an experiment without any screen dimensions.

This restriction is artificial and we should allow for all the experiment arguments to be None.

Description of a solution

Both Experiment and Screen should have all arguments optional.

In the Screen class there are several checks that the passed arguments are not zero:

https://github.com/aeye-lab/pymovements/blob/115a9b3febc4796e8952661a39cd6926de4ebb63/src/pymovements/gaze/screen.py#L114-L120

These tests should actually check that the values are greather than zero, so checks.check_is_greater_than_zero() is more adequate here. As the values should be made optional do something similiar as this:

    if width_px is not None:
        checks.check_is_greater_than_zero(width_px, 'width_px')

For the properties like y_max_dva you will also need some additional checks, similar to the checks for distance_cm that are already in place.

Test cases for the Screen class go to tests/unit/gaze/screen_test.py, tests for the Experiment class go to tests/unit/gaze/experiment_test.py.

Minimum acceptance criteria