-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[MRG] Add handling of epochs #45
Conversation
Can you rebase please? |
@cbrnr Should be ok now :) |
Also @mmagnuski you said you needed epoching, could you also take a look? |
@cbrnr |
Try:
|
@TyWR I hope it's OK if I add both you and me to the CHANGELOG (since I've changed quite a bit) |
Good to go from my end, I've tested if everything works correctly if an epochs object is active. @TyWR @vferat @mmagnuski let me know if you want to give it another round of review or if you spot anything fishy. Otherwise, I'd like to merge this ASAP. |
For me it's ok ! |
@cbrnr I'll review tomorrow as fast as I can! I mostly wanted to try it out in a few ways. |
@hoechenberger Thanks, I'll try that! |
Works very well for me, great work! I would also add info about tmin and tmax somewhere in the main window data information (it shows |
After setting a wider baseline than epoching period mnelab closes with the expected error: Traceback (most recent call last):
File "C:\Users\mmagn\Continuum\anaconda3\envs\mnelab\lib\site-packages\mnelab\mainwindow.py", line 607, in epoch_data
self.model.epoch_data(events, tmin, tmax, baseline)
File "C:\Users\mmagn\Continuum\anaconda3\envs\mnelab\lib\site-packages\mnelab\model.py", line 38, in wrapper
f(*args, **kwargs)
File "C:\Users\mmagn\Continuum\anaconda3\envs\mnelab\lib\site-packages\mnelab\model.py", line 499, in epoch_data
baseline=baseline, preload=True)
File "<C:\Users\mmagn\Continuum\anaconda3\envs\mnelab\lib\site-packages\mne\externals\decorator.py:decorator-gen-204>", line 2, in __init__
File "C:\Users\mmagn\Continuum\anaconda3\envs\mnelab\lib\site-packages\mne\utils\_logging.py", line 89, in wrapper
return function(*args, **kwargs)
File "C:\Users\mmagn\Continuum\anaconda3\envs\mnelab\lib\site-packages\mne\epochs.py", line 1812, in __init__
verbose=verbose)
File "<C:\Users\mmagn\Continuum\anaconda3\envs\mnelab\lib\site-packages\mne\externals\decorator.py:decorator-gen-195>", line 2, in __init__
File "C:\Users\mmagn\Continuum\anaconda3\envs\mnelab\lib\site-packages\mne\utils\_logging.py", line 89, in wrapper
return function(*args, **kwargs)
File "C:\Users\mmagn\Continuum\anaconda3\envs\mnelab\lib\site-packages\mne\epochs.py", line 344, in __init__
_check_baseline(baseline, tmin, tmax, info['sfreq'])
File "C:\Users\mmagn\Continuum\anaconda3\envs\mnelab\lib\site-packages\mne\epochs.py", line 1598, in _check_baseline
"data (tmin = %s)" % (baseline_tmin, tmin))
ValueError: Baseline interval (tmin = -0.5) is outside of epoch data (tmin = -0.30000000000000004) However, I don't think it should close without warning the way it does. It should catch such error and let the user know what went wrong. |
another minor issue is when epoching on file twice (for example with different events or different time limits) - the names in the "data explorer" list on the left in the main window are the same so it may be hard to discern multiple Epochs coming from the same file. But that's also something for another PR. |
Thanks @mmagnuski I'll add a check for baseline limits and then do the rest in another PR. |
@cbrnr I was thinking to maybe catch
|
I will do both, because in this case it's pretty straightforward to validate in the dialog. |
Regarding the different PSD plots - yes, this is an MNE inconsistency. I don't think there even is an option to plot individual channel PSDs for |
Thanks @TyWR! |
This is in reference to #42
There is still a lot to do as I think some functions won't be correctly handing epochs, however it is possible to display the regular plot, the psd_plot, and normally, to compute ICA on epochs.