LukeTheHecker / esinet

EEG inverse solution with artificial neural networks. This package works with MNE-Python data structures for easy integration into your MNE-based M/EEG code
MIT License
38 stars 9 forks source link

AttributeError: 'Info' object has no attribute 'pick_channels' #8

Closed MapLsc closed 6 months ago

MapLsc commented 1 year ago

Hello, when I was running "qucik_start", I encountered the following error: `AttributeError Traceback (most recent call last) Cell In[1], line 11 9 # Simulate M/EEG data 10 settings = dict(duration_of_trial=0.1) ---> 11 sim = Simulation(fwd, info, settings=settings) 12 sim.simulate(n_samples=1000) 14 # Train neural network (LSTM) on the simulated data

File ~.conda\envs\EsiNet\lib\site-packages\esinet\simulation.py:84, in Simulation.init(self, fwd, info, settings, n_jobs, parallel, verbose) 82 self.fwd = deepcopy(fwd) 83 self.fwd.pick_channels(info['ch_names']) ---> 84 self.check_info(deepcopy(info)) 86 self.check_settings() 87 self.settings['sample_frequency'] = info['sfreq']

File ~.conda\envs\EsiNet\lib\site-packages\esinet\simulation.py:108, in Simulation.check_info(self, info) 107 def check_info(self, info): --> 108 self.info = info.pick_channels(self.fwd.ch_names, ordered=True)

AttributeError: 'Info' object has no attribute 'pick_channels'` I wonder if this is because of a problem with the version of a certain library or because some parameters are not set in the code. I would appreciate it if you could give me some guidance!

johnkylecooper commented 1 year ago

Hi @MapLsc, I had the same problem and the reason behind this is that MNE has made pick_channels deprecated, so we need a workaround. I rewrote the function to address these changes. You can replace the current function in the source code with this. I think that you'll then run into some further problems, but I'm going to also post an issue to address these.

def check_info(self, info):
        self.info = mne.pick_info(info, mne.pick_channels(info['ch_names'], include=self.fwd.ch_names, ordered=True))
MapLsc commented 1 year ago

Hi @MapLsc, I had the same problem and the reason behind this is that MNE has made pick_channels deprecated, so we need a workaround. I rewrote the function to address these changes. You can replace the current function in the source code with this. I think that you'll then run into some further problems, but I'm going to also post an issue to address these.

def check_info(self, info):
        self.info = mne.pick_info(info, mne.pick_channels(info['ch_names'], include=self.fwd.ch_names, ordered=True))

I took your advice and successfully solved the problem, thank you so much for your help, if I run into further problems, wish I could continue to consult you.

LukeTheHecker commented 6 months ago

Thank you for helping each other. I have fixed this in the newest version of the package that will be released later today.