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

Fix plot conditions #257

Merged
merged 8 commits into from
Mar 7, 2024
Merged

Fix plot conditions #257

merged 8 commits into from
Mar 7, 2024

Conversation

JohnGriffiths
Copy link
Collaborator

addressing plot_conditions issue noted in #246

@JohnGriffiths JohnGriffiths marked this pull request as ready for review January 5, 2024 02:32
@JohnGriffiths
Copy link
Collaborator Author

This PR has one important change from the prior code:

conditions for the difference wave plotting are specified by the condition name strings, not the integer values

for example, in the visual p300 example,

conditions = OrderedDict()
conditions['non-target'] = [1]
conditions['target'] = ['2]
diffwav = ["non-target", "target"]

has changed to

conditions = OrderedDict()
conditions['non-target'] = ['non-target']
conditions['target'] = ['target']
diffwav = ["non-target", "target"]

This perhaps does a little odd in that the keys in conditions are identical to the values, but
bear in mind that it allows groupings of condition labels, as was previously done with groupings of the integer values.

So, for example, in the visual cueing example,

events = find_events(raw)
event_id = {'InvalidTarget_Left': 11, 'InvalidTarget_Right': 12,
                   'ValidTarget_Left': 21,'ValidTarget_Right': 11}
...
conditions = OrderedDict()
conditions['ValidTarget'] = [21,22]
conditions['InvalidTarget'] = [11,12]

has now become

events = find_events(raw)
event_id = {'InvalidTarget_Left': 11, 'InvalidTarget_Right': 12,
                   'ValidTarget_Left': 21,'ValidTarget_Right': 11}
...
conditions = OrderedDict()
conditions['ValidTarget'] = ['ValidTarget_Left', 'ValidTarget_Right']
conditions['InvalidTarget'] = ['InvalidTarget_Left', 'InvalidTarget_Right']
diffwave = ('ValidTarget', 'InvalidTarget')

The reason for doing this is that the epochs.to_dataframe() method returns a dataframe with a column that has the condition label text strings (i.e. the keys in event_id), but not the integer id values. Moreover, between the two, it is preferable to use text strings than integers to define things as they are more expressive and easier to work with correctly / avoid mis-specification errors.

@oreHGA
Copy link
Collaborator

oreHGA commented Mar 7, 2024

Docs build works, merging to develop

@oreHGA oreHGA merged commit d00c2dd into develop Mar 7, 2024
5 of 6 checks passed
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.

None yet

2 participants