mne-tools / mne-tools/mne-python
Unsupported array dtype in compute forward w/ HCP data
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.5k
- Forks
- 1.6k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 100
Description
Describe the bug
When computing a forward solution on HCP MEG data (following the tutorial), Numba complains about a dtype.
Steps to reproduce
I'm copying and pasting code from the MNE-HCP tutorial here
Expected results
I expected the mne.make_forward_solution call to succeed.
Actual results
>>> fwd = mne.make_forward_solution(info, trans=head_mri_t, bem=bem_sol, src=src_subject)
...
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
non-precise type pyobject
During: typing of argument at /Users/duke/miniforge3/lib/python3.9/site-packages/mne/forward/_compute_forward.py (132)
File "../../miniforge3/lib/python3.9/site-packages/mne/forward/_compute_forward.py", line 132:
def _do_lin_field_coeff(bem_rr, tris, tn, ta, rmags, cosmags, ws, bins):
<source elided>
"""
coeff = np.zeros((bins[-1] + 1, len(bem_rr)))
^
This error may have been caused by the following argument(s):
- argument 1: Unsupported array dtype: >i4
I guess this may be an m1 arm64 issue about integer sizes but not sure. This is Numba running natively and not through Rosetta 2 x86_64 emulation.
Additional information
Platform: macOS-12.3.1-arm64-arm-64bit
Python: 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:24:02) [Clang 11.1.0 ]
Executable: /Users/duke/miniforge3/bin/python3
CPU: arm: 10 cores
Memory: Unavailable (requires "psutil" package)
mne: 1.0.2
numpy: 1.20.3 {blas=NO_ATLAS_INFO, lapack=lapack}
scipy: 1.7.3
matplotlib: 3.5.0 {backend=module://matplotlib_inline.backend_inline}
sklearn: 1.0.1
numba: 0.54.1
nibabel: 3.2.2
nilearn: Not found
dipy: Not found
cupy: Not found
pandas: 1.3.4
pyvista: Not found
pyvistaqt: Not found
ipyvtklink: Not found
vtk: Not found
PyQt5: Not found
ipympl: Not found
pooch: v1.6.0
mne_bids: Not found
mne_nirs: Not found
mne_features: Not found
mne_qt_browser: Not found
mne_connectivity: Not found
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the HCP compute-forward tutorial and reproducing the failure at mne.make_forward_solution. Inspect mne/forward/_compute_forward.py, especially _do_lin_field_coeff and the dtype passed to it. Done means the tutorial's forward-solution call succeeds on the reported arm64 setup without the Numba dtype error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100