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
I think there might be a bug in the _source_as_raw function, here it assigns [self.last_samp] to self._last_samps, however self.last_samp is a property function and it seems that if its wrapped in a list, it won't actually call this function until used later.
Steps to reproduce
importmne# load datasample_data_folder=mne.datasets.sample.data_path()
sample_data_raw_file=sample_data_folder/"MEG"/"sample"/"sample_audvis_filt-0-40_raw.fif"raw=mne.io.read_raw_fif(sample_data_raw_file).crop(0, 60).load_data() # raw has 60 seconds of data# concatenateraw_concat=mne.concatenate_raws([raw.copy(), raw.copy()]) # raw_concat has 120 seconds of data# do ICAica=mne.preprocessing.ICA(n_components=20)
ica.fit(raw_concat)
# get sourcesraw_sources=ica.get_sources(raw_concat) # but this will only have 60 seconds of dataprint(raw_concat)
print(raw_sources)
Link to data
No response
Expected results
raw_concat and raw_sources should have the same length of data.
Actual results
But raw_sources only have the length of data corresponding to the first object in the list that we concatenate.
Additional information
Platform Linux-3.10.0-957.1.3.el7.x86_64-x86_64-with-glibc2.17
Python 3.12.2 | packaged by conda-forge | (main, Feb 16 2024, 20:50:58) [GCC 12.3.0]
Executable /home/jerryjin/miniconda3/envs/meg/bin/python
CPU x86_64 (16 cores)
Memory 46.9 GB
@BeiGeJin would you be up for making a quick PR to fix the issue? I would start by using TDD (test-driven development) to add a minimal new test to mne/preprocessing/tests/test_ica.py that causes the error you see at the top, then add your fix and see that the test passes.
Description of the problem
I think there might be a bug in the _source_as_raw function, here it assigns [self.last_samp] to self._last_samps, however self.last_samp is a property function and it seems that if its wrapped in a list, it won't actually call this function until used later.
Steps to reproduce
Link to data
No response
Expected results
raw_concat and raw_sources should have the same length of data.
Actual results
But raw_sources only have the length of data corresponding to the first object in the list that we concatenate.
Additional information
Platform Linux-3.10.0-957.1.3.el7.x86_64-x86_64-with-glibc2.17
Python 3.12.2 | packaged by conda-forge | (main, Feb 16 2024, 20:50:58) [GCC 12.3.0]
Executable /home/jerryjin/miniconda3/envs/meg/bin/python
CPU x86_64 (16 cores)
Memory 46.9 GB
Core
├☒ mne 1.8.0 (outdated, release 1.9.0 is available!)
├☑ numpy 1.26.4 (MKL 2023.2-Product with 16 threads)
├☑ scipy 1.14.1
└☑ matplotlib 3.9.2 (backend=module://matplotlib_inline.backend_inline)
Numerical (optional)
├☑ sklearn 1.5.1
├☑ numba 0.60.0
├☑ pandas 2.2.2
├☑ h5py 3.11.0
└☐ unavailable nibabel, nilearn, dipy, openmeeg, cupy, h5io
Visualization (optional)
├☑ qtpy 2.4.1 (None=None)
├☑ pyqtgraph 0.13.7
├☑ mne-qt-browser 0.6.3
├☑ ipywidgets 8.1.5
└☐ unavailable pyvista, pyvistaqt, vtk, ipympl, trame_client, trame_server, trame_vtk, trame_vuetify
Ecosystem (optional)
└☐ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, edfio, mffpy, pybv
The text was updated successfully, but these errors were encountered: