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

Be more explicit about what is returned by read_epochs_eeglab and read_epochs_kit #12542

Open
nabilalibou opened this issue Apr 16, 2024 · 3 comments
Labels

Comments

@nabilalibou
Copy link
Contributor

Proposed documentation enhancement

It's a minor detail, but the docstrings for functions like mne.read_epochs_eeglab() and mne.read_epochs_kit() indicate that an Epochs instance is returned, while in reality they return subclasses of BaseEpochs; specifically EpochsEEGLAB and EpochsKIT, respectively.
It can be deceptive, for example it could encourage the use of a isinstance(epochs, mne.Epoch) because although BaseEpoch exists, the documentation could misleads into thinking that there is only one type of Epoch class.

Even though there don't seem to be any html pages created for these subclasses that could be linked, i think we could add a few details to be clearer, what do you think ?

@hoechenberger
Copy link
Member

hoechenberger commented Apr 16, 2024

this problem affects many readers and I believe it has at least been brought up when we added some type hints not too long ago.

i agree with you that this should be improved.

parts of the class hierarchy would probably need to be revamped.

@larsoner
Copy link
Member

For now the easiest solution would be to say that the return type is BaseEpochs, which is nice because it is a documented type

@nabilalibou
Copy link
Contributor Author

A solution in the meantime to make sure the reader has all the keys needed to understand what's behind could be something like:

Returns:
   EpochsEEGLAB/EpochsKIT : instance of [BaseEpochs]
        EpochsEEGLAB/EpochsKIT object (subclass of [BaseEpochs])

And having a markdown box:

See also: 
   [mne.Epochs] Documentation of attributes and methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants