Skip to content

Commit 49cc0a7

Browse files
committed
Merge remote-tracking branch 'upstream/master' into dev/2.0
Curated by CJM
2 parents 497b44d + 5e9d9b5 commit 49cc0a7

File tree

11 files changed

+241
-109
lines changed

11 files changed

+241
-109
lines changed

.zenodo.json

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@
7373
"affiliation": "Shattuck Lab, UCLA Brain Mapping Center",
7474
"name": "Wong, Jason"
7575
},
76-
{
77-
"affiliation": "Concordia University",
78-
"name": "Benderoff, Erin"
79-
},
8076
{
8177
"affiliation": "Developer",
8278
"name": "Clark, Daniel",
@@ -142,6 +138,10 @@
142138
"name": "Gramfort, Alexandre",
143139
"orcid": "0000-0001-9791-4404"
144140
},
141+
{
142+
"affiliation": "Concordia University",
143+
"name": "Benderoff, Erin"
144+
},
145145
{
146146
"affiliation": "Dartmouth College: Hanover, NH, United States",
147147
"name": "Halchenko, Yaroslav O.",
@@ -274,6 +274,11 @@
274274
{
275275
"name": "Dubois, Mathieu"
276276
},
277+
{
278+
"affiliation": "Holland Bloorview Kids Rehabilitation Hospital",
279+
"name": "Tilley II, Steven",
280+
"orcid": "0000-0003-4853-5082"
281+
},
277282
{
278283
"affiliation": "Child Mind Institute",
279284
"name": "Frohlich, Caroline"
@@ -313,10 +318,6 @@
313318
"name": "Eshaghi, Arman",
314319
"orcid": "0000-0002-6652-3512"
315320
},
316-
{
317-
"name": "Heinsfeld, Anibal S\u00f3lon",
318-
"orcid": "0000-0002-2050-0614"
319-
},
320321
{
321322
"name": "Ginsburg, Daniel"
322323
},
@@ -330,6 +331,10 @@
330331
"name": "Kastman, Erik",
331332
"orcid": "0000-0001-7221-9042"
332333
},
334+
{
335+
"name": "Heinsfeld, Anibal S\u00f3lon",
336+
"orcid": "0000-0002-2050-0614"
337+
},
333338
{
334339
"affiliation": "Washington University in St Louis",
335340
"name": "Acland, Benjamin",
@@ -376,9 +381,6 @@
376381
{
377382
"name": "Millman, Jarrod"
378383
},
379-
{
380-
"name": "Lai, Jeff"
381-
},
382384
{
383385
"name": "Zhou, Dale"
384386
},
@@ -388,11 +390,6 @@
388390
{
389391
"name": "Haselgrove, Christian"
390392
},
391-
{
392-
"affiliation": "Holland Bloorview Kids Rehabilitation Hospital",
393-
"name": "Tilley II, Steven",
394-
"orcid": "0000-0003-4853-5082"
395-
},
396393
{
397394
"name": "Renfro, Mandy"
398395
},
@@ -405,11 +402,6 @@
405402
"name": "Kahn, Ari E.",
406403
"orcid": "0000-0002-2127-0507"
407404
},
408-
{
409-
"affiliation": "Yale University; New Haven, CT, United States",
410-
"name": "Sisk, Lucinda M.",
411-
"orcid": "0000-0003-4900-9770"
412-
},
413405
{
414406
"affiliation": "Korea Advanced Institute of Science and Technology",
415407
"name": "Kim, Sin",
@@ -437,6 +429,11 @@
437429
{
438430
"name": "Hallquist, Michael"
439431
},
432+
{
433+
"affiliation": "Yale University; New Haven, CT, United States",
434+
"name": "Sisk, Lucinda M.",
435+
"orcid": "0000-0003-4900-9770"
436+
},
440437
{
441438
"affiliation": "Donders Institute for Brain, Cognition and Behavior, Center for Cognitive Neuroimaging",
442439
"name": "Chetverikov, Andrey",
@@ -484,11 +481,6 @@
484481
{
485482
"name": "Hinds, Oliver"
486483
},
487-
{
488-
"affiliation": "National Institute on Aging, Baltimore, MD, USA",
489-
"name": "Bilgel, Murat",
490-
"orcid": "0000-0001-5042-7422"
491-
},
492484
{
493485
"affiliation": "TIB \u2013 Leibniz Information Centre for Science and Technology and University Library, Hannover, Germany",
494486
"name": "Leinweber, Katrin",
@@ -501,15 +493,6 @@
501493
"affiliation": "Boston University",
502494
"name": "Perkins, L. Nathan"
503495
},
504-
{
505-
"affiliation": "University of Amsterdam",
506-
"name": "Snoek, Lukas",
507-
"orcid": "0000-0001-8972-204X"
508-
},
509-
{
510-
"affiliation": "Institute of Imaging & Computer Vision, RWTH Aachen University, Germany",
511-
"name": "Weninger, Leon"
512-
},
513496
{
514497
"affiliation": "University of Newcastle, Australia",
515498
"name": "Cooper, Gavin",
@@ -524,16 +507,20 @@
524507
{
525508
"name": "Noel, Maxime"
526509
},
510+
{
511+
"affiliation": "University of Amsterdam",
512+
"name": "Snoek, Lukas",
513+
"orcid": "0000-0001-8972-204X"
514+
},
515+
{
516+
"affiliation": "Institute of Imaging & Computer Vision, RWTH Aachen University, Germany",
517+
"name": "Weninger, Leon"
518+
},
527519
{
528520
"affiliation": "University of Pennsylvania",
529521
"name": "Junhao WEN",
530522
"orcid": "0000-0003-2077-3070"
531523
},
532-
{
533-
"affiliation": "Leibniz Institute for Neurobiology",
534-
"name": "Stadler, J\u00f6rg",
535-
"orcid": "0000-0003-4313-129X"
536-
},
537524
{
538525
"name": "Cheung, Brian"
539526
},
@@ -549,6 +536,11 @@
549536
"name": "Durnez, Joke",
550537
"orcid": "0000-0001-9030-2202"
551538
},
539+
{
540+
"affiliation": "Leibniz Institute for Neurobiology",
541+
"name": "Stadler, J\u00f6rg",
542+
"orcid": "0000-0003-4313-129X"
543+
},
552544
{
553545
"affiliation": "CNRS, UMS3552 IRMaGe",
554546
"name": "Condamine, Eric",
@@ -600,10 +592,12 @@
600592
"name": "Khanuja, Ranjeet"
601593
},
602594
{
603-
"name": "Schlamp, Kai"
595+
"affiliation": "National Institute on Aging, Baltimore, MD, USA",
596+
"name": "Bilgel, Murat",
597+
"orcid": "0000-0001-5042-7422"
604598
},
605599
{
606-
"name": "Arias, Jaime"
600+
"name": "Schlamp, Kai"
607601
},
608602
{
609603
"affiliation": "CEA",
@@ -671,6 +665,12 @@
671665
{
672666
"name": "Davison, Andrew"
673667
},
668+
{
669+
"name": "Lai, Jeff"
670+
},
671+
{
672+
"name": "Arias, Jaime"
673+
},
674674
{
675675
"name": "Bielievtsov, Dmytro",
676676
"orcid": "0000-0003-3846-7696"

doc/changelog/1.X.X-changelog

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
1.3.0 (To Be Determined)
2-
========================
1+
1.3.0 (November 11, 2019)
2+
=========================
33

44
##### [Full changelog](https://github.com/nipy/nipype/milestone/34?closed=1)
55

6+
* FIX: Fixed typo in QwarpInputSpec Trait description (https://github.com/nipy/nipype/pull/3079)
67
* FIX: Restore ``AFNICommand._get_fname``, required by some interfaces (https://github.com/nipy/nipype/pull/3071)
78
* FIX: Remove asynchronous chdir callback (https://github.com/nipy/nipype/pull/3060)
89
* FIX: Minimize scope for directory changes while loading results file (https://github.com/nipy/nipype/pull/3061)
10+
* ENH: Minimize the number of calls to ``_load_results`` when populating inputs (https://github.com/nipy/nipype/pull/3075)
11+
* ENH: Refactor savepkl/loadpkl - add a window for loadpkl to wait for the file (https://github.com/nipy/nipype/pull/3089)
12+
* ENH: Add "ExportFile" interface as simple alternative to "DataSink" (https://github.com/nipy/nipype/pull/3054)
13+
* ENH: Allow nipype.cfg in cwd to be read even if ~/.nipype does not exist (https://github.com/nipy/nipype/pull/3072)
914
* ENH: Add precommit information for contributors and pre-commit style (https://github.com/nipy/nipype/pull/3063)
1015
* ENH: Delay etelemetry for non-interactive sessions, report bad versions (https://github.com/nipy/nipype/pull/3049)
1116
* ENH: Run memoized check_version at REPL import, Node/Workflow/Interface init (https://github.com/nipy/nipype/pull/30)

doc/documentation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Documentation
99
:Release: |version|
1010
:Date: |today|
1111

12-
Previous versions: `1.2.3 <http://nipype.readthedocs.io/en/1.2.3/>`_ `1.2.2 <http://nipype.readthedocs.io/en/1.2.2/>`_
12+
Previous versions: `1.3.0 <http://nipype.readthedocs.io/en/1.3.0/>`_ `1.2.3 <http://nipype.readthedocs.io/en/1.2.3/>`_
1313

1414

1515
.. container:: doc2

nipype/info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# nipype version information
77
# Remove -dev for release
8-
__version__ = '2.0.0-dev'
8+
__version__ = '1.4.0-dev'
99

1010

1111
def get_nipype_gitversion():
@@ -97,7 +97,7 @@ def get_nipype_gitversion():
9797
NIBABEL_MIN_VERSION = '2.1.0'
9898
NETWORKX_MIN_VERSION = '1.9'
9999
NETWORKX_MAX_VERSION_27 = '2.2'
100-
NUMPY_MIN_VERSION = '1.9.0'
100+
NUMPY_MIN_VERSION = '1.12'
101101
# Numpy bug in python 3.7:
102102
# https://www.opensourceanswers.com/blog/you-shouldnt-use-python-37-for-data-science-right-now.html
103103
NUMPY_MIN_VERSION_37 = '1.15.3'

nipype/interfaces/afni/preprocess.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3384,11 +3384,11 @@ class QwarpInputSpec(AFNICommandInputSpec):
33843384
exists=True,
33853385
copyfile=False)
33863386
noXdis = traits.Bool(
3387-
desc='Warp will not displace in x directoin', argstr='-noXdis')
3387+
desc='Warp will not displace in x direction', argstr='-noXdis')
33883388
noYdis = traits.Bool(
3389-
desc='Warp will not displace in y directoin', argstr='-noYdis')
3389+
desc='Warp will not displace in y direction', argstr='-noYdis')
33903390
noZdis = traits.Bool(
3391-
desc='Warp will not displace in z directoin', argstr='-noZdis')
3391+
desc='Warp will not displace in z direction', argstr='-noZdis')
33923392
iniwarp = traits.List(
33933393
File(exists=True, copyfile=False),
33943394
desc='A dataset with an initial nonlinear warp to use.'

nipype/interfaces/io.py

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
from .. import config, logging
2929
from ..utils.filemanip import (
3030
copyfile, simplify_list, ensure_list,
31-
get_related_files)
31+
get_related_files, split_filename)
3232
from ..utils.misc import human_order_sorted, str2bool
3333
from .base import (
3434
TraitedSpec, traits, Str, File, Directory, BaseInterface, InputMultiPath,
3535
isdefined, OutputMultiPath, DynamicTraitedSpec, Undefined, BaseInterfaceInputSpec,
36-
LibraryBaseInterface)
36+
LibraryBaseInterface, SimpleInterface)
3737

3838
iflogger = logging.getLogger('nipype.interface')
3939

@@ -2859,3 +2859,51 @@ def _list_outputs(self):
28592859

28602860
def _add_output_traits(self, base):
28612861
return add_traits(base, list(self.inputs.output_query.keys()))
2862+
2863+
2864+
class ExportFileInputSpec(BaseInterfaceInputSpec):
2865+
in_file = File(exists=True, mandatory=True, desc='Input file name')
2866+
out_file = File(mandatory=True, desc='Output file name')
2867+
check_extension = traits.Bool(True, desc='Ensure that the input and output file extensions match')
2868+
clobber = traits.Bool(desc='Permit overwriting existing files')
2869+
2870+
2871+
class ExportFileOutputSpec(TraitedSpec):
2872+
out_file = File(exists=True, desc='Output file name')
2873+
2874+
2875+
class ExportFile(SimpleInterface):
2876+
""" Export a file to an absolute path
2877+
2878+
This interface copies an input file to a named output file.
2879+
This is useful to save individual files to a specific location,
2880+
instead of more flexible interfaces like DataSink.
2881+
2882+
Examples
2883+
--------
2884+
2885+
>>> from nipype.interfaces.io import ExportFile
2886+
>>> import os.path as op
2887+
>>> ef = ExportFile()
2888+
>>> ef.inputs.in_file = "T1.nii.gz"
2889+
>>> os.mkdir("output_folder")
2890+
>>> ef.inputs.out_file = op.abspath("output_folder/sub1_out.nii.gz")
2891+
>>> res = ef.run()
2892+
>>> os.path.exists(res.outputs.out_file)
2893+
True
2894+
2895+
"""
2896+
input_spec = ExportFileInputSpec
2897+
output_spec = ExportFileOutputSpec
2898+
2899+
def _run_interface(self, runtime):
2900+
if not self.inputs.clobber and op.exists(self.inputs.out_file):
2901+
raise FileExistsError(self.inputs.out_file)
2902+
if not op.isabs(self.inputs.out_file):
2903+
raise ValueError('Out_file must be an absolute path.')
2904+
if (self.inputs.check_extension and
2905+
split_filename(self.inputs.in_file)[2] != split_filename(self.inputs.out_file)[2]):
2906+
raise RuntimeError('%s and %s have different extensions' % (self.inputs.in_file, self.inputs.out_file))
2907+
shutil.copy(str(self.inputs.in_file), str(self.inputs.out_file))
2908+
self._results['out_file'] = self.inputs.out_file
2909+
return runtime
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from ..io import ExportFile
3+
4+
5+
def test_ExportFile_inputs():
6+
input_map = dict(
7+
check_extension=dict(),
8+
clobber=dict(),
9+
in_file=dict(
10+
extensions=None,
11+
mandatory=True,
12+
),
13+
out_file=dict(
14+
extensions=None,
15+
mandatory=True,
16+
),
17+
)
18+
inputs = ExportFile.input_spec()
19+
20+
for key, metadata in list(input_map.items()):
21+
for metakey, value in list(metadata.items()):
22+
assert getattr(inputs.traits()[key], metakey) == value
23+
def test_ExportFile_outputs():
24+
output_map = dict(out_file=dict(extensions=None, ), )
25+
outputs = ExportFile.output_spec()
26+
27+
for key, metadata in list(output_map.items()):
28+
for metakey, value in list(metadata.items()):
29+
assert getattr(outputs.traits()[key], metakey) == value

nipype/interfaces/tests/test_io.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import nipype.interfaces.io as nio
1616
from nipype.interfaces.base.traits_extension import isdefined
1717
from nipype.interfaces.base import Undefined, TraitError
18-
from nipype.utils.filemanip import dist_is_editable
18+
from nipype.utils.filemanip import dist_is_editable, FileExistsError
1919

2020
# Check for boto
2121
noboto = False
@@ -674,3 +674,26 @@ def _mock_get_ssh_client(self):
674674
.check(file=True, exists=True)) # exists?
675675

676676
old_cwd.chdir()
677+
678+
679+
def test_ExportFile(tmp_path):
680+
testin = tmp_path / 'in.txt'
681+
testin.write_text('test string')
682+
i = nio.ExportFile()
683+
i.inputs.in_file = str(testin)
684+
i.inputs.out_file = str(tmp_path / 'out.tsv')
685+
i.inputs.check_extension = True
686+
with pytest.raises(RuntimeError):
687+
i.run()
688+
i.inputs.check_extension = False
689+
i.run()
690+
assert (tmp_path / 'out.tsv').read_text() == 'test string'
691+
i.inputs.out_file = str(tmp_path / 'out.txt')
692+
i.inputs.check_extension = True
693+
i.run()
694+
assert (tmp_path / 'out.txt').read_text() == 'test string'
695+
with pytest.raises(FileExistsError):
696+
i.run()
697+
i.inputs.clobber = True
698+
i.run()
699+
assert (tmp_path / 'out.txt').read_text() == 'test string'

0 commit comments

Comments
 (0)