Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array must not contain infs or NaNs #340

Open
KMIsenburg opened this issue Apr 20, 2021 · 7 comments
Open

array must not contain infs or NaNs #340

KMIsenburg opened this issue Apr 20, 2021 · 7 comments

Comments

@KMIsenburg
Copy link

Is your feature request related to a problem? Please describe.
I'm running nibetaseries on a group of 25 subjects, each with 4-6 runs at the participant level. It seems to work for most of the participants and most of the runs, and the output files look food. However, for several runs I get the same error in my crash files (will post an example below). The problem is that the error doesn't tell me which array contains NaNs. I double checked my regressor tsv files and can't find any na/a or NaNs in the columns that I've selected as confounds.

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

Describe the solution you'd like
It would be helpful to know which file of mine is generating this error/

Describe alternatives you've considered
I've tried looking through the tsv files for the confound regressors because I assumed NaNs would be coming from here, but it doesn't seem like it is the issue unless 0s can also generate this error.

Thanks for your help :)

@jdkent
Copy link
Member

jdkent commented Apr 29, 2021

0s should not generate that error (AFAIK), could you share what your call to nibetaseries looks like and your events file/confounds file for a problematic participant?

@KMIsenburg
Copy link
Author

KMIsenburg commented Apr 29, 2021

Hi James,

Attached is a screenshot of my script that calls nibetaseries, an events file and the confounds file for a problematic run. Just to note, all of the other runs for this participant worked.

The events file and regressor file are tsv but I changed to txt to allow for upload.
Screen Shot 2021-04-29 at 11 07 41 AM

sub-01_ses-1_task-omgspa_run-01_desc-confounds_regressors.txt
sub-01_ses-1_task-omgspa_run-01_events.txt

@KMIsenburg
Copy link
Author

By the way I want to make a note above, I used more than just white_matter, I also used csf, trans_x, trans_y, trans_z, rot_x, rot_y, rot_z

If I try re-running with just white_matter it works...so the error has to be coming from either csf or one of the movement parameters.

@jdkent
Copy link
Member

jdkent commented Apr 29, 2021

If you could upgrade to the 0.6.0 release, it may fix the issue you are having, if not, I can take a deeper look: https://hub.docker.com/r/hbclab/nibetaseries/tags?page=1&ordering=last_updated

@KMIsenburg
Copy link
Author

Thanks James, let me see what I can do in terms of upgrading!

@Tsjitsjikow
Copy link

As posted here: https://neurostars.org/t/error-with-nans-in-nibetaseries/19153/5;

The rotation parameters (as well as others) of your confounds file are incomplete. This is probably causing the issue :-).

@KMIsenburg
Copy link
Author

Hi @jdkent I've fixed the issue - somehow some of my tsv files were compromised and parts of the latter rows were completely cut off. All taken care of, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants