Error with NaNs in nibetaseries

I’m running nibetaseries on a series of runs and participants using fmriprep. All of my subjects have somewhere around 4-6 runs, they are all in BIDS format, and they all include fmripep files necessary for nibetaseries to run. I’m running at the participant level so in this case it gives me output files for every run.

My problem is that nibetaseries properly runs on half of these participants, and then the other half it runs on all of their runs except for 1-2 of them.

The error I get isn’t super helpful because I can’t tell where it’s coming from. It looks like this:

Traceback (most recent call last):
File “/opt/miniconda-latest/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py”, line 69, in run_node
result[‘result’] = node.run(updatehash=updatehash)
File “/opt/miniconda-latest/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 473, in run
result = self._run_interface(execute=True)
File “/opt/miniconda-latest/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 557, in _run_interface
return self._run_command(execute)
File “/opt/miniconda-latest/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 637, in _run_command
result = self._interface.run(cwd=outdir)
File “/opt/miniconda-latest/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 375, in run
runtime = self._run_interface(runtime)
File “/opt/miniconda-latest/lib/python3.7/site-packages/nibetaseries/interfaces/nistats.py”, line 90, in _run_interface
confounds=confounds)
File “/opt/miniconda-latest/lib/python3.7/site-packages/nistats/first_level_model.py”, line 441, in fit
confounds_names, self.min_onset)
File “/opt/miniconda-latest/lib/python3.7/site-packages/nistats/design_matrix.py”, line 411, in make_first_level_design_matrix
matrix, _ = full_rank(matrix)
File “/opt/miniconda-latest/lib/python3.7/site-packages/nistats/utils.py”, line 256, in full_rank
U, s, V = spl.svd(X, full_matrices=False)
File “/opt/miniconda-latest/lib/python3.7/site-packages/scipy/linalg/decomp_svd.py”, line 109, in svd
a1 = _asarray_validated(a, check_finite=check_finite)
File “/opt/miniconda-latest/lib/python3.7/site-packages/scipy/_lib/_util.py”, line 239, in _asarray_validated
a = toarray(a)
File “/opt/miniconda-latest/lib/python3.7/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

My regressors tsv file has no NaN values so it can’t be coming from that.

Any help appreciated !

Best,
Kylie

Hi @kylieisenburg

Not an expert myself, but the error message does seem to suggest there’s an issue with the confounds. Maybe you could thoroughly compare .tsv files of erroneous runs/subjects with successful ones?

Additionally, sharing the confounds file(s) (as .txt) of erroneous runs/subjects may help (others) too.

Hi Leo,

Thanks for your response I really appreciate it. I’ve tried to do that and I can’t see what the problem would be. I’m attaching one file from a successful run and one from a non successful run of the same participant.

There are n/a values in this file, but 1) I’m not using any of those confounds in my analysis so it shouldn’t even pull from those columns… 2) both the successful run and the non-successful run have n/a values in the same columns, and 3) I replaced them with 0s and tried again and it still didn’t work.

Let me know if you have any ideas!

Best,
Kylie

Sorry Leo it says I can’t upload attachments because I’m a new user so not really sure where to go from here

Hi Kylie,

That’s unfortunate! I guess it takes some time before you can upload files? Maybe you could try to upload elsewhere.

Having said that, I don’t know if the problem is indeed caused by the confounds. It is only my suspicion… Some things that I would try/ check would be:

  • Did you check for inf values too? (just to be sure)
  • Is file naming correct? (once had an issue with that myself)
  • Is the length of the functional run identical to that of the confounds file?
  • What happens if you try the erroneous runs with less/no confound regressors?
  • Have you tried running a first level model for the troublesome runs? (with same events)

Best,

Leo

Hi Leo,

These are great ideas…let me try to work through some of these today/tomorrow and get back to you on If any of these work. Thanks so much!

Best,
Kylie

Hi Kylie,

I noticed that you posted a confounds file at: array must not contain infs or NaNs · Issue #340 · HBClab/NiBetaSeries · GitHub.

For reference I’m also uploading it here. There does seem to be an issue; with data missing for some regressors starting from row 191 (e.g. rot_x,rot_z,rot_y). This may explain the issue…

Best,

Leo

sub-01_ses-1_task-omgspa_run-01_desc-confounds_regressors.txt (1.1 MB)

Hi Leo,

Thanks a lot, you were right. Somehow some of my files were compromised. I hope this will fix the issue. Thanks so much!

Best ,
Kylie

@lvbrussel This fixed the issue - thanks again Leo!

MANAGED BY INCF