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

Matrix Grid Always On #313

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 14 additions & 29 deletions bcipy/display/demo/matrix/demo_calibration_matrix.py
Original file line number Diff line number Diff line change
@@ -40,37 +40,22 @@
task_bar=task_bar,
info=info)

time_target = 2
time_fixation = 2
time_target = 1
time_fixation = 0.5
time_flash = 0.25
timing = [time_target] + [time_fixation] + [time_flash] * 5
colors = ['green', 'lightgray'] + ['white'] * 5
task_buffer = 2

matrix_display.schedule_to(stimuli=['A', '+', 'F', '<', 'A', 'B', 'C'],
timing=timing,
colors=colors)
matrix_display.update_task_bar()
matrix_display.do_inquiry()
core.wait(task_buffer)

matrix_display.schedule_to(stimuli=['B', '+', 'F', '<', 'A', 'B', 'C'],
timing=timing,
colors=colors)
matrix_display.update_task_bar()
matrix_display.do_inquiry()
core.wait(task_buffer)

matrix_display.schedule_to(stimuli=['C', '+', 'F', '<', 'A', 'B', 'C'],
timing=timing,
colors=colors)
matrix_display.update_task_bar()
matrix_display.do_inquiry()
core.wait(task_buffer)

matrix_display.schedule_to(stimuli=['<', '+', 'F', '<', 'A', 'B', 'C'],
timing=timing,
colors=colors)
matrix_display.update_task_bar()
matrix_display.do_inquiry()
core.wait(task_buffer)
inquiries = [
['A', '+', 'F', '<', 'A', 'B', 'C'],
['B', '+', 'F', '<', 'A', 'B', 'C'],
['C', '+', 'F', '<', 'A', 'B', 'C'],
['<', '+', 'F', '<', 'A', 'B', 'C']
]

for inquiry in inquiries:
matrix_display.schedule_to(stimuli=inquiry, timing=timing, colors=colors)
matrix_display.update_task_bar()
matrix_display.do_inquiry()
core.wait(task_buffer)
6 changes: 3 additions & 3 deletions bcipy/display/demo/matrix/demo_copyphrase_matrix.py
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
from bcipy.display.components.task_bar import CopyPhraseTaskBar
from bcipy.display.paradigm.matrix.display import MatrixDisplay

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

counter = 0

for idx_o in range(len(spelled_text)):
for spelled in spelled_text:

display.update_task_bar(text=spelled_text[idx_o])
display.update_task_bar(text=spelled)
display.draw_static()
win.flip()

9 changes: 7 additions & 2 deletions bcipy/display/paradigm/matrix/display.py
Original file line number Diff line number Diff line change
@@ -137,7 +137,7 @@ def capture_grid_screenshot(self, file_path: str) -> None:
self.draw_grid(opacity=self.full_grid_opacity)
tmp_task_bar = self.task_bar.current_index
self.task_bar.current_index = 0
self.draw_static()
self.draw_components()
self.window.flip()

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

def draw_static(self) -> None:
"""Draw static elements in a stimulus."""
self.draw_grid(self.start_opacity)
self.draw_components()

def draw_components(self) -> None:
"""Draw task bar and info text components."""
if self.task_bar:
self.task_bar.draw()

1 change: 1 addition & 0 deletions bcipy/display/tests/paradigm/matrix/test_matrix_display.py
Original file line number Diff line number Diff line change
@@ -163,6 +163,7 @@ def test_animate_scp(self):
when(self.matrix.window).callOnFlip(any(), any()).thenReturn()
# mock the drawing of text stims
when(self.matrix).draw_static().thenReturn()
when(self.matrix).draw_components().thenReturn()
when(self.text_stim_mock).draw().thenReturn()
when(self.matrix.window).flip().thenReturn()
# skip the core wait