Skip to content

Commit 2594d66

Browse files
authored
Merge pull request #313 from CAMBI-tech/matrix-always-on
Matrix Grid Always On
2 parents 0e111d2 + 1754215 commit 2594d66

File tree

4 files changed

+25
-34
lines changed

4 files changed

+25
-34
lines changed

bcipy/display/demo/matrix/demo_calibration_matrix.py

+14-29
Original file line numberDiff line numberDiff line change
@@ -40,37 +40,22 @@
4040
task_bar=task_bar,
4141
info=info)
4242

43-
time_target = 2
44-
time_fixation = 2
43+
time_target = 1
44+
time_fixation = 0.5
4545
time_flash = 0.25
4646
timing = [time_target] + [time_fixation] + [time_flash] * 5
4747
colors = ['green', 'lightgray'] + ['white'] * 5
4848
task_buffer = 2
4949

50-
matrix_display.schedule_to(stimuli=['A', '+', 'F', '<', 'A', 'B', 'C'],
51-
timing=timing,
52-
colors=colors)
53-
matrix_display.update_task_bar()
54-
matrix_display.do_inquiry()
55-
core.wait(task_buffer)
56-
57-
matrix_display.schedule_to(stimuli=['B', '+', 'F', '<', 'A', 'B', 'C'],
58-
timing=timing,
59-
colors=colors)
60-
matrix_display.update_task_bar()
61-
matrix_display.do_inquiry()
62-
core.wait(task_buffer)
63-
64-
matrix_display.schedule_to(stimuli=['C', '+', 'F', '<', 'A', 'B', 'C'],
65-
timing=timing,
66-
colors=colors)
67-
matrix_display.update_task_bar()
68-
matrix_display.do_inquiry()
69-
core.wait(task_buffer)
70-
71-
matrix_display.schedule_to(stimuli=['<', '+', 'F', '<', 'A', 'B', 'C'],
72-
timing=timing,
73-
colors=colors)
74-
matrix_display.update_task_bar()
75-
matrix_display.do_inquiry()
76-
core.wait(task_buffer)
50+
inquiries = [
51+
['A', '+', 'F', '<', 'A', 'B', 'C'],
52+
['B', '+', 'F', '<', 'A', 'B', 'C'],
53+
['C', '+', 'F', '<', 'A', 'B', 'C'],
54+
['<', '+', 'F', '<', 'A', 'B', 'C']
55+
]
56+
57+
for inquiry in inquiries:
58+
matrix_display.schedule_to(stimuli=inquiry, timing=timing, colors=colors)
59+
matrix_display.update_task_bar()
60+
matrix_display.do_inquiry()
61+
core.wait(task_buffer)

bcipy/display/demo/matrix/demo_copyphrase_matrix.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from bcipy.display.components.task_bar import CopyPhraseTaskBar
1111
from bcipy.display.paradigm.matrix.display import MatrixDisplay
1212

13-
font = "Overpass Mono Medium"
13+
font = "Overpass Mono"
1414
info = InformationProperties(
1515
info_color=['White'],
1616
info_pos=[(-.5, -.75)],
@@ -82,9 +82,9 @@
8282

8383
counter = 0
8484

85-
for idx_o in range(len(spelled_text)):
85+
for spelled in spelled_text:
8686

87-
display.update_task_bar(text=spelled_text[idx_o])
87+
display.update_task_bar(text=spelled)
8888
display.draw_static()
8989
win.flip()
9090

bcipy/display/paradigm/matrix/display.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def capture_grid_screenshot(self, file_path: str) -> None:
137137
self.draw_grid(opacity=self.full_grid_opacity)
138138
tmp_task_bar = self.task_bar.current_index
139139
self.task_bar.current_index = 0
140-
self.draw_static()
140+
self.draw_components()
141141
self.window.flip()
142142

143143
# capture the screenshot and save it to the specified file path
@@ -273,7 +273,7 @@ def draw(self,
273273
color=grid_color or self.grid_color,
274274
highlight=highlight,
275275
highlight_color=highlight_color)
276-
self.draw_static()
276+
self.draw_components()
277277
self.window.flip()
278278
if duration:
279279
core.wait(duration)
@@ -342,6 +342,11 @@ def wait_screen(self, message: str, message_color: str) -> None:
342342

343343
def draw_static(self) -> None:
344344
"""Draw static elements in a stimulus."""
345+
self.draw_grid(self.start_opacity)
346+
self.draw_components()
347+
348+
def draw_components(self) -> None:
349+
"""Draw task bar and info text components."""
345350
if self.task_bar:
346351
self.task_bar.draw()
347352

bcipy/display/tests/paradigm/matrix/test_matrix_display.py

+1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ def test_animate_scp(self):
163163
when(self.matrix.window).callOnFlip(any(), any()).thenReturn()
164164
# mock the drawing of text stims
165165
when(self.matrix).draw_static().thenReturn()
166+
when(self.matrix).draw_components().thenReturn()
166167
when(self.text_stim_mock).draw().thenReturn()
167168
when(self.matrix.window).flip().thenReturn()
168169
# skip the core wait

0 commit comments

Comments
 (0)