-
Notifications
You must be signed in to change notification settings - Fork 15
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
MRG: Update repository structure #21
Conversation
Codecov Report
@@ Coverage Diff @@
## main #21 +/- ##
==========================================
- Coverage 97.09% 96.60% -0.50%
==========================================
Files 4 7 +3
Lines 379 412 +33
==========================================
+ Hits 368 398 +30
- Misses 11 14 +3
Continue to review full report at Codecov.
|
Thanks for getting to this right away! I feel like |
How about |
I like it! |
Done, and I added the simplest of test cases to run |
Hopefully this tightens up the process and makes life easier. I think I made the MANIFEST accurately reflect what was happening in this PR too, but if not, I can fix it later too. The docs folder was added, but since this is on Jacob's gh, we'll just wait till we migrate the repo to mnetools to setup the actual CI to build the docs. |
For the error, it's because autocorrelation ends with a resampling:
The sample dataset sampling rate is I am not sure how to correctly fix this at the moment, I'll think about it. |
I think (pretty sure) this is an "extreme" edge case because the imperfect sampling rate usually arises due to some machine precision error. E.g. in this case the actual sampling rate is actually 600 Hz. I'm leaning towards: The correct fix would be for the user to pass it in correctly. So the info['sfreq'] is checked when the user calls
WDYT? |
I agree that some error checking is necessary with some warning:
and some raises:
We'll discuss those bullet points later, but for the frequency, I don't think we should force it to be integer because if a user has a dataset like the MNE sample, he can not easily change the sampling frequency. The field Instead, I would simply figure out if we have to floor or ceil the sampling frequency in the autocorrelation function to get the 100 samples. I am not (yet) convinced |
I think that fixes it, but it's not super clean.
EDIT: Removed the |
Agreed w/ all your warning proposals. Shall we merge this and go for it in another PR?
I wonder if someone just passes in instance, that we should run ICA for them by default? I.e. make passing in the ICA instance optional.
Perhaps we have an optional argument |
@@ -7,7 +7,7 @@ | |||
from numpy.typing import NDArray | |||
from scipy.signal import resample_poly | |||
|
|||
from .utils import _next_power_of_2, gdatav4, mne_to_eeglab_locs, pol2cart | |||
from .utils import _gdatav4, _mne_to_eeglab_locs, _next_power_of_2, _pol2cart | |||
|
|||
|
|||
def get_features(inst: Union[BaseRaw, BaseEpochs], ica: ICA): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking maybe we even rename this to get_iclabel_features
, since we'll presumably have other models which also have feature engineering which would have get_<model_X>_features
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, good idea.
@pytest.mark.filterwarnings("ignore::RuntimeWarning") | ||
@pytest.mark.filterwarnings("ignore::FutureWarning") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will clean this up in the next PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much appreciated!
Going to merge this for the sake of working on the docs to address Alexandre Gramfort's issues. We can continue discussing some of the points I raised here and then handle in a downstream PR. |
For the warnings, yes I will add those later on. For the sampling rate, I think intelligent flooring/ceiling is possible, but your example is a very good point and I suspect it will fail with the current code. I am not that convince by the additional argument which complicates needlessly the API. |
Sounds good! FYI the repo is moved to my GitHub for now so I can work on the CI and docs before doing another migration to mne.tools :p You'll have to reset your remote URL
Also renamed the repository to FYI: @anandsaini024 @mscheltienne @jacobf18 ^ will need to reset your GitHub config. Sorry but will need a bit of these book-keeping until we migrate officially to mne org. |
Perfect, don't worry about the move(s) ;) |
As per #19, the structure could be something like that.
I chose
label
as name for the entry-point: adding one for the entire package (mne_icalabel
) and one for each model (submodule, onlyiclabel
for now). If you have a better name in mind, please comment 😉That would bring the public API to:
And
I added an underscore to all private functions. I chose to keep the feature extraction
get_features
, the networkICLabelNet
, the forward passrun_iclabel
public on top of the entry-pointlabel
.WDYT?