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

TypeError: Cannot cast ufunc multiply output from dtype('float64') to dtype('<i2') with casting rule 'same_kind' #563

Closed
jdkent opened this issue Jun 16, 2017 · 1 comment

Comments

@jdkent
Copy link
Collaborator

jdkent commented Jun 16, 2017

I generated the following error using fieldmaps from a GE scanner which had one fieldmap (in Hz) and a magnitude image. The error I received appears to be similar to numpy/numpy#7225.

Command

docker run --rm  \
-v /Users/jdkent/dev_env/test_data2:/data:ro \
-v /Users/jdkent/dev_env/test_data2/derivatives_fieldmap_dev:/out \
poldracklab/fmriprep:latest /data /out participant \
--participant_label GE161 -w /out/work \
--nthreads 16 --omp-nthreads 16 --mem_mb 21000 \
--no-freesurfer --write-graph --debug --template MNI152NLin2009cAsym

ERROR

170616-18:07:40,708 workflow ERROR:
	 ['Node torads failed to run on host 17e760022550.']
170616-18:07:40,714 workflow INFO:
	 Saving crash info to /out/fmriprep/sub-GE161/log/20170616-180438_5f900bfa-47e8-4ccb-8bef-68a59df983c6/crash-20170616-180740-root-torads-db37a3ce-e9fb-4ca8-8040-91463b4d8e05.pklz
170616-18:07:40,715 workflow INFO:
	 Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py", line 52, in run_node
    result['result'] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 372, in run
    self._run_interface()
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 482, in _run_interface
    self._result = self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 613, in _run_command
    result = self._interface.run()
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base.py", line 1083, in run
    runtime = self._run_wrapper(runtime)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base.py", line 1031, in _run_wrapper
    runtime = self._run_interface(runtime)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/utility/wrappers.py", line 192, in _run_interface
    out = function_handle(**args)
  File "<string>", line 13, in _torads
TypeError: Cannot cast ufunc multiply output from dtype('float64') to dtype('<i2') with casting rule 'same_kind'
Interface Function failed to run. 

My fix:
fmapdata *= (pi / cutoff) becomes fmapdata = fmapdata * (pi / cutoff)

fmapdata *= (cutoff_hz / pi) becomes fmapdata = fmapdata * (cutoff_hz / pi)

Not as pretty as *=, but the fix works for me.

Let me know if you need more details/access to files.

Side question: how would I submit this as a pull request while I'm still working on ICA_AROMA on my fork, do I need to make another branch from my fork, do a hard reset with the poldrack/fmriprep master branch (to get rid of the ICA_AROMA changes), make my change and then create a new pull request from that branch?

@chrisgorgo
Copy link
Contributor

You can do:

git checkout 7192829
git checkout -b fix/fieldmaps

Commit your changes there and push them to your repo. Then open a PR. In the future it's better not to make any commits to master and use branches for fixes and features.

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

2 participants