Conversation
|
@larsoner It looks like circle build is working |
I don't think any should, I think you should make a function to do this. It should probably be a method of
This sounds too messy, as it requires burdening generic press-event code with paradigm-specific checks. A cleaner design is probably to know that there is some interval during which a recalibration can be requested, and press the button then. |
|
@rkmaddox and I were talking about how this might work in an experiment. Perhaps writing |
|
Sounds reasonable to me |
Codecov Report
@@ Coverage Diff @@
## master #359 +/- ##
=========================================
- Coverage 89.07% 88.98% -0.1%
=========================================
Files 44 44
Lines 5682 5717 +35
Branches 917 926 +9
=========================================
+ Hits 5061 5087 +26
- Misses 426 430 +4
- Partials 195 200 +5 |
|
Have not tested this with an actual eyelink connected yet and have not added tests. I've started with what I think the minimum scope of |
|
My feeling is that putting the functions into the base waiting function (which I think is |
|
Ahh, I see what you're saying. Functions like |
|
Yes, Upshot, it should check at the beginning of those functions (but actually doesn't in my test script). Update: calibration checking doesn't work because |
|
Tested with real eyelink and seems to behave |
expyfun/_experiment_controller.py
Outdated
|
|
||
| Notes | ||
| ----- | ||
| See `flip_and_play` for order of operations. Can be called multiple |
There was a problem hiding this comment.
This does not look correct / relevant
expyfun/_eyelink_controller.py
Outdated
| @verbose_dec | ||
| def __init__(self, ec, link='default', fs=1000, verbose=None): | ||
| def __init__(self, ec, link='default', fs=1000, verbose=None, | ||
| calibration_key=['c']): |
There was a problem hiding this comment.
Do not use mutable default arguments. Tuple is immutable so ('c',) is better here
| el._fake_calibration = True | ||
| el.calibrate(beep=False, prompt=False) | ||
| fake_button_press(ec, 'c') | ||
| el.check_recalibrate(prompt=False) |
There was a problem hiding this comment.
Shouldn't you assert that this is True ?
There was a problem hiding this comment.
The test gets hung up on the prompt screen. Could put in a fake_button_press if you want to test the prompt?
There was a problem hiding this comment.
I don't understand. It currently gets stuck, or will get stuck with my suggested addition of an assert in this line preceding the el...?
There was a problem hiding this comment.
Read too quickly, you are correct
drammock
left a comment
There was a problem hiding this comment.
I tried to understand what this does just by reading the docstrings and the code, so I have several docstring suggestions. I haven't tested the code itself.
expyfun/_experiment_controller.py
Outdated
| Parameters | ||
| ---------- | ||
| function : function | None | ||
| The function to call. If ``None``, all the "on every flip" |
There was a problem hiding this comment.
shouldn't this say all the "on every wait"?
expyfun/_eyelink_controller.py
Outdated
| verbose : bool, str, int, or None | ||
| If not None, override default verbose level (see expyfun.verbose). | ||
| calbration_keys : list | ||
| Keys that will trigger recalibration when check_recalibration. |
There was a problem hiding this comment.
can you expand this docstring line a bit? The reference to check_calibration needs context (i.e., it's not a parameter of this constructor, so explain what it is / where it lives)... is it referring to the new check_recalibrate method? (if so, the method name is wrong here)
There was a problem hiding this comment.
also, you say it should be list but you initiate it with a tuple. Will it work with any iterable? if so, say iterable instead of list
expyfun/_eyelink_controller.py
Outdated
| def check_recalibrate(self, keys=None, prompt=True): | ||
| """Compare key buffer to recalibration keys and calibrate if matched. | ||
|
|
||
| This function always uses the keyboard, so is part of abstraction. |
There was a problem hiding this comment.
Not sure I understand ths note.
expyfun/_eyelink_controller.py
Outdated
| Parameters | ||
| ---------- | ||
| keys : list or string | ||
| keys to check if prompt recalibration |
There was a problem hiding this comment.
keys to check against the (set of) key(s) that trigger calibration.
expyfun/_eyelink_controller.py
Outdated
| keys : list or string | ||
| keys to check if prompt recalibration | ||
| prompt : bool | ||
| Whether to show the calibration prompt or not |
There was a problem hiding this comment.
Whether to show the calibration prompt screen before starting the calibration procedure
I'd attempted this before and it was surprisingly messy so guidance/debate is welcome. @larsoner @drammock @rkmaddox
The goal is to be able to re-calibrate during an experiment when a given key is pressed.
Things to consider:
echas the button press info butelneeds to be called -- so which should the function live in? I'd previously gotten it to "work" with the function living inecand importingeltoecafter both were initialized but it was pretty gross._retrieve_keyboard_eventsor_correct_presseswill need to recognize the calibration key.