You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Annotation displayed on ICA sources when meas_date is None and first_samp is not 0 are wrong #11762
One more time-management related issue with annotations. MWE:
from datetime import datetime, timezone
import numpy as np
from mne import Annotations, create_info
from mne.io import RawArray
from mne.preprocessing import ICA
#%%
# date = datetime(1995, 3, 28, 0, 0, 0, 0, tzinfo=timezone.utc)
info = create_info(5, 1000, "eeg")
data = np.random.randn(5, 10000)
raw = RawArray(data, info)
assert raw.first_samp == 0
# raw.set_meas_date(date)
annotation = Annotations(onset=4, duration=1, description="bad_test")
raw.set_annotations(annotation)
# raw.plot(theme="light", scalings="auto")
#%%
raw.crop(2, 8)
# raw.plot(theme="light", scalings="auto")
#%%
ica = ICA(
method="picard", fit_params=dict(ortho=False, extended=True), random_state=888
)
ica.fit(raw, picks="eeg", reject_by_annotation=True)
ica.plot_sources(raw, theme="light")
If there is no measurement date and if raw.first_samp is different from 0 (e.g. by cropping), the annotations displayed in ica.plot_sources are not correctly set. Issue is here:
Activity