scot-dev / scot

EEG/MEG Source Connectivity Toolbox in Python
http://scot-dev.github.io/scot-doc/index.html
MIT License
58 stars 23 forks source link

math domain error #202

Closed ding00 closed 1 year ago

ding00 commented 1 year ago

when I was computing the DTF, I got an error : ValueError: math domain error

here is the traceback:

Traceback (most recent call last):
  File "/Users/wisejoker/Desktop/dingling/techniques/code/epilepsy_auxiliary_system/localization/dtf.py", line 70, in <module>
    compute_dtf(data_rootpath, patient_onset_path, save_root)
  File "/Users/wisejoker/Desktop/dingling/techniques/code/epilepsy_auxiliary_system/localization/dtf.py", line 57, in compute_dtf
    ws.do_mvarica()
  File "/Users/wisejoker/miniconda3/envs/py39pytorch/lib/python3.9/site-packages/scot/ooapi.py", line 226, in do_mvarica
    result = mvarica(x=self.data_[self.trial_mask_, :, :], cl=self.cl_[self.trial_mask_], var=self.var_,
  File "/Users/wisejoker/miniconda3/envs/py39pytorch/lib/python3.9/site-packages/scot/varica.py", line 113, in mvarica
    mx, ux = backend['ica'](cat_trials(r))
  File "/Users/wisejoker/miniconda3/envs/py39pytorch/lib/python3.9/site-packages/scot/backend_builtin.py", line 23, in wrapper_infomax
    u = infomax(datatools.cat_trials(data).T).T
  File "/Users/wisejoker/miniconda3/envs/py39pytorch/lib/python3.9/site-packages/scot/external/infomax_.py", line 245, in infomax
    angledelta = math.acos(np.sum(delta * olddelta) /
ValueError: math domain error
cbrnr commented 1 year ago

This error occurs during ICA decomposition, which is taken from an external package (MNE). It would be helpful if you could debug and see what e.g. datatools.cat_trials(data).T looks like. You could store that array and then test it directly with the external Infomax function.

ding00 commented 1 year ago

I replaced the infomax() from the newest version of mne, it works, thank you!

cbrnr commented 1 year ago

Perfect, thanks for letting us know! We should also update it with the latest version.