Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _timeToFirstFrame = win.getFutureFlipTime(clock="now")
- trialClock.reset(-_timeToFirstFrame) # t0 is time of first possible fli
- streams = reposition(streams, level) # Reposition each stimuli to the correct place
- # Iterate over the letters in each stream and display them appropriately
- for letters, T_nearby in trial.stream:
- # get current time
- tThisFlip = win.getFutureFlipTime(clock=trialClock)
- tThisFlipGlobal = win.getFutureFlipTime(clock=None)
- # Check if there is a target in the stream
- T_in_stream = "T" in letters
- if heads_up.status == NOT_STARTED and tThisFlip >= 0.0 - frame_tolerance:
- heads_up.status = STARTED
- heads_up.tStartRefresh = tThisFlipGlobal
- heads_up.tStopRefresh = FOREVER # Arbitrary large number, will be adjusted when the conditions are met
- win.timeOnFlip(heads_up, "tStartRefresh")
- heads_up.setAutoDraw(True)
- if heads_up.status == STARTED:
- if tThisFlipGlobal > heads_up.tStartRefresh + 1 - frame_tolerance:
- heads_up.status = FINISHED
- heads_up.tStopRefresh = tThisFlipGlobal
- win.timeOnFlip(heads_up, "tStopRefresh")
- heads_up.setAutoDraw(False)
- # Display fixation
- if fixation.status == NOT_STARTED and trial.rsvp_stream_count > 1 and tThisFlipGlobal >= heads_up.tStopRefresh - frame_tolerance:
- fixation.status = STARTED
- fixation.tStartRefresh = tThisFlipGlobal
- fixation.setAutoDraw(True)
- win.timeOnFlip(fixation, "tStartRefresh")
- if fixation.status == STARTED:
- if tThisFlipGlobal > fixation.tStartRefresh + 100 - frame_tolerance:
- fixation.status = FINISHED
- win.timeOnFlip(fixation, "tStopRefresh")
- fixation.setAutoDraw(False)
- # Take every letter and assign it to a stimuli in streams. Then display the stimulus
- for j in range(len(letters)):
- # Take the jth stream and assign the jth letter to it
- stream = streams[j]
- stream.text = letters[j]
- if stream.status == NOT_STARTED and tThisFlip >= heads_up.tStopRefresh - frame_tolerance:
- stream.status = STARTED
- stream.tStartRefresh = tThisFlipGlobal
- win.timeOnFlip(stream, "tStartRefresh")
- stream.setAutoDraw(True)
- if stream.status == STARTED:
- if tThisFlipGlobal > stream.tStartRefresh + 0.4 - frame_tolerance: # 24 frames = 400 ms
- stream.status = FINISHED
- win.timeOnFlip(stream, "tStopRefresh")
- stream.setAutoDraw(False)
- if continueRoutine:
- #core.wait(0.4)
- win.flip()
- # Reset stream statuses to NOT_STARTED so they will still display on the next run-through
- for stream in streams:
- if hasattr(stream, 'status'):
- stream.status = NOT_STARTED
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement