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

Report artifact enhancements, README, Python 3.10.6 support #357

Merged
merged 17 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
5 changes: 4 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
[run]
omit =
*__init__*
*__main__*
*/usr/local/lib*
*tests*
*test*
*demo*
*exceptions.py
*/gui/*
*/gui/experiments/*
*/gui/viewer/*
*/gui/BCInterface.py

[report]
exclude_lines =
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.8, 3.9, 3.10.6]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.8, 3.9, 3.10.6]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.8, 3.9, 3.10.6]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ install:

dev-install:
pip install -r dev_requirements.txt
pip install psychopy==2023.2.1 --no-deps
pip install psychopy==2024.2.1 --no-deps
pip install kenlm==0.1 --global-option="--max_order=12"
make install

Expand Down
105 changes: 78 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ If using zsh, instead of bash, you may encounter a segementation fault when runn
## Installation
---------------

#### BciPy Setup
### BciPy Setup
----------------

In order to run BciPy on your computer, after following the dependencies above, you will need to install the BciPy package.

Expand All @@ -62,26 +63,86 @@ Alternately, if [Make](http://www.mingw.org/) is installed, you may run the foll
make dev-install
```

#### Client Usage
Invoke an experiment protocol or task directly using command line utility `bcipy`.
- You can pass it attributes with flags, if desired.
Running with a User ID and Task: `bcipy --user "bci_user" --task "RSVP Calibration"`
Running with a User ID and Tasks with a registered Protocol: `bcipy --user "bci_user" --experiment "default"`
Running with fake data: `bcipy --fake`
Running without visualizations: `bcipy --noviz`
Running with alerts after each Task execution: `bcipy --alert`
Running with custom parameters: `bcipy --parameters "path/to/valid/parameters.json"`
### Client Usage
----------------

##### Run an experiment protocol or task

Invoke an experiment protocol or task directly using command line utility `bcipy`.

- Use the help flag to see other available input options: `bcipy --help`
- You can pass it attributes with flags, if desired.
- Running with a User ID and Task:
- `bcipy --user "bci_user" --task "RSVP Calibration"`
- Running with a User ID and Tasks with a registered Protocol:
- `bcipy --user "bci_user" --experiment "default"`
- Running with fake data:
- `bcipy --fake`
- Running without visualizations:
- `bcipy --noviz`
- Running with alerts after each Task execution:
- `bcipy --alert`
- Running with custom parameters:
- `bcipy --parameters "path/to/valid/parameters.json"`

##### Train a signal model with registered BciPy models

To train a signal model (currently `PCARDAKDE`), run the following command after installing BciPy:

`bcipy-train`

- Use the help flag to see other available input options: `bcipy-train --help`
- You can pass it attributes with flags, if desired.
- Running without a window prompting for data session folder:
- `bcipy-train -d path/to/data`
- Running with data visualizations (ERPs, etc.):
- `bcipy-train -v`
- Running with data visualizations that do not show, but save to file:
- `bcipy-train -s`
- Running with balanced accuracy:
- `bcipy-train --balanced-acc`
- Running with alerts after each Task execution:
- `bcipy-train --alert`
- Running with custom parameters:
- `bcipy-train -p "path/to/valid/parameters.json"`

##### Visualize ERP data from a session with Target / Non-Target labels

To generate plots that can be shown or saved after collection of data, run the following command after installing BciPy:

`bcipy-erp-viz`

- Use the help flag to see other available input options: `bcipy-erp-viz --help`
- You can pass it attributes with flags, if desired.
- Running without a window prompting for data session folder:
- `bcipy-erp-viz -s path/to/data`
- Running with data visualizations (ERPs, etc.):
- `bcipy-erp-viz --show`
- Running with data visualizations that do not show, but save to file:
- `bcipy-erp-viz --save`
- Running with custom parameters (default is in bcipy/parameters/parameters.json):
- `bcipy-erp-viz -p "path/to/valid/parameters.json"`

##### BciPy Simulator Usage

The simulator can be run using the command line utility `bcipy-sim`.

Ex.
`bcipy-sim -d my_data_folder/ -p my_parameters.json -m my_models/ -n 5`

Run `bcipy-sim --help` for documentation or see the README in the simulator module.

- Use the help flag to see other available input options: `bcipy --help`

##### Example Usage as a Package
### Package Usage
-------------------

```python
from bcipy.helpers import system_utils
system_utils.get_system_info()
```

#### Example Usage through the GUI
### GUI Usage
-------------

Run the following command in your terminal to start the BciPy GUI:
```sh
Expand All @@ -95,16 +156,6 @@ make bci-gui
```


#### Simulator Usage

The simulator can be run using the command line utility `bcipy-sim`.

Ex.
`bcipy-sim -d my_data_folder/ -p my_parameters.json -m my_models/ -n 5`

Run `bcipy-sim --help` for documentation or see the README in the simulator module.


## Glossary
-----------

Expand Down Expand Up @@ -150,7 +201,7 @@ This a list of the major modules and their functionality. Each module will conta
## Paradigms
------------

See `bcipy/task/README.md` for more information on all supported paradigms and modes. The following are the supported and validated paradigms:
See `bcipy/task/README.md` for more information on all supported paradigms, tasks, actions and modes. The following are the supported and validated paradigms:


> RSVPKeyboard
Expand Down Expand Up @@ -213,7 +264,6 @@ After running the above command, the recommended offset correction value will be
```bash
# Let's say the recommneded offset value is 0.1
python bcipy/helpers/offset.py --offset "0.1" -p

```

Alternately, if Make is installed, you may run the follow command to run offset determination and display the results:
Expand Down Expand Up @@ -306,10 +356,11 @@ make type


### Contributions Welcome!
--------------------------

If you want to be added to the development team slack or have additional questions, please reach out to us at [email protected]!

### Contribution Guidelines
#### Contribution Guidelines

We follow and will enforce the contributor's covenant to foster a safe and inclusive environment for this open source software, please reference this link for more information: https://www.contributor-covenant.org/

Expand All @@ -325,7 +376,7 @@ Other guidelines:

See this resource for examples: http://docs.python-guide.org/en/latest/writing/style/

## Contributors
### Contributors
---------------

All contributions are greatly appreciated!
Expand Down
1 change: 1 addition & 0 deletions bcipy/display/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ class PreviewParams(NamedTuple):
preview_inquiry_key_input: str
preview_inquiry_progress_method: int
preview_inquiry_isi: float
preview_box_text_size: float

@property
def button_press_mode(self):
Expand Down
13 changes: 8 additions & 5 deletions bcipy/display/paradigm/rsvp/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def __init__(
self.stimuli_colors = stimuli.stim_colors
self.stimuli_timing = stimuli.stim_timing
self.stimuli_font = stimuli.stim_font
# Note: there is a bug in TextBox2 that prevents certain custom fonts from being used. This is to avoid that.
self.textbox_font = 'Consolas'
self.stimuli_height = stimuli.stim_height
self.stimuli_pos = stimuli.stim_pos
self.is_txt_stim = stimuli.is_txt_stim
Expand Down Expand Up @@ -271,13 +273,12 @@ def _generate_inquiry_preview(self) -> visual.TextBox2:
text = ' '.join(self.stimuli_inquiry).split('+ ')[1]

return self._create_stimulus(
0.12,
self.preview_params.preview_box_text_size,
stimulus=text,
units='height',
stimuli_position=self.stimuli_pos,
mode='textbox',
align_text='left',
wrap_width=0.025)
align_text='left')

def _generate_inquiry(self) -> list:
"""Generate inquiry.
Expand Down Expand Up @@ -439,9 +440,11 @@ def _create_stimulus(
borderWidth=2,
borderColor='white',
units=units,
font=self.stimuli_font,
padding=0.05,
font=self.textbox_font,
letterHeight=height,
size=[.5, .5],
size=[.55, .55],
pos=stimuli_position,
alignment=align_text,
editable=False,
)
6 changes: 4 additions & 2 deletions bcipy/display/tests/paradigm/matrix/test_matrix_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ def test_do_inquiry_with_preview_accepted(self):
preview_inquiry_length=2,
preview_inquiry_key_input='return',
preview_inquiry_progress_method=2,
preview_inquiry_isi=1)
preview_inquiry_isi=1,
preview_box_text_size=0.1)
matrix = MatrixDisplay(window=self.window,
experiment_clock=self.experiment_clock,
stimuli=self.stimuli,
Expand Down Expand Up @@ -181,7 +182,8 @@ def test_do_inquiry_with_preview_rejected(self):
preview_inquiry_length=2,
preview_inquiry_key_input='return',
preview_inquiry_progress_method=2,
preview_inquiry_isi=1)
preview_inquiry_isi=1,
preview_box_text_size=0.1)
matrix = MatrixDisplay(window=self.window,
experiment_clock=self.experiment_clock,
stimuli=self.stimuli,
Expand Down
21 changes: 14 additions & 7 deletions bcipy/display/tests/paradigm/rsvp/test_rsvp_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def test_preview_enabled_is_false(self):
preview_inquiry_length=2,
preview_inquiry_key_input='space',
preview_inquiry_progress_method=1,
preview_inquiry_isi=1)
preview_inquiry_isi=1,
preview_box_text_size=0.1)
rsvp = RSVPDisplay(self.window,
self.static_clock,
self.experiment_clock,
Expand All @@ -151,7 +152,8 @@ def test_preview_enabled_is_true(self):
preview_inquiry_length=2,
preview_inquiry_key_input='space',
preview_inquiry_progress_method=1,
preview_inquiry_isi=1)
preview_inquiry_isi=1,
preview_box_text_size=0.1)
rsvp = RSVPDisplay(self.window,
self.static_clock,
self.experiment_clock,
Expand All @@ -173,7 +175,8 @@ def test_preview_inquiry_evoked_press_to_accept_pressed(
preview_inquiry_length=0.01,
preview_inquiry_key_input='space',
preview_inquiry_progress_method=1,
preview_inquiry_isi=0.01)
preview_inquiry_isi=0.01,
preview_box_text_size=0.1)
self.init_display(preview_config)

button_press_handler_mock.has_response.return_value = True
Expand Down Expand Up @@ -209,7 +212,8 @@ def test_preview_inquiry_evoked_press_to_skip_pressed(
preview_inquiry_length=0.01,
preview_inquiry_key_input='space',
preview_inquiry_progress_method=2,
preview_inquiry_isi=0.01)
preview_inquiry_isi=0.01,
preview_box_text_size=0.1)
self.init_display(preview_config)

button_press_handler_mock.has_response.return_value = True
Expand Down Expand Up @@ -238,7 +242,8 @@ def test_preview_inquiry_evoked_press_to_accept_not_pressed(
preview_inquiry_length=0.01,
preview_inquiry_key_input='space',
preview_inquiry_progress_method=1,
preview_inquiry_isi=0.01)
preview_inquiry_isi=0.01,
preview_box_text_size=0.1)
self.init_display(preview_config)

button_press_handler_mock.has_response.return_value = False
Expand All @@ -264,7 +269,8 @@ def test_preview_inquiry_evoked_press_to_skip_not_pressed(
preview_inquiry_length=0.01,
preview_inquiry_key_input='space',
preview_inquiry_progress_method=2,
preview_inquiry_isi=0.01)
preview_inquiry_isi=0.01,
preview_box_text_size=0.1)
self.init_display(preview_config)

button_press_handler_mock.has_response.return_value = False
Expand All @@ -290,7 +296,8 @@ def test_preview_inquiry_preview_only_response_registered(
preview_inquiry_length=0.01,
preview_inquiry_key_input='space',
preview_inquiry_progress_method=0,
preview_inquiry_isi=0.01)
preview_inquiry_isi=0.01,
preview_box_text_size=0.1)
self.init_display(preview_config)

button_press_handler_mock.has_response.return_value = False
Expand Down
Loading
Loading