Closed dkrako closed 1 year ago
Patch coverage: 100.00%
and no project coverage change.
Comparison is base (
43908f6
) 100.00% compared to head (cf1e5af
) 100.00%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I have ignored one line for pylint for this error: cell-var-from-loop
caused by these lines: https://github.com/aeye-lab/pymovements/blob/40f85a63bf188e264fc52fff4515ff881e754d44/src/pymovements/gaze/transforms_pl/pix2deg.py#L79-L86
But now I have read a bit further and found this reddit thread: https://www.reddit.com/r/learnpython/comments/kvct0d/pylint_cell_variable_val_defined_in_loop_why/
I toyed around a bit and pylint has actually exposed a bug here I think. I will have to revisit this next week.
Wow pylint really exposed a bug here. I didn't know that was a potential problem in python.
If I understand correctly, the unexpected behavior comes from the delayed creation of the lambda function.
In the previous code snippet component
would then always be the final value (n_components - 1
).
As a very simple example, the output of this is crazy:
>>> multipliers = [lambda x : i * x for i in range(4)]
>>> print([m(2) for m in multipliers])
[6, 6, 6, 6]
This is the fix for the problematic code of my last comment:
with
I would have liked to use functools.partial
, but that way you can't fill the second positional argument and leave the first as positional argument
This PR implements a general
GazeDataFrame.transform()
method which applies any transform method frompymovements.gaze.transforms
.