nipy / nibabel

Python package to access a cacophony of neuro-imaging file formats
http://nipy.org/nibabel/
Other
649 stars 258 forks source link

Filter upstream warning raised by `np.finfo(np.longdouble)` on WSL1 #1310

Closed joshuacwnewton closed 6 months ago

joshuacwnewton commented 6 months ago

Description

This PR filters an upstream warning regarding broken support for np.longdouble, raised by np.finfo(np.longdouble) when numpy>=1.25 is used on WSL1.

UserWarning: Signature b'\x00\xd0\xcc\xcc\xcc\xcc\xcc\xcc\xfb\xbf\x00\x00\x00\x00\x00\x00' for
<class 'numpy.longdouble'> does not match any known type: falling back to type probe function.
This warnings indicates broken support for the dtype!
 machar = _get_machar(dtype)

NB: The context in which type_info is called on np.longdouble is here:

https://github.com/nipy/nibabel/blob/0e925abb15e2dfbeecaaca4e7c2479b9d3e2cec0/nibabel/casting.py#L664-L670

https://github.com/nipy/nibabel/blob/0e925abb15e2dfbeecaaca4e7c2479b9d3e2cec0/nibabel/casting.py#L685

Given that nibabel already tries to avoid np.longdouble on Windows, I think it should be fine to filter this warning?

Notes:

Related issues/PRs

Fixes #1309.

effigies commented 6 months ago

Thanks for this! Yeah, I think detecting the platform is overkill and would suggest just ignoring unconditionally.

effigies commented 6 months ago

LGTM. Please feel free to add your name, affiliation and ORCID to https://github.com/nipy/nibabel/blob/master/.zenodo.json in order to be credited as an author on future releases.

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.27%. Comparing base (0e925ab) to head (50dd737).

:exclamation: Current head 50dd737 differs from pull request most recent head 2978ee8. Consider uploading reports for the commit 2978ee8 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1310 +/- ## ======================================= Coverage 92.27% 92.27% ======================================= Files 99 99 Lines 12460 12462 +2 Branches 2561 2562 +1 ======================================= + Hits 11497 11499 +2 Misses 641 641 Partials 322 322 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

joshuacwnewton commented 6 months ago

LGTM. Please feel free to add your name, affiliation and ORCID to https://github.com/nipy/nibabel/blob/master/.zenodo.json in order to be credited as an author on future releases.

My apologies for not understanding, but should I edit this file in the context of this PR? Or, separately?

(Looking at the history of this file, many of the edits appear to be authored by yourself, hence my confusion.)

    {
      "affiliation": "Polytechnique Montréal, Montréal, CA",
      "name": "Newton, Joshua",
      "orcid": "0009-0005-6963-3812"
    },
effigies commented 6 months ago

I'm listed as the author because we have a script to reorder them (and I do also add them sometimes).

Please go ahead and add it yourself in this PR.