Skip to content

Commit 27490e6

Browse files
authored
Merge pull request #2788 from oesteban/maint/logger-warnings
[MAINT] Stop using deprecated ``logger.warn()``
2 parents 321b6f1 + ae8b0f1 commit 27490e6

File tree

11 files changed

+26
-26
lines changed

11 files changed

+26
-26
lines changed

nipype/algorithms/confounds.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def _run_interface(self, runtime):
327327
tr = self.inputs.series_tr
328328

329329
if self.inputs.normalize and tr is None:
330-
IFLOGGER.warn('FD plot cannot be normalized if TR is not set')
330+
IFLOGGER.warning('FD plot cannot be normalized if TR is not set')
331331

332332
self._results['out_figure'] = op.abspath(self.inputs.out_figure)
333333
fig = plot_confound(
@@ -1267,7 +1267,7 @@ def _full_rank(X, cmax=1e15):
12671267
c = smax / smin
12681268
if c < cmax:
12691269
return X, c
1270-
IFLOGGER.warn('Matrix is singular at working precision, regularizing...')
1270+
IFLOGGER.warning('Matrix is singular at working precision, regularizing...')
12711271
lda = (smax - cmax * smin) / (cmax - 1)
12721272
s = s + lda
12731273
X = np.dot(U, np.dot(np.diag(s), V))

nipype/algorithms/mesh.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -422,5 +422,5 @@ class P2PDistance(ComputeMeshWarp):
422422

423423
def __init__(self, **inputs):
424424
super(P2PDistance, self).__init__(**inputs)
425-
IFLOGGER.warn('This interface has been deprecated since 1.0, please '
426-
'use ComputeMeshWarp')
425+
IFLOGGER.warning('This interface has been deprecated since 1.0, please '
426+
'use ComputeMeshWarp')

nipype/algorithms/misc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ def _run_interface(self, runtime):
589589
extraheadingBool = True
590590

591591
if len(self.inputs.in_files) == 1:
592-
iflogger.warn('Only one file input!')
592+
iflogger.warning('Only one file input!')
593593

594594
if isdefined(self.inputs.row_headings):
595595
iflogger.info('Row headings have been provided. Adding "labels"'

nipype/algorithms/modelgen.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ def _generate_design(self, infolist=None):
602602
try:
603603
out = np.loadtxt(filename)
604604
except IOError:
605-
iflogger.warn('Error reading outliers file %s', filename)
605+
iflogger.warning('Error reading outliers file %s', filename)
606606
out = np.array([])
607607

608608
if out.size > 0:

nipype/interfaces/base/core.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1180,8 +1180,8 @@ def __init__(self, check_import=True, *args, **kwargs):
11801180
except ImportError:
11811181
failed_imports.append(pkg)
11821182
if failed_imports:
1183-
iflogger.warn('Unable to import %s; %s interface may fail to '
1184-
'run', failed_imports, self.__class__.__name__)
1183+
iflogger.warning('Unable to import %s; %s interface may fail to '
1184+
'run', failed_imports, self.__class__.__name__)
11851185

11861186
@property
11871187
def version(self):

nipype/interfaces/dipy/reconstruction.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ def _run_interface(self, runtime):
124124
sigma = mean_std * (1 + bias)
125125

126126
if sigma == 0:
127-
IFLOGGER.warn('Noise std is 0.0, looks like data was masked and '
128-
'noise cannot be estimated correctly. Using default '
129-
'tensor model instead of RESTORE.')
127+
IFLOGGER.warning('Noise std is 0.0, looks like data was masked and '
128+
'noise cannot be estimated correctly. Using default '
129+
'tensor model instead of RESTORE.')
130130
dti = TensorModel(gtab)
131131
else:
132132
IFLOGGER.info('Performing RESTORE with noise std=%.4f.', sigma)
@@ -258,11 +258,11 @@ def _run_interface(self, runtime):
258258
ratio = abs(response[1] / response[0])
259259

260260
if ratio > 0.25:
261-
IFLOGGER.warn('Estimated response is not prolate enough. '
262-
'Ratio=%0.3f.', ratio)
261+
IFLOGGER.warning('Estimated response is not prolate enough. '
262+
'Ratio=%0.3f.', ratio)
263263
elif ratio < 1.e-5 or np.any(np.isnan(response)):
264264
response = np.array([1.8e-3, 3.6e-4, 3.6e-4, S0])
265-
IFLOGGER.warn(
265+
IFLOGGER.warning(
266266
'Estimated response is not valid, using a default one')
267267
else:
268268
IFLOGGER.info('Estimated response: %s', str(response[:3]))
@@ -344,8 +344,8 @@ def _run_interface(self, runtime):
344344
ratio = response[0][1] / response[0][0]
345345

346346
if abs(ratio - 0.2) > 0.1:
347-
IFLOGGER.warn('Estimated response is not prolate enough. '
348-
'Ratio=%0.3f.', ratio)
347+
IFLOGGER.warning('Estimated response is not prolate enough. '
348+
'Ratio=%0.3f.', ratio)
349349

350350
csd_model = ConstrainedSphericalDeconvModel(
351351
gtab, response, sh_order=self.inputs.sh_order)

nipype/interfaces/dipy/tracks.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ def _run_interface(self, runtime):
7373
data_dims = refnii.shape[:3]
7474
kwargs = dict(affine=affine)
7575
else:
76-
IFLOGGER.warn('voxel_dims and data_dims are deprecated as of dipy '
77-
'0.7.1. Please use reference input instead')
76+
IFLOGGER.warning('voxel_dims and data_dims are deprecated as of dipy '
77+
'0.7.1. Please use reference input instead')
7878

7979
if not isdefined(self.inputs.data_dims):
8080
data_dims = header['dim']

nipype/interfaces/freesurfer/utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ def _format_arg(self, name, spec, value):
316316
"Cannot create {} file with extension "
317317
"{}".format(value, ext))
318318
else:
319-
logger.warn('Creating %s file with extension %s: %s%s',
320-
value, ext, base, ext)
319+
logger.warning('Creating %s file with extension %s: %s%s',
320+
value, ext, base, ext)
321321

322322
if value in implicit_filetypes:
323323
return ""
@@ -554,8 +554,8 @@ def _format_arg(self, name, spec, value):
554554
"Cannot create {} file with extension "
555555
"{}".format(value, ext))
556556
else:
557-
logger.warn('Creating %s file with extension %s: %s%s',
558-
value, ext, base, ext)
557+
logger.warning('Creating %s file with extension %s: %s%s',
558+
value, ext, base, ext)
559559
if value in implicit_filetypes:
560560
return ""
561561
return super(SurfaceTransform, self)._format_arg(name, spec, value)

nipype/interfaces/fsl/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ def output_type(cls):
107107
try:
108108
return os.environ['FSLOUTPUTTYPE']
109109
except KeyError:
110-
IFLOGGER.warn('FSLOUTPUTTYPE environment variable is not set. '
111-
'Setting FSLOUTPUTTYPE=NIFTI')
110+
IFLOGGER.warning('FSLOUTPUTTYPE environment variable is not set. '
111+
'Setting FSLOUTPUTTYPE=NIFTI')
112112
return 'NIFTI'
113113

114114
@staticmethod

nipype/interfaces/mrtrix3/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def _format_arg(self, name, trait_spec, value):
7777
from multiprocessing import cpu_count
7878
value = cpu_count()
7979
except:
80-
iflogger.warn('Number of threads could not be computed')
80+
iflogger.warning('Number of threads could not be computed')
8181
pass
8282
return trait_spec.argstr % value
8383

nipype/utils/filemanip.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ def copyfile(originalfile,
471471
fmlogger.debug('Copying File: %s->%s', newfile, originalfile)
472472
shutil.copyfile(originalfile, newfile)
473473
except shutil.Error as e:
474-
fmlogger.warn(e.message)
474+
fmlogger.warning(e.message)
475475

476476
# Associated files
477477
if copy_related_files:

0 commit comments

Comments
 (0)