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

ENH: Improvements to start/stop behaviour of Eyetracker Record Components #6457

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

TEParsons
Copy link
Contributor

Attempt to fix the problem identified in #6456

The problem:

  • An EyetrackerRecordComponent set to "Stop only" doesn't have a start time, so was never marked with .status = STARTED
  • Marking it with .status = STARTED calls a property/setter pair which actually starts the eyetracker, this is generally inadvisable as sometimes we want to just tell Builder it's started (i.e. when there's a new Component but not a new device, we want to mark the Component as STARTED but don't want to start the device again)
  • This meant the eyetracker was never stopped so crashed when the experiment finished

The solution(s):

  • Instead of .status = STARTED starting the eyetracker, have the start code in a function called startRecording and call this function explicitly in the Builder code (ditto for stopping the recording)
  • Remove the property/setter so that status returns to being just an attribute for tracking progress in Builder
  • If the component is "Stop only", have the Component set .status = STARTED at the very beginning (which we can now do safely)

Bonus:

  • I noticed that the dollar signs by the start/stop aren't being hidden/shown according to state, so I fixed that while I was in the neighbourhood

@RebeccaHirst
Copy link
Contributor

We have tested this and unfortunately it throws the error message

Traceback (most recent call last):
File "C:\Users\lpykgw\Downloads\hello (1)_lastrun.py", line 935, in
run(
File "C:\Users\lpykgw\Downloads\hello (1)_lastrun.py", line 807, in run
if tThisFlipGlobal > etRecord_3.tStartRefresh + 1.0-frameTolerance:
TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'
################ Experiment ended with exit code 1 [pid:12848] #################

this is because tStartRefresh is never created in the compiled python code

if etRecord_3.status == NOT_STARTED:
            etRecord_3.status = STARTED
        # if etRecord_3 is stopping this frame...
        if etRecord_3.status == STARTED:
            # is it time to stop? (based on global clock, using actual start)
            if tThisFlipGlobal > etRecord_3.tStartRefresh + 1.0-frameTolerance:
                # keep track of stop time/frame for later
                etRecord_3.tStop = t  # not accounting for scr refresh
                etRecord_3.tStopRefresh = tThisFlipGlobal  # on global time
                etRecord_3.frameNStop = frameN  # exact frame index
                # add timestamp to datafile
                thisExp.addData('etRecord_3.stopped', t)
                # update status
                etRecord_3.status = FINISHED
                etRecord_3.stopRecording()

@TEParsons TEParsons reopened this May 13, 2024
@TEParsons
Copy link
Contributor Author

Give it a go now with the new commits :)

@TEParsons TEParsons changed the title BF: Fix EyetrackerRecordComponent's "stop only" function ENH: Improvements to start/stop behaviour of Eyetracker Record Components May 16, 2024
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

Successfully merging this pull request may close these issues.

None yet

2 participants