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

VEP Display #237

Merged
merged 6 commits into from
Aug 30, 2022
Merged

VEP Display #237

merged 6 commits into from
Aug 30, 2022

Conversation

tab-cmd
Copy link
Contributor

@tab-cmd tab-cmd commented Aug 23, 2022

Overview

Added a VEP Display component.

Note: while I've made a method for animation and a variable referencing vep_type, these need more direction from the clinical and engineering teams (4x4 vs 6x6; how it should animate). I want to preserve all of the spike work we've done thus far without committing to fancy animations or code generation at this time. Please add any suggestions that will make future changes easier.

Ticket

https://www.pivotaltracker.com/story/show/182457440

Contributions

  • display/paradigm/vep.py: VEPDisplay: main display component needed to operate in any task. VEPBox: Bounding box for every single flickering box. create_vep_codes: method to create a random code for displaying the vep flickering.
  • display/paradigm/rsvp.py: Add typing / linting.
  • bcipy/display.py: added VEPStimulusProperties to better encapsulate the stimuli needed for VEP operation
  • display/demo/vep/demo_calibration_vep.py: a script to demonstrate how to set up and use the VEPDisplay in a task type setting.

Test

  • display/demo/vep/demo_calibration_vep.py Ran and made sure everything hit AC. No other parts of the code were touched.
IMG_9307.MOV

Documentation

  • Are documentation updates required? In-line, README, or documentation? Updated in-line. Some readme or other documentation could be helpful, please point it out!

Changelog

  • Is the CHANGELOG.md updated with your detailed changes? Will do!

@tab-cmd tab-cmd requested review from lawhead and celikbasak August 23, 2022 21:41
Copy link
Collaborator

@lawhead lawhead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's exciting to see this working and this gives us is a great start from which to iterate.

vep = VEPDisplay(win, experiment_clock, stimuli, task_display, info)
timing = []
t = 2
for i in range(len(task_text)):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, this could be:

for (txt, color) in zip(task_text, task_color):
    vep.update_task(txt, color[0])



def create_vep_codes(length=32, count=4) -> List[List[int]]:
"""Create a list of VEP codes."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to document what length and count are used for so it's clear when used elsewhere.

np.random.seed(1)
for _ in range(count):
res.append(np.random.randint(2, size=length))
return res
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be reduced to a list comprehension:

return [np.random.randint(2, size=length) for _ in range(count)]


This assumes that vep_type is 4 using a 2x2 grid. Additional configurations can be added in the future.
"""
# generate the inquiry stimuli
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea that we will have a fixed number of configurations, or did you have thoughts on making this more general and be able to accommodate any possible grid?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really only considered having a few fixed layouts with different size flickering VEP boxes. I'd be open to something more configurable within a fixed unit type (height or norm). We could try looping in code generated via psychopy to give more options. When coding this, I realized we aren't really equipped across the board to support interface building for non-coding folks (only configuration).

If a user wanted something more custom, I would recommend they build it in the psychopy experiment builder GUI and import bcipy to get the VEP flickering and/or acquisition.

@tab-cmd tab-cmd merged commit a8f9ce7 into 2.0.0rc2 Aug 30, 2022
@tab-cmd tab-cmd deleted the vep branch August 30, 2022 19:22
@tab-cmd tab-cmd mentioned this pull request Sep 26, 2022
tab-cmd added a commit that referenced this pull request Sep 26, 2022
tab-cmd added a commit that referenced this pull request Oct 3, 2022
* add timer to prevent double clicking (#218)

* #181963356 ; added better alerting to inform users when fake data mode is on

* Added changelog entry

* Refactoring to reduce duplication

* #182040775 ; option to summarize session at the end of a copy phrase task

* Update README.md

High level GPT2 documentation added, word level prediction described, contact information added

* Matrix Display Fixes (#221)

* fixes bug with last stimuli lagging in matrix calibration, added entire grid flash before each inquiry

* Address PR comment + cleanup

Co-authored-by: Tab Memmott <[email protected]>

* Refactored session helper to generate spreadsheets without first creating a sqlite database

* ERP plotting improvements and MNE data support (#220)

* #182005453 ; added parameter for signal model path; updated initialization code to use this for typing tasks

* #182406904 ; Fix bug when generating a spreadsheet from active session data

* [Bug fix] Two presses needed to start copy phrase (#225)

* Documentation and formatting

* #182200897 ; check for internet connection and confirm before proceeding with the session

* Added logging for GPU information, if available

* Whitespace fix

* Added changes

* Move session validation to validate module; update internet connectivity test to work with VPN

* #182106570 ; added functionality for configuration channel specifications for a given device.

* Added a test mock to prevent a GUI interaction during testing

* Fix test issue by switching to a different acquisition client for mocking

* use a better default timeout (#228)

* #182776686 ; prevent widgets scrolling on parameters form

* Jitter (#233)

Jitter for calibration + parameter. copy phrase ip

cleanup stimuli tests

* User ID reset bug and cleanup (#235)

User id reset fix

* Add support for Tobii Nano (#234)

* Add support for Tobii Nano

* address PR feedback

* update changelog

* added ssvep to cvep method (#232)

Co-authored-by: Aida Fakhry <[email protected]>
Co-authored-by: Tab Memmott <[email protected]>

* #183037159 ; alert when using battery power

* Better documentation on return values and potential impacts

* VEP Display (#237)

* upgrade psychopy  (#239)

* ERP viz demo fix (#240)

* #175193924 infrastructure for changed parameters ; #183134229 Fixed issue with params_form rounding some float values ; #183133776  allow static offset to be input with more precision

* Remove unneeded parameters  (#241)

* signal model loaded log (#244)

better signal model logging

* Devices config update && BciPy running outside of root (#242)

* Refactor param changes GUI to use a scroll area for displaying a large number of changes

* Refinements; parameters changes start out collapsed if empty; minor refactorings

* #182408060 ; Ensure that spelled text is provided to the language model when using fake data

* Export the device used as a useable config file (#247)

* Convert: add BDF support and fix static offset bug (#246)

* #182031676 ; remove TCP-based acquisition code

* Added PR number to changelog

* Added function type information; better string representations of channel specs and device specs; removed unused code in tests

* Updated max_buffer_len parameter name for lsl_client

* fix rebase issue in parameters module

* Bug fixes: jitter, offline analysis, task complete alerting  (#250)

* Matrix Bug: fix for scp flashing (#252)

* Matrix documentation (#253)

Co-authored-by: lawhead <[email protected]>
Co-authored-by: Shijia Liu <[email protected]>
Co-authored-by: jcgangemi1 <[email protected]>
Co-authored-by: AidaFakhry <[email protected]>
Co-authored-by: Aida Fakhry <[email protected]>
Co-authored-by: Basak Celik <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants