Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.3
python-nilearn
nilearn-fix-aarch64.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File nilearn-fix-aarch64.patch of Package python-nilearn
From 92ff7284c3e9ce921129d99ccb81f7a21572aa9f Mon Sep 17 00:00:00 2001 From: KamalakerDadi <dkamalakarreddy@gmail.com> Date: Sat, 14 Nov 2020 05:15:53 +0100 Subject: [PATCH] FIX testing issues with nans and infs on ARM --- doc/whats_new.rst | 8 ++++++++ nilearn/input_data/tests/test_nifti_labels_masker.py | 5 +++-- nilearn/masking.py | 2 +- nilearn/regions/tests/test_region_extractor.py | 5 +++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/doc/whats_new.rst b/doc/whats_new.rst index d128ef5c0c..e2c6ce1b2e 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -1,3 +1,11 @@ +0.7.X +===== + +Fixes +----- + +- Fix testing issues on ARM machine. + .. _v0.7.0: 0.7.0 diff --git a/nilearn/input_data/tests/test_nifti_labels_masker.py b/nilearn/input_data/tests/test_nifti_labels_masker.py index 6324b10cf7..b61a89a1ff 100644 --- a/nilearn/input_data/tests/test_nifti_labels_masker.py +++ b/nilearn/input_data/tests/test_nifti_labels_masker.py @@ -117,8 +117,9 @@ def test_nifti_labels_masker_with_nans_and_infs(): labels_img = data_gen.generate_labeled_regions((13, 11, 12), affine=np.eye(4), n_regions=n_regions) - # nans - mask_data = get_data(mask_img) + # Introduce nans with data type float + # See issue: https://github.com/nilearn/nilearn/issues/2580 + mask_data = get_data(mask_img).astype(np.float32) mask_data[:, :, 7] = np.nan mask_data[:, :, 4] = np.inf mask_img = nibabel.Nifti1Image(mask_data, np.eye(4)) diff --git a/nilearn/masking.py b/nilearn/masking.py index c4c8ab36c3..a828e8a2e8 100644 --- a/nilearn/masking.py +++ b/nilearn/masking.py @@ -44,7 +44,7 @@ def _load_mask_img(mask_img, allow_empty=False): boolean version of the mask """ mask_img = _utils.check_niimg_3d(mask_img) - mask = get_data(mask_img) + mask = _safe_get_data(mask_img, ensure_finite=True) values = np.unique(mask) if len(values) == 1: diff --git a/nilearn/regions/tests/test_region_extractor.py b/nilearn/regions/tests/test_region_extractor.py index d8e8a9b56c..6600336134 100644 --- a/nilearn/regions/tests/test_region_extractor.py +++ b/nilearn/regions/tests/test_region_extractor.py @@ -355,14 +355,15 @@ def test_connected_label_regions(): # Test if unknown/negative integers are provided as labels in labels_img, # we raise an error and test the same whether error is raised. - labels_data = np.zeros(shape, dtype=np.int) + # Introduce data type of float, see issue: https://github.com/nilearn/nilearn/issues/2580 + labels_data = np.zeros(shape, dtype=np.float32) h0 = shape[0] // 2 h1 = shape[1] // 2 h2 = shape[2] // 2 labels_data[:h0, :h1, :h2] = 1 labels_data[:h0, :h1, h2:] = 2 labels_data[:h0, h1:, :h2] = 3 - labels_data[:h0, h1:, h2:] = 4 + labels_data[:h0, h1:, h2:] = -4 labels_data[h0:, :h1, :h2] = 5 labels_data[h0:, :h1, h2:] = 6 labels_data[h0:, h1:, :h2] = np.nan
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor