File tree 2 files changed +20
-4
lines changed 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -444,14 +444,18 @@ def remove_gifti_data_array_by_intent(self, intent):
444
444
self .darrays .remove (dele )
445
445
self .numDA -= 1
446
446
447
- def getArraysFromIntent (self , intent ):
447
+ def get_arrays_from_intent (self , intent ):
448
448
""" Returns a a list of GiftiDataArray elements matching
449
449
the given intent """
450
450
451
451
it = intent_codes .code [intent ]
452
452
453
453
return [x for x in self .darrays if x .intent == it ]
454
454
455
+ @np .deprecate_with_doc ("Use get_arrays_from_intent instead." )
456
+ def getArraysFromIntent (self , intent ):
457
+ return self .get_arrays_from_intent (intent )
458
+
455
459
def print_summary (self ):
456
460
print ('----start----' )
457
461
print ('Source filename: ' , self .filename )
Original file line number Diff line number Diff line change 10
10
11
11
from os .path import join as pjoin , dirname
12
12
import sys
13
+ import warnings
13
14
14
15
import numpy as np
15
16
23
24
24
25
from nose .tools import (assert_true , assert_false , assert_equal ,
25
26
assert_raises )
27
+ from ...testing import clear_and_catch_warnings
26
28
27
29
28
30
IO_DATA_PATH = pjoin (dirname (__file__ ), 'data' )
@@ -227,11 +229,21 @@ def test_newmetadata():
227
229
228
230
def test_getbyintent ():
229
231
img = gi .read (DATA_FILE1 )
230
- da = img .getArraysFromIntent ("NIFTI_INTENT_POINTSET" )
232
+
233
+ da = img .get_arrays_from_intent ("NIFTI_INTENT_POINTSET" )
231
234
assert_equal (len (da ), 1 )
232
- da = img .getArraysFromIntent ("NIFTI_INTENT_TRIANGLE" )
235
+
236
+ with clear_and_catch_warnings () as w :
237
+ warnings .filterwarnings ('once' , category = DeprecationWarning )
238
+ da = img .getArraysFromIntent ("NIFTI_INTENT_POINTSET" )
239
+ assert_equal (len (da ), 1 )
240
+ assert_equal (len (w ), 1 )
241
+ assert_equal (w [0 ].category , DeprecationWarning )
242
+
243
+ da = img .get_arrays_from_intent ("NIFTI_INTENT_TRIANGLE" )
233
244
assert_equal (len (da ), 1 )
234
- da = img .getArraysFromIntent ("NIFTI_INTENT_CORREL" )
245
+
246
+ da = img .get_arrays_from_intent ("NIFTI_INTENT_CORREL" )
235
247
assert_equal (len (da ), 0 )
236
248
assert_equal (da , [])
237
249
You can’t perform that action at this time.
0 commit comments