# Mismatch reaction times Mac and Windows ? (Negative RT)

**URL:** <https://discourse.psychopy.org/t/mismatch-reaction-times-mac-and-windows-negative-rt/30244>\
**Category:** Coding\
**Created:** [August 1, 2022, 5:39pm UTC](https://discourse.psychopy.org/t/mismatch-reaction-times-mac-and-windows-negative-rt/30244 "2022-08-01T17:39:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lysianne](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lysianne](https://discourse.psychopy.org/u/Lysianne)\
**Post date:** [August 1, 2022, 5:39pm UTC](https://discourse.psychopy.org/t/mismatch-reaction-times-mac-and-windows-negative-rt/30244/1 "2022-08-01T17:39:48Z")

</div>

Hi you all,

Here is something I do not understand:  
I have an experiment coded and tested with a Mac laptop on Psychopy 2021.2.3  
It records all the reaction time as wanted and if I respond too late or too early, it saved them as Nan (which is what I want)

However, when I ran the same code with a windows computer it stores some rt as negative. Do you know where this is coming from ??

If that helps relevant part of my script below:

Best.

Response.getKeys(clear = True)  
if Response.status == NOT\_STARTED and tThisFlip \> 1-frameTolerance:  
# keep track of start time/frame for later  
Response.frameNStart = frameN # exact frame index  
Response.tStart = t # local t and not account for scr refresh  
Response.tStartRefresh = tThisFlipGlobal # on global time  
win.timeOnFlip(Response, ‘tStartRefresh’) # time at next scr refresh  
Response.status = STARTED  
# keyboard checking is just starting  
waitOnFlip = True  
win.callOnFlip(Response.clock.reset) # t=0 on next screen flip  
if Response.status == STARTED:  
# is it time to stop? (based on global clock, using actual start)  
if tThisFlipGlobal \> Response.tStartRefresh + current\_jitter -frameTolerance:  
# keep track of stop time/frame for later  
Response.tStop = t # not accounting for scr refresh  
Response.frameNStop = frameN # exact frame index  
win.timeOnFlip(Response, ‘tStopRefresh’) # time at next scr refresh  
win.flip()  
Response.status = FINISHED  
if Response.status == STARTED and not waitOnFlip:  
theseKeys = Response.getKeys(keyList=[‘1’, ‘3’], waitRelease=False)  
\_Response\_allKeys.extend(theseKeys)  
if len(\_Response\_allKeys):  
Response.keys = \_Response\_allKeys[0].name # just the first key pressed  
Response.rt = \_Response\_allKeys[0].rt

```
            # was this correct?
            if (Response.keys == str(corrAns)) or (Response.keys == corrAns):
                Response.corr = 1
            else:
                Response.corr = 0

```

---

<div class="post-metadata">

**Author:** ![wen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wen/32/30795_2.png) [@wen](https://discourse.psychopy.org/u/wen)\
**Post date:** [August 3, 2022, 1:07am UTC](https://discourse.psychopy.org/t/mismatch-reaction-times-mac-and-windows-negative-rt/30244/2 "2022-08-03T01:07:16Z")

</div>

Do you define corrAns inside the key, as shown below：

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/4/c/4c31562ce7e300507a6e99349a610778f4e0bdae.png)

---

<div class="post-metadata">

**Author:** ![Lysianne](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lysianne](https://discourse.psychopy.org/u/Lysianne)\
**Post date:** [August 3, 2022, 2:40am UTC](https://discourse.psychopy.org/t/mismatch-reaction-times-mac-and-windows-negative-rt/30244/3 "2022-08-03T02:40:57Z")

</div>

Yes, initially That’s what we have.  
But we are not using the builder now only the coder

That being said we have no problem with accuracy , only this negative RT time to time [with windows computer and psychopy 2020.2.10] while I never have negative with my Mac and psychopy 2021.2.3

So I’m confused and I don’t know how to fix it given that even cleaning the buffer does not solve it

---

<div class="post-metadata">

**Author:** ![Lysianne](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lysianne](https://discourse.psychopy.org/u/Lysianne)\
**Post date:** [August 3, 2022, 2:51am UTC](https://discourse.psychopy.org/t/mismatch-reaction-times-mac-and-windows-negative-rt/30244/4 "2022-08-03T02:51:18Z")

</div>

maybe it needed that

win.callOnFlip(Response.clearEvents, eventType=‘keyboard’)

instead of

Response.getKeys(clear = True)

will test it and let you know

---

<div class="post-metadata">

**Author:** ![Lysianne](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lysianne](https://discourse.psychopy.org/u/Lysianne)\
**Post date:** [August 3, 2022, 6:31pm UTC](https://discourse.psychopy.org/t/mismatch-reaction-times-mac-and-windows-negative-rt/30244/5 "2022-08-03T18:31:31Z")

</div>

oh yes that worked !

so the clear event needed to be on the win flip… now we know 🙂  
Thanks!
