Skip to content

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

@carraraig carraraig requested a review from PierreGtch October 11, 2023 12:43
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!

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”?

"""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 for left hand/right hand classification.
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

"""Filter bank N-class motor imagery.
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 <[email protected]>
Change NumpyDocstringInheritanceMeta to NumpyDocstringInheritanceInitMeta class 2

Co-authored-by: PierreGtch <[email protected]>
@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.

3 participants