Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
test_gonogo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laura Rodríguez
test_gonogo
Commits
557470ce
Commit
557470ce
authored
Jun 06, 2025
by
Laura Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
6jun
parent
b27c8826
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
17 deletions
+32
-17
cuentas.py
+7
-0
test_gonogo.py
+25
-17
No files found.
cuentas.py
0 → 100644
View file @
557470ce
costo
=
100
impuesto
=
16
def
calcular_total
(
costo
,
impuesto
):
total
=
costo
+
impuesto
return
total
\ No newline at end of file
test_gonogo.py
View file @
557470ce
...
...
@@ -2,6 +2,7 @@ import sys
import
random
import
time
from
matplotlib.pyplot
import
margins
from
numpy
import
disp
import
pygame
from
PyQt6.QtWidgets
import
QApplication
,
QWidget
,
QVBoxLayout
,
QPushButton
,
QLabel
,
QMessageBox
from
PyQt6.QtCore
import
Qt
...
...
@@ -20,8 +21,10 @@ from PyQt6.QtWidgets import (
from
PyQt6.QtGui
import
QFont
from
PyQt6.QtCore
import
Qt
# ============ FUNCIÓN DE CALIBRACIÓN ============
def
calibrate_tobii
(
self
):
try
:
print
(
"Buscando dispositivo..."
)
found_eyes
=
tr
.
find_all_eyetrackers
()
...
...
@@ -45,17 +48,19 @@ def calibrate_tobii(self):
print
(
"Calibración completada."
)
# self.tracker.close()
# disp.close()
self
.
disp
.
close
()
#cierro display
return
True
except
Exception
as
e
:
print
(
f
"Error durante calibración: {e}"
)
return
False
# ============ TEST GO/NOGO ======================
def
run_gonogo_test
(
self
):
pygame
.
init
()
# self.disp = libscreen.Display(bgcolor=(0, 0, 0))
# self.test_window.disp = self.disp
self
.
disp
=
libscreen
.
Display
(
bgcolor
=
(
0
,
0
,
0
))
#abro display de nuevo
# self.tracker = eyetracker.EyeTracker(self.disp)
log
=
liblog
.
Logfile
()
log
.
write
([
"trialnr"
,
"trialtype"
,
"targetside"
,
"gaze_endpos"
,
"latency"
,
"correct"
])
...
...
@@ -178,13 +183,6 @@ def run_gonogo_test(self):
# try:
t1
,
startpos
=
self
.
tracker
.
wait_for_saccade_start
()
endtime
,
startpos
,
endpos
=
self
.
tracker
.
wait_for_saccade_end
()
# except Exception:
# print("La estoy liando")
# t1 = pygame.time.get_ticks()
# endtime = pygame.time.get_ticks()
# endpos = constants.DISPSIZE[0]/2 # o (SCREEN_WIDTH//2, SCREEN_HEIGHT//2), posición central para 'NoGo'
latency
=
(
t1
-
t0
)
/
1000
...
...
@@ -197,22 +195,32 @@ def run_gonogo_test(self):
if
trialtype
==
'PS'
:
correct
=
int
(
(
targetside
==
'left'
and
endpos
[
0
]
<=
constants
.
DISPSIZE
[
0
]
/
2
)
or
(
targetside
==
'right'
and
endpos
[
0
]
>=
constants
.
DISPSIZE
[
0
]
/
2
)
(
targetside
==
'left'
and
endpos
[
0
]
<=
constants
.
DISPSIZE
[
0
]
/
2
)
or
(
targetside
==
'right'
and
endpos
[
0
]
>=
constants
.
DISPSIZE
[
0
]
/
2
)
)
print
(
correct
)
elif
trialtype
==
'AS'
:
correct
=
int
(
(
targetside
==
'left'
and
endpos
[
0
]
>=
constants
.
DISPSIZE
[
0
]
/
2
)
or
(
targetside
==
'right'
and
endpos
[
0
]
<=
constants
.
DISPSIZE
[
0
]
/
2
)
(
targetside
==
'left'
and
endpos
[
0
]
>=
constants
.
DISPSIZE
[
0
]
/
2
)
or
(
targetside
==
'right'
and
endpos
[
0
]
<=
constants
.
DISPSIZE
[
0
]
/
2
)
)
print
(
correct
)
elif
trialtype
==
'NoGo'
:
correct
=
int
(
constants
.
DISPSIZE
[
0
]
/
2
<
endpos
[
0
]
<=
constants
.
DISPSIZE
[
0
]
/
2
)
# En NoGo no debe haber movimiento ocular (sacada)
try
:
# Espera hasta 900 ms para detectar el inicio de una sacada
t1
,
_
=
self
.
tracker
.
wait_for_saccade_start
(
latency
=
200
)
correct
=
0
# Si hay una sacada, se considera incorrecto
latency
=
(
t1
-
t0
)
/
1000
# Calcula la latencia en segundos
print
(
"Incorrecto"
)
except
Exception
:
# Si no se detecta ninguna sacada en ese tiempo, se considera correcto
correct
=
1
latency
=
0
# No hay latencia porque no hubo movimiento
print
(
"Correcto"
)
if
correct
>=
0
:
dualstim_screen
.
clear
(
colour
=
(
0
,
0
,
0
))
self
.
disp
.
show
()
self
.
disp
.
fill
(
feedbackscreens
[
correct
])
self
.
disp
.
show
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment