Error running tedana, during ica.tedica

Hi everyone,

I have encountered a perplexing error while running tedana. I acquired 167 EPIs with three echoes (TEs, in ms = 14, 31.28, 48.56). Prior to running tedana, per suggestions on the tedana website, I applied slice-timing correction to all three echo series. I estimated realignment parameters for the short echo and applied the estimated transformation matrices to respective volumes within the subsequent echoes. I derived a binary brain mask from the co-registered T1-MPRAGE and resliced the mask into EPI dimensions (68x68x45).

Last week, I ran the following tedana command with no problems:

tedana -d ~/epi/ammj_15_e1.nii ~/epi/ammj_15_e2.nii ~/epi/ammj_15_e3.nii -e 14 31.28 48.56 --out-dir ~/epi/tedana --mask ~/struc/mask.nii

This week, however, I tried the same command on the exact same data (not recomputed data, files unchanged from before successful tedana run) and encountered this error:

INFO io:init:106 Generating figures directory: ~/epi/tedana/figures
INFO tedana:tedana_workflow:536 Using user-defined mask
INFO tedana:tedana_workflow:584 Computing T2* map
INFO combine:make_optcom:242 Optimally combining data with voxel-wise T2* estimates
INFO tedana:tedana_workflow:609 Writing optimally combined data set: ~/epi/tedana/desc-optcom_bold.nii.gz
INFO pca:tedpca:227 Computing PCA of optimally combined multi-echo data
INFO collect:generate_metrics:123 Calculating weight maps
INFO collect:generate_metrics:132 Calculating parameter estimate maps for optimally combined data
INFO collect:generate_metrics:145 Calculating z-statistic maps
INFO collect:generate_metrics:155 Calculating F-statistic maps
INFO collect:generate_metrics:165 Thresholding z-statistic maps
INFO collect:generate_metrics:172 Calculating T2* F-statistic maps
INFO collect:generate_metrics:179 Calculating S0 F-statistic maps
INFO collect:generate_metrics:187 Counting significant voxels in T2* F-statistic maps
INFO collect:generate_metrics:193 Counting significant voxels in S0 F-statistic maps
INFO collect:generate_metrics:200 Thresholding optimal combination beta maps to match T2* F-statistic maps
INFO collect:generate_metrics:206 Thresholding optimal combination beta maps to match S0 F-statistic maps
INFO collect:generate_metrics:213 Calculating kappa and rho
INFO collect:generate_metrics:222 Calculating variance explained
INFO collect:generate_metrics:228 Calculating normalized variance explained
INFO collect:generate_metrics:236 Calculating DSI between thresholded T2* F-statistic and optimal combination beta maps
/usr/lib/python3.6/site-packages/tedana/utils.py:211: RuntimeWarning: invalid value encountered in true_divide
dsi = (2.0 * intersection.sum(axis=axis)) / arr_sum
INFO collect:generate_metrics:247 Calculating DSI between thresholded S0 F-statistic and optimal combination beta maps
INFO collect:generate_metrics:257 Calculating signal-noise t-statistics
INFO collect:generate_metrics:295 Counting significant noise voxels from z-statistic maps
INFO collect:generate_metrics:306 Calculating decision table score
INFO pca:tedpca:314 Selected 19 components with mdl dimensionality detection
Traceback (most recent call last):
File “/usr/bin/tedana”, line 8, in
sys.exit(_main())
File “/usr/lib/python3.6/site-packages/tedana/workflows/tedana.py”, line 905, in _main
tedana_workflow(**kwargs)
File “/usr/lib/python3.6/site-packages/tedana/workflows/tedana.py”, line 638, in tedana_workflow
dd, n_components, seed, maxit, maxrestart=(maxrestart - n_restarts)
File “/usr/lib/python3.6/site-packages/tedana/decomposition/ica.py”, line 71, in tedica
ica.fit(data)
File “/usr/lib64/python3.6/site-packages/sklearn/decomposition/_fastica.py”, line 574, in fit
self._fit(X, compute_sources=False)
File “/usr/lib64/python3.6/site-packages/sklearn/decomposition/_fastica.py”, line 512, in _fit
W, n_iter = _ica_par(X1, **kwargs)
File “/usr/lib64/python3.6/site-packages/sklearn/decomposition/_fastica.py”, line 110, in _ica_par
- g_wtx[:, np.newaxis] * W)
File “/usr/lib64/python3.6/site-packages/sklearn/decomposition/_fastica.py”, line 57, in _sym_decorrelation
s, u = linalg.eigh(np.dot(W, W.T))
File “/usr/lib64/python3.6/site-packages/scipy/linalg/decomp.py”, line 374, in eigh
a1 = _asarray_validated(a, check_finite=check_finite)
File “/usr/lib64/python3.6/site-packages/scipy/_lib/_util.py”, line 239, in _asarray_validated
a = toarray(a)
File “/usr/lib64/python3.6/site-packages/numpy/lib/function_base.py”, line 496, in asarray_chkfinite
“array must not contain infs or NaNs”)
ValueError: array must not contain infs or NaNs

From the tedana*.tsv file generated during the successful run I can figure that this occurs during ica.tedica. The following images are generated by tedana prior to the error: 1) S0map.nii.gz, 2) T2starmap.nii.gz, 3) desc-optcom_bold.nii.gz, 4) desc-adaptiveGoodSignal_mask.nii.gz. Comparing these files between the successful run with the unsuccessful run, I confirmed that the values are identical.

However, desc-PCA_stat-z_components.nii.gz differs between the runs. The preceding step, pca.tedpca, returns a different number of components between the runs (successful run: 25, unsuccessful run: 19). It is not clear to me what causes this discrepancy.

No software was changed/updated. As I mentioned, imaging data are the same. I would greatly appreciate any suggestions as to what is causing this problem or how to solve it.

Kind regards,
Patrick

Hey Patrick, thanks for reaching out!

Could you please share the tedana*.tsv files?

Thanks!

1 Like

Hi Eneko,

It appears that, being a newbie to neurostars, I am unable to upload attachments. See below for C+P of two *tsv outputs:

*** UNSUCCESSFUL RUN BEGIN ***

2021-12-03T11:52:39 tedana.tedana_workflow INFO Using output directory: ~/epi/tedana
2021-12-03T11:52:39 tedana.tedana_workflow INFO Loading input data: [’~/epi/ammj_15_e1.nii’, ‘~/epi/ammj_15_e2.nii’, ‘~/epi/ammj_15_e3.nii’]
2021-12-03T11:52:43 io.init INFO Generating figures directory: ~/epi/tedana/figures
2021-12-03T11:52:43 tedana.tedana_workflow INFO Using user-defined mask
2021-12-03T11:52:43 tedana.tedana_workflow INFO Computing T2* map
2021-12-03T11:52:44 combine.make_optcom INFO Optimally combining data with voxel-wise T2* estimates
2021-12-03T11:52:47 tedana.tedana_workflow INFO Writing optimally combined data set: ~/epi/tedana/desc-optcom_bold.nii.gz
2021-12-03T11:52:47 pca.tedpca INFO Computing PCA of optimally combined multi-echo data
2021-12-03T11:52:55 collect.generate_metrics INFO Calculating weight maps
2021-12-03T11:52:56 collect.generate_metrics INFO Calculating parameter estimate maps for optimally combined data
2021-12-03T11:52:56 collect.generate_metrics INFO Calculating z-statistic maps
2021-12-03T11:52:56 collect.generate_metrics INFO Calculating F-statistic maps
2021-12-03T11:52:58 collect.generate_metrics INFO Thresholding z-statistic maps
2021-12-03T11:52:58 collect.generate_metrics INFO Calculating T2* F-statistic maps
2021-12-03T11:52:59 collect.generate_metrics INFO Calculating S0 F-statistic maps
2021-12-03T11:52:59 collect.generate_metrics INFO Counting significant voxels in T2* F-statistic maps
2021-12-03T11:52:59 collect.generate_metrics INFO Counting significant voxels in S0 F-statistic maps
2021-12-03T11:52:59 collect.generate_metrics INFO Thresholding optimal combination beta maps to match T2* F-statistic maps
2021-12-03T11:53:01 collect.generate_metrics INFO Thresholding optimal combination beta maps to match S0 F-statistic maps
2021-12-03T11:53:03 collect.generate_metrics INFO Calculating kappa and rho
2021-12-03T11:53:03 collect.generate_metrics INFO Calculating variance explained
2021-12-03T11:53:03 collect.generate_metrics INFO Calculating normalized variance explained
2021-12-03T11:53:03 collect.generate_metrics INFO Calculating DSI between thresholded T2* F-statistic and optimal combination beta maps
2021-12-03T11:53:03 collect.generate_metrics INFO Calculating DSI between thresholded S0 F-statistic and optimal combination beta maps
2021-12-03T11:53:03 collect.generate_metrics INFO Calculating signal-noise t-statistics
2021-12-03T11:53:03 collect.generate_metrics INFO Counting significant noise voxels from z-statistic maps
2021-12-03T11:53:03 collect.generate_metrics INFO Calculating decision table score
2021-12-03T11:53:04 pca.tedpca INFO Selected 19 components with mdl dimensionality detection

*** UNSUCCESSFUL RUN END ***

*** SUCCESSFUL RUN BEGIN ***

2021-11-23T14:36:17 tedana.tedana_workflow INFO Using output directory: ~/epi/tedana
2021-11-23T14:36:17 tedana.tedana_workflow INFO Loading input data: [’~/epi/ammj_15_e1.nii’, ‘~/epi/ammj_15_e2.nii’, ‘~/epi/ammj_15_e3.nii’]
2021-11-23T14:36:19 io.init INFO Generating figures directory: ~/epi/tedana/figures
2021-11-23T14:36:19 tedana.tedana_workflow INFO Using user-defined mask
2021-11-23T14:36:19 tedana.tedana_workflow INFO Computing T2* map
2021-11-23T14:36:21 combine.make_optcom INFO Optimally combining data with voxel-wise T2* estimates
2021-11-23T14:36:24 tedana.tedana_workflow INFO Writing optimally combined data set: ~/epi/tedana/desc-optcom_bold.nii.gz
2021-11-23T14:36:24 pca.tedpca INFO Computing PCA of optimally combined multi-echo data
2021-11-23T14:36:34 collect.generate_metrics INFO Calculating weight maps
2021-11-23T14:36:35 collect.generate_metrics INFO Calculating parameter estimate maps for optimally combined data
2021-11-23T14:36:35 collect.generate_metrics INFO Calculating z-statistic maps
2021-11-23T14:36:35 collect.generate_metrics INFO Calculating F-statistic maps
2021-11-23T14:36:39 collect.generate_metrics INFO Thresholding z-statistic maps
2021-11-23T14:36:39 collect.generate_metrics INFO Calculating T2* F-statistic maps
2021-11-23T14:36:39 collect.generate_metrics INFO Calculating S0 F-statistic maps
2021-11-23T14:36:40 collect.generate_metrics INFO Counting significant voxels in T2* F-statistic maps
2021-11-23T14:36:40 collect.generate_metrics INFO Counting significant voxels in S0 F-statistic maps
2021-11-23T14:36:40 collect.generate_metrics INFO Thresholding optimal combination beta maps to match T2* F-statistic maps
2021-11-23T14:36:46 collect.generate_metrics INFO Thresholding optimal combination beta maps to match S0 F-statistic maps
2021-11-23T14:36:49 collect.generate_metrics INFO Calculating kappa and rho
2021-11-23T14:36:49 collect.generate_metrics INFO Calculating variance explained
2021-11-23T14:36:49 collect.generate_metrics INFO Calculating normalized variance explained
2021-11-23T14:36:49 collect.generate_metrics INFO Calculating DSI between thresholded T2* F-statistic and optimal combination beta maps
2021-11-23T14:36:49 collect.generate_metrics INFO Calculating DSI between thresholded S0 F-statistic and optimal combination beta maps
2021-11-23T14:36:49 collect.generate_metrics INFO Calculating signal-noise t-statistics
2021-11-23T14:36:49 collect.generate_metrics INFO Counting significant noise voxels from z-statistic maps
2021-11-23T14:36:49 collect.generate_metrics INFO Calculating decision table score
2021-11-23T14:36:50 pca.tedpca INFO Selected 25 components with mdl dimensionality detection
2021-11-23T14:36:57 ica.tedica INFO ICA with random seed 42 converged in 52 iterations
2021-11-23T14:36:57 tedana.tedana_workflow INFO Making second component selection guess from ICA results
2021-11-23T14:36:57 collect.generate_metrics INFO Calculating weight maps
2021-11-23T14:36:58 collect.generate_metrics INFO Calculating parameter estimate maps for optimally combined data
2021-11-23T14:36:59 collect.generate_metrics INFO Calculating z-statistic maps
2021-11-23T14:36:59 collect.generate_metrics INFO Calculating F-statistic maps
2021-11-23T14:37:03 collect.generate_metrics INFO Thresholding z-statistic maps
2021-11-23T14:37:03 collect.generate_metrics INFO Calculating T2* F-statistic maps
2021-11-23T14:37:04 collect.generate_metrics INFO Calculating S0 F-statistic maps
2021-11-23T14:37:04 collect.generate_metrics INFO Counting significant voxels in T2* F-statistic maps
2021-11-23T14:37:04 collect.generate_metrics INFO Counting significant voxels in S0 F-statistic maps
2021-11-23T14:37:04 collect.generate_metrics INFO Thresholding optimal combination beta maps to match T2* F-statistic maps
2021-11-23T14:37:09 collect.generate_metrics INFO Thresholding optimal combination beta maps to match S0 F-statistic maps
2021-11-23T14:37:12 collect.generate_metrics INFO Calculating kappa and rho
2021-11-23T14:37:12 collect.generate_metrics INFO Calculating variance explained
2021-11-23T14:37:12 collect.generate_metrics INFO Calculating normalized variance explained
2021-11-23T14:37:12 collect.generate_metrics INFO Calculating DSI between thresholded T2* F-statistic and optimal combination beta maps
2021-11-23T14:37:12 collect.generate_metrics INFO Calculating DSI between thresholded S0 F-statistic and optimal combination beta maps
2021-11-23T14:37:12 collect.generate_metrics INFO Calculating signal-noise t-statistics
2021-11-23T14:37:12 collect.generate_metrics INFO Counting significant noise voxels from z-statistic maps
2021-11-23T14:37:12 collect.generate_metrics INFO Calculating decision table score
2021-11-23T14:37:12 tedica.kundu_selection_v2 INFO Performing ICA component selection with Kundu decision tree v2.5
2021-11-23T14:37:14 io.denoise_ts INFO Variance explained by decomposition: 86.57%
2021-11-23T14:37:17 io.write_split_ts INFO Writing high-Kappa time series: ~/epi/tedana/desc-optcomAccepted_bold.nii.gz
2021-11-23T14:37:19 io.write_split_ts INFO Writing low-Kappa time series: ~/epi/tedana/desc-optcomRejected_bold.nii.gz
2021-11-23T14:37:21 io.write_split_ts INFO Writing denoised time series: ~/epi/tedana/desc-optcomDenoised_bold.nii.gz
2021-11-23T14:37:22 io.writeresults INFO Writing full ICA coefficient feature set: ~/epi/tedana/desc-ICA_components.nii.gz
2021-11-23T14:37:22 io.writeresults INFO Writing denoised ICA coefficient feature set: ~/epi/tedana/desc-ICAAccepted_components.nii.gz
2021-11-23T14:37:24 io.writeresults INFO Writing Z-normalized spatial component maps: ~/epi/tedana/desc-ICAAccepted_stat-z_components.nii.gz
2021-11-23T14:37:24 tedana.tedana_workflow INFO Making figures folder with static component maps and timecourse plots.
2021-11-23T14:37:25 io.denoise_ts INFO Variance explained by decomposition: 86.57%
2021-11-23T14:37:45 tedana.tedana_workflow INFO Generating dynamic report
2021-11-23T14:37:45 tedana.tedana_workflow INFO Workflow completed

*** SUCCESSFUL RUN END ***

Kind regards,
Patrick

Thank you Patrick.

For what I see, the ICA step does not even start.

Would you feel comfortable sharing the data you used so that I can replicate the issue on my end? You can send it to e.urunuela[at]bcbl.eu

I’d like to see why the PCA results are different, because this may be happening in maPCA.

Thanks!

2 Likes

Hi Patrick,

I have just run the master version and v0.0.11 of tedana on your data with the command you used, and I got no error. I got 25 components like you did in your successful run.

What version did you run it on?

1 Like

Thanks, Eneko, for looking trying to replicate the error from your side. We are also running v0.0.11 of tedana.

After a bit more troubleshooting, it seems that my problem is related to our server environment. I encounter the error when I am logged on to one of our servers, but not when I am logged on to another of our servers. I suppose this stems from particular libraries differing between the servers, but that’s an issue on our end that I will examine more closely. My apologies for a bit of a run-around and thank you again for your assistance.

1 Like

That makes sense Patrick. I’m glad you found out what was going on there.

I guess that when you installed tedana, the installation already found some of the libraries on your server and didn’t update them.

It would be good to know what’s different between your two servers to make sure other people don’t have the same issue.

Thanks!