Skip to content

Commit 46554ac

Browse files
authored
Merge branch 'master' into master
2 parents c515dc0 + 68a7cd4 commit 46554ac

File tree

427 files changed

+1683
-2271
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

427 files changed

+1683
-2271
lines changed

.codespellrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ skip = .git,*.pdf,*.svg,external
55
# whos - smth used in matlab things
66
# SMAL - Stanford CNI MRS Library
77
# Suh - name
8-
# noo,crasher - field/var name used
8+
# noo,crasher,afile - field/var name used
99
# Reson - short journal name
1010
# ALS, FWE - neuroimaging specific abbrevs
1111
# Comision - foreign word used
12-
ignore-words-list = te,inport,objekt,jist,nd,hel,inout,fith,whos,fot,ue,shs,smal,nam,filetest,suh,noo,reson,als,fwe,crasher,comision
12+
ignore-words-list = te,inport,objekt,jist,nd,hel,inout,fith,whos,fot,ue,shs,smal,nam,filetest,suh,noo,reson,als,fwe,crasher,comision,afile

.github/workflows/tests.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ jobs:
9090
runs-on: ${{ matrix.os }}
9191
strategy:
9292
matrix:
93-
os: ['ubuntu-20.04']
94-
python-version: [3.7, 3.8, 3.9, "3.10"]
93+
os: ['ubuntu-22.04']
94+
python-version: ['3.8', '3.9', '3.10', '3.11']
9595
check: ['test']
9696
pip-flags: ['']
9797
depends: ['REQUIREMENTS']
9898
deb-depends: [false]
9999
nipype-extras: ['doc,tests,profiler']
100100
include:
101-
- os: ubuntu-20.04
102-
python-version: 3.8
101+
- os: ubuntu-22.04
102+
python-version: '3.8'
103103
check: test
104104
pip-flags: ''
105105
depends: REQUIREMENTS

.pre-commit-config.yaml

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
55
rev: v4.4.0
66
hooks:
7-
- id: trailing-whitespace
8-
- id: end-of-file-fixer
9-
- id: check-yaml
10-
- id: check-added-large-files
11-
- repo: https://github.com/psf/black
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/psf/black
1212
rev: 23.3.0
1313
hooks:
14-
- id: black
14+
- id: black
15+
- repo: https://github.com/codespell-project/codespell
16+
rev: v2.2.5
17+
hooks:
18+
- id: codespell

.readthedocs.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
# Required
55
version: 2
66

7+
# Set the OS, Python version and other tools you might need
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.10"
12+
713
# Build documentation in the docs/ directory with Sphinx
814
sphinx:
915
configuration: doc/conf.py
@@ -12,9 +18,10 @@ sphinx:
1218
formats:
1319
- htmlzip
1420

15-
# Optionally set the version of Python and requirements required to build your docs
21+
# Optional but recommended, declare the Python requirements required
22+
# to build your documentation
23+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
1624
python:
17-
version: 3.7
1825
install:
1926
- requirements: doc/requirements.txt
2027
- method: pip

.zenodo.json

+5
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,11 @@
379379
{
380380
"name": "Schwartz, Yannick"
381381
},
382+
{
383+
"affiliation": "Medical College of Wisconsin",
384+
"name": "Espana, Lezlie",
385+
"orcid": "0000-0002-6466-4653"
386+
},
382387
{
383388
"affiliation": "The University of Iowa",
384389
"name": "Ghayoor, Ali",

doc/conf.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# emacs: -*- coding: utf-8; mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
2-
# vi: set fileencoding=utf-8 ft=python sts=4 ts=4 sw=4 et:
31
#
42
# nipype documentation build configuration file, created by
53
# sphinx-quickstart on Mon Jul 20 12:30:18 2009.
@@ -151,8 +149,8 @@
151149
master_doc = "index"
152150

153151
# General information about the project.
154-
project = u"nipype"
155-
copyright = u"2009-21, Neuroimaging in Python team"
152+
project = "nipype"
153+
copyright = "2009-21, Neuroimaging in Python team"
156154

157155
# The version info for the project you're documenting, acts as replacement for
158156
# |version| and |release|, also used in various other places throughout the

doc/devel/matlab_example1.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
from nipype.interfaces.matlab import MatlabCommand
2-
from nipype.interfaces.base import TraitedSpec, \
3-
BaseInterface, BaseInterfaceInputSpec, File
2+
from nipype.interfaces.base import (
3+
TraitedSpec,
4+
BaseInterface,
5+
BaseInterfaceInputSpec,
6+
File,
7+
)
48
import os
59
from string import Template
610

@@ -19,14 +23,15 @@ class ConmapTxt2Mat(BaseInterface):
1923
output_spec = ConmapTxt2MatOutputSpec
2024

2125
def _run_interface(self, runtime):
22-
d = dict(in_file=self.inputs.in_file,
23-
out_file=self.inputs.out_file)
26+
d = dict(in_file=self.inputs.in_file, out_file=self.inputs.out_file)
2427
# This is your MATLAB code template
25-
script = Template("""in_file = '$in_file';
28+
script = Template(
29+
"""in_file = '$in_file';
2630
out_file = '$out_file';
2731
ConmapTxt2Mat(in_file, out_file);
2832
exit;
29-
""").substitute(d)
33+
"""
34+
).substitute(d)
3035

3136
# mfile = True will create an .m file with your script and executed.
3237
# Alternatively

doc/devel/matlab_example2.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55

66
class HelloWorldInputSpec(MatlabInputSpec):
7-
name = traits.Str(mandatory=True,
8-
desc='Name of person to say hello to')
7+
name = traits.Str(mandatory=True, desc='Name of person to say hello to')
98

109

1110
class HelloWorldOutputSpec(TraitedSpec):
@@ -29,6 +28,7 @@ class HelloWorld(MatlabCommand):
2928
>>> out = hello.run()
3029
>>> print out.outputs.matlab_output
3130
"""
31+
3232
input_spec = HelloWorldInputSpec
3333
output_spec = HelloWorldOutputSpec
3434

@@ -37,7 +37,9 @@ def _my_script(self):
3737
script = """
3838
disp('Hello %s Python')
3939
two = 1 + 1
40-
""" % (self.inputs.name)
40+
""" % (
41+
self.inputs.name
42+
)
4143
return script
4244

4345
def run(self, **inputs):

nipype/__init__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
32
# vi: set ft=python sts=4 ts=4 sw=4 et:
43
"""
@@ -26,14 +25,14 @@
2625
import faulthandler
2726

2827
faulthandler.enable()
29-
except (ImportError, IOError) as e:
28+
except (ImportError, OSError) as e:
3029
pass
3130

3231
config = NipypeConfig()
3332
logging = Logging(config)
3433

3534

36-
class NipypeTester(object):
35+
class NipypeTester:
3736
def __call__(self, doctests=True, parallel=False):
3837
try:
3938
import pytest

nipype/algorithms/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
32
# vi: set ft=python sts=4 ts=4 sw=4 et:
43
"""

nipype/algorithms/confounds.py

+20-25
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
32
# vi: set ft=python sts=4 ts=4 sw=4 et:
43
"""
@@ -150,7 +149,7 @@ class ComputeDVARS(BaseInterface):
150149

151150
def __init__(self, **inputs):
152151
self._results = {}
153-
super(ComputeDVARS, self).__init__(**inputs)
152+
super().__init__(**inputs)
154153

155154
def _gen_fname(self, suffix, ext=None):
156155
fname, in_ext = op.splitext(op.basename(self.inputs.in_file))
@@ -165,7 +164,7 @@ def _gen_fname(self, suffix, ext=None):
165164
if ext.startswith("."):
166165
ext = ext[1:]
167166

168-
return op.abspath("{}_{}.{}".format(fname, suffix, ext))
167+
return op.abspath(f"{fname}_{suffix}.{ext}")
169168

170169
def _run_interface(self, runtime):
171170
dvars = compute_dvars(
@@ -466,12 +465,12 @@ class CompCorInputSpec(BaseInterfaceInputSpec):
466465
"cosine",
467466
False,
468467
usedefault=True,
469-
desc="Detrend time series prior to component " "extraction",
468+
desc="Detrend time series prior to component extraction",
470469
)
471470
use_regress_poly = traits.Bool(
472471
deprecated="0.15.0",
473472
new_name="pre_filter",
474-
desc=("use polynomial regression " "pre-component extraction"),
473+
desc=("use polynomial regression pre-component extraction"),
475474
)
476475
regress_poly_degree = traits.Range(
477476
low=1, value=1, usedefault=True, desc="the degree polynomial to use"
@@ -584,7 +583,7 @@ class CompCor(SimpleInterface):
584583

585584
def __init__(self, *args, **kwargs):
586585
"""exactly the same as compcor except the header"""
587-
super(CompCor, self).__init__(*args, **kwargs)
586+
super().__init__(*args, **kwargs)
588587
self._header = "CompCor"
589588

590589
def _run_interface(self, runtime):
@@ -713,7 +712,7 @@ def _run_interface(self, runtime):
713712
self.inputs.pre_filter
714713
]
715714
ncols = filter_basis.shape[1] if filter_basis.size > 0 else 0
716-
header = ["{}{:02d}".format(ftype, i) for i in range(ncols)]
715+
header = [f"{ftype}{i:02d}" for i in range(ncols)]
717716
if skip_vols:
718717
old_basis = filter_basis
719718
# nrows defined above
@@ -724,7 +723,7 @@ def _run_interface(self, runtime):
724723
filter_basis[skip_vols:, :ncols] = old_basis
725724
filter_basis[:skip_vols, -skip_vols:] = np.eye(skip_vols)
726725
header.extend(
727-
["NonSteadyStateOutlier{:02d}".format(i) for i in range(skip_vols)]
726+
[f"NonSteadyStateOutlier{i:02d}" for i in range(skip_vols)]
728727
)
729728
np.savetxt(
730729
self._results["pre_filter_file"],
@@ -747,7 +746,7 @@ def _run_interface(self, runtime):
747746
not_retained = np.where(np.logical_not(metadata["retained"]))
748747
components_names[retained] = components_header
749748
components_names[not_retained] = [
750-
"dropped{}".format(i) for i in range(len(not_retained[0]))
749+
f"dropped{i}" for i in range(len(not_retained[0]))
751750
]
752751
with open(self._results["metadata_file"], "w") as f:
753752
f.write("\t".join(["component"] + list(metadata.keys())) + "\n")
@@ -768,7 +767,7 @@ def _make_headers(self, num_col):
768767
if isdefined(self.inputs.header_prefix)
769768
else self._header
770769
)
771-
headers = ["{}{:02d}".format(header, i) for i in range(num_col)]
770+
headers = [f"{header}{i:02d}" for i in range(num_col)]
772771
return headers
773772

774773

@@ -781,7 +780,7 @@ class ACompCor(CompCor):
781780

782781
def __init__(self, *args, **kwargs):
783782
"""exactly the same as compcor except the header"""
784-
super(ACompCor, self).__init__(*args, **kwargs)
783+
super().__init__(*args, **kwargs)
785784
self._header = "aCompCor"
786785

787786

@@ -807,7 +806,7 @@ class TCompCorInputSpec(CompCorInputSpec):
807806
class TCompCorOutputSpec(CompCorOutputSpec):
808807
# and all the fields in CompCorOutputSpec
809808
high_variance_masks = OutputMultiPath(
810-
File(exists=True), desc=(("voxels exceeding the variance" " threshold"))
809+
File(exists=True), desc=("voxels exceeding the variance threshold")
811810
)
812811

813812

@@ -832,7 +831,7 @@ class TCompCor(CompCor):
832831

833832
def __init__(self, *args, **kwargs):
834833
"""exactly the same as compcor except the header"""
835-
super(TCompCor, self).__init__(*args, **kwargs)
834+
super().__init__(*args, **kwargs)
836835
self._header = "tCompCor"
837836
self._mask_files = []
838837

@@ -854,10 +853,10 @@ def _process_masks(self, mask_images, timeseries=None):
854853
out_image = nb.Nifti1Image(mask_data, affine=img.affine, header=img.header)
855854

856855
# save mask
857-
mask_file = os.path.abspath("mask_{:03d}.nii.gz".format(i))
856+
mask_file = os.path.abspath(f"mask_{i:03d}.nii.gz")
858857
out_image.to_filename(mask_file)
859858
IFLOGGER.debug(
860-
"tCompcor computed and saved mask of shape %s to " "mask_file %s",
859+
"tCompcor computed and saved mask of shape %s to mask_file %s",
861860
str(mask.shape),
862861
mask_file,
863862
)
@@ -866,7 +865,7 @@ def _process_masks(self, mask_images, timeseries=None):
866865
return out_images
867866

868867
def _list_outputs(self):
869-
outputs = super(TCompCor, self)._list_outputs()
868+
outputs = super()._list_outputs()
870869
outputs["high_variance_masks"] = self._mask_files
871870
return outputs
872871

@@ -1136,7 +1135,7 @@ def plot_confound(tseries, figsize, name, units=None, series_tr=None, normalize=
11361135

11371136
xlabel = "Frame #"
11381137
if series_tr is not None:
1139-
xlabel = "Frame # ({} sec TR)".format(series_tr)
1138+
xlabel = f"Frame # ({series_tr} sec TR)"
11401139
ax.set_xlabel(xlabel)
11411140
ylim = ax.get_ylim()
11421141

@@ -1280,19 +1279,15 @@ def combine_mask_files(mask_files, mask_method=None, mask_index=None):
12801279
mask_index = 0
12811280
else:
12821281
raise ValueError(
1283-
(
1284-
"When more than one mask file is provided, "
1285-
"one of merge_method or mask_index must be "
1286-
"set"
1287-
)
1282+
"When more than one mask file is provided, "
1283+
"one of merge_method or mask_index must be "
1284+
"set"
12881285
)
12891286
if mask_index < len(mask_files):
12901287
mask = nb.load(mask_files[mask_index])
12911288
return [mask]
12921289
raise ValueError(
1293-
("mask_index {0} must be less than number of mask " "files {1}").format(
1294-
mask_index, len(mask_files)
1295-
)
1290+
f"mask_index {mask_index} must be less than number of mask files {len(mask_files)}"
12961291
)
12971292
masks = []
12981293
if mask_method == "none":

nipype/algorithms/icc.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
import os
32
from functools import lru_cache
43
import numpy as np

0 commit comments

Comments
 (0)