compute_chpi_locs doesn't stop to compute

Hello,

I’m trying to compute head positions in MEG process. I followed the steps of Extracting and visualizing subject head movement tutorial.

My problem is when I execute the mne.chpi.compute_chpi_locs method : it doesn’t stop to compute (I let it for more than 20 minutes…).
So I wonder what is wrong. chpi amplitudes seem to be computed well.

Here is the code I use :

raw = mne.io.read_raw_fif(path, allow_maxshield=True, on_split_missing=True).load_data()  
raw.pick(["meg", "bio"])

channels = {"BIO001":"EOGv", "BIO002":"EOGh", "BIO003":"ECG", "BIO004":"ERB"}
channel_types = {"EOGv": "eog", "EOGh": "eog", "ECG": "ecg", "ERB": "emg"}        

raw.rename_channels(mapping=channels)
raw.set_channel_types(channel_types)

chpi_amplitudes = mne.chpi.compute_chpi_amplitudes(raw) 
chpi_locs = mne.chpi.compute_chpi_locs(raw.info, chpi_amplitudes, verbose=True)

Here is infos I get when I execute the command :

Computing 4385 HPI location guesses (1 cm grid in a 10.7 cm sphere)
HPIFIT: 4 coils digitized in order 4 1 3 2
HPI consistency of isotrak and hpifit is OK.
0%| | cHPI locations : 0/17293 [00:00<?, ?it/s]

Thank you in advance !
Gontran

Hello @ggilles and welcome to the forum!

Do you think you could share some example data that shows the problem?

Thanks,
Richard

Hello Richard,

Thanks for your answer!

Unfortunately I can’t share any data because of ethical reasons…
Do you have any idea that could lead me to the issue ? Is it about encoding data ?

Thanks,
Gontran

Hello @ggilles,

I have no clue :slight_smile: and I’m afraid without example data, I cannot help.

@larsoner, do you have any idea what could be the cause of this?

It can be slow, but 20 minutes is pretty bad. Does the progress bar stay at 0%? If so, that’s definitely some sort of bug…

Either way, try cropping the data to the first 2 seconds and running again. Do you get any valid positions in the output? If not, how about for cropping to the first 10 seconds?

It’s going to be hard to diagnose and fix without access to the data :frowning: Can you share if you raw.anonymize() first? It should remove subject-specific information.

Actually you’re right Eric ! I cropped 2 seconds of data and it computed after 1 min.
My problem was that the status bar didn’t change, neither with the computation of amplitudes. So I tested on an other computer, and the status bar indicated it would take more than 2 hours for all data (a raw)

I’m trying to change some parameters (time step…) and see

Thank you for helping !

1 Like