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

MAINT: Make call to scipy.stats.mode compatible with scipy 1.11.0 #371

Merged
merged 1 commit into from
Jul 6, 2023

Conversation

HippocampusGirl
Copy link
Contributor

Starting with scipy 1.11.0, scipy.stats.mode returns a scalar value for the mode instead of a one-element array. This change was foreshadowed in scipy version 1.9.0 with the addition of the keepdims parameter, with the eventual goal of setting it to false by default for consistency with other scipy.stats functions.
This change is causing the _demean function to break, because it currently relies on indexing the resulting array.

NodeExecutionError: Exception raised while executing Node demean.

Traceback:
        Traceback (most recent call last):
          File "/usr/local/miniconda/lib/python3.11/site-packages/nipype/interfaces/base/core.py", line 397, in run
            runtime = self._run_interface(runtime)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/local/miniconda/lib/python3.11/site-packages/nipype/interfaces/utility/wrappers.py", line 142, in _run_interface
            out = function_handle(**args)
                  ^^^^^^^^^^^^^^^^^^^^^^^
          File "<string>", line 26, in _demean
        IndexError: invalid index to scalar variable.

See scipy/scipy#16418 for the initial proposal and scipy/scipy#17561 for the final change that is now breaking the _demean function.

This commit changes the indexing to be compatible with scipy 1.11.0 and other future versions. I have also tested this change with older scipy versions up to 0.17.1, which was released in 2016.

Starting with scipy 1.11.0, scipy.stats.mode returns a scalar value for
the mode instead of a one-element array. This change was foreshadowed in
scipy version 1.9.0 with the addition of the `keepdims` parameter,
with the eventual goal of setting it to false by default for consistency
with other scipy.stats functions.
See scipy/scipy#16418 for the initial
proposal and scipy/scipy#17561 for the
final change that is now breaking the _demean function.

This commit changes the indexing to be compatible with scipy 1.11.0
and other future versions. I have also tested this change with older
scipy versions up to 0.17.1, which was released in 2016.
@HippocampusGirl
Copy link
Contributor Author

The CI error seems to be a FreeSurfer license issue, so not related to the proposed change.

ERROR: FreeSurfer license file /opt/freesurfer/license.txt not found.

@effigies
Copy link
Member

effigies commented Jul 6, 2023

Pushed to a local branch to ensure CI has access to any secrets needed. https://app.circleci.com/pipelines/github/nipreps/sdcflows/1543/workflows/8fda487f-2ebc-46d4-82e5-eb99b8ec638f / #372.

@effigies effigies merged commit 0f91a0c into nipreps:maint/1.3.x Jul 6, 2023
effigies added a commit that referenced this pull request Jul 7, 2023
1.3.4 (July 07, 2023)

Bug-fix release in 1.3.x series.

* FIX: Limit ``3dQwarp`` to maximum 4 CPUs for stability reasons (#128)
* MAINT: Make call to scipy.stats.mode compatible with scipy 1.11.0 (#371)
* CI: Update docker/machine images for 1.3.x branch (#327)
effigies added a commit to nipreps/fmriprep that referenced this pull request Jul 18, 2024
20.2.8 (July 18, 2024)

Bug-fix release in the 20.2.x LTS series.

We anticipate this being the final release in the 20.2.x LTS series.

* FIX: Select volumetric dseg.tsv from recent TemplateFlow releases (#3257)
* FIX: LTS package build (#3328)
* DOC: Read html_baseurl from RTD environment, if available (#3324)
* DOCKER: Pin conda environment more strictly (#2853)
* MNT: Require niworkflows ~1.3.6 (#2740)
* CI: Upgrade docker orb (#2865)

This release includes a number of fixes that have accumulated in niworkflows,
including the following fixes that affect fMRIPrep:

* FIX: Remove unused ANTs parameter that was removed in 2.4.1 (nipreps/sdcflows#431)
* FIX: Limit 3dQwarp to maximum 4 CPUs for stability reasons (nipreps/sdcflows#128)
* MAINT: Make call to scipy.stats.mode compatible with scipy 1.11.0 (nipreps/sdcflows#371)
* FIX: TSV2JSON should convert empty TSV files to empty JSON files (nipreps/niworkflows#747)
* FIX: Use copy function that does not preserve mtime when creating fsaverage
  directories (nipreps/niworkflows#703)
* FIX: Set pixdim[4] to match RepetitionTime (nipreps/niworkflows#679)
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

Successfully merging this pull request may close these issues.

2 participants