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

Filter bank classes #467

Draft
wants to merge 30 commits into
base: develop
Choose a base branch
from
Draft

Conversation

Sara04
Copy link
Collaborator

@Sara04 Sara04 commented Aug 21, 2023

Hello,

This PR:

  • removes SinglePass class, as it serves only to set-up lower and upper frequencies of the band-pass filter. This can be directly done in the MotorImagery and LeftRightImagery classes.
  • methods of the pair LeftRightImagery & FilterBankLeftRightImagery and the pair MotorImagery & FilterBankMotorImagery are (should be) the same, so there is no need to redefine them. The classes differ only in filters (single vs. filter bank). Therefore, FilterBankLeftRightImagery can inherit LeftRightImagery and FilterBankMotorImagery can inherit MotorImagery. As LeftRightImagery and MotorImagery cannot take as argument 'filters', the attributes of the classes are initialized via grandparent class BaseMotorImagery.
  • is_valid method, should return False if dataset paradigm is not 'imagery'
  • we can use NumpyDocstringInheritanceMeta metaclass to inheret docstrings and in this way avoid long repetitions

Copy link
Collaborator

@PierreGtch PierreGtch left a comment

Choose a reason for hiding this comment

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

Hi Sara, I think you should use the class NumpyDocstringInheritanceInitMeta (see comment). If it works, print(MotorImagery.__doc__) should display all the parameters.
And why did you change Parameters to Attributes?
Otherwise, the rest looks good to me!

moabb/utils.py Outdated Show resolved Hide resolved
moabb/utils.py Outdated Show resolved Hide resolved
"""Base Processing.

Please use one of the child classes


Parameters
Attributes
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you change “Parameters” to “Attributes”?

@@ -474,11 +474,11 @@ def _get_events_pipeline(self, dataset):
class BaseParadigm(BaseProcessing):
"""Base class for paradigms.

Parameters
Attributes
Copy link
Collaborator

Choose a reason for hiding this comment

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

same


Motor imagery paradigm with only one bandpass filter (default 8 to 32 Hz)
Attributes
Copy link
Collaborator

Choose a reason for hiding this comment

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

same


class FilterBankMotorImagery(FilterBank):
"""Filter bank n-class motor imagery.
Attributes
Copy link
Collaborator

Choose a reason for hiding this comment

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

same


Parameters
Attributes
Copy link
Collaborator

Choose a reason for hiding this comment

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

same

Sara04 and others added 3 commits October 19, 2023 16:46
Change NumpyDocstringInheritanceMeta to NumpyDocstringInheritanceInitMeta class

Co-authored-by: PierreGtch <25532709+PierreGtch@users.noreply.github.com>
Change NumpyDocstringInheritanceMeta to NumpyDocstringInheritanceInitMeta class 2

Co-authored-by: PierreGtch <25532709+PierreGtch@users.noreply.github.com>
@Sara04
Copy link
Collaborator Author

Sara04 commented Oct 19, 2023

Thank you for the review, @PierreGtch ! I've changed 'Parameters' to 'Attributes' as I thought that we use 'Attributes' for class variables and 'Parameters' for methods, but I can revert it to be in accordance with other docstrings.

class MotorImagery(SinglePass):
"""N-class motor imagery.

Metric is 'roc-auc' if 2 classes and 'accuracy' if more
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this line should stay in the docstring

@PierreGtch
Copy link
Collaborator

PierreGtch commented Apr 12, 2024

@Sara04 Is this PR ready or you wanted to change other things?

I can fix the errors if you want

@Sara04
Copy link
Collaborator Author

Sara04 commented Apr 12, 2024

Hey @PierreGtch , thank you! I will check if there is something more to change.

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