File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 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):
444444 self .darrays .remove (dele )
445445 self .numDA -= 1
446446
447- def getArraysFromIntent (self , intent ):
447+ def get_arrays_from_intent (self , intent ):
448448 """ Returns a a list of GiftiDataArray elements matching
449449 the given intent """
450450
451451 it = intent_codes .code [intent ]
452452
453453 return [x for x in self .darrays if x .intent == it ]
454454
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+
455459 def print_summary (self ):
456460 print ('----start----' )
457461 print ('Source filename: ' , self .filename )
Original file line number Diff line number Diff line change 1010
1111from os .path import join as pjoin , dirname
1212import sys
13+ import warnings
1314
1415import numpy as np
1516
2324
2425from nose .tools import (assert_true , assert_false , assert_equal ,
2526 assert_raises )
27+ from ...testing import clear_and_catch_warnings
2628
2729
2830IO_DATA_PATH = pjoin (dirname (__file__ ), 'data' )
@@ -227,11 +229,21 @@ def test_newmetadata():
227229
228230def test_getbyintent ():
229231 img = gi .read (DATA_FILE1 )
230- da = img .getArraysFromIntent ("NIFTI_INTENT_POINTSET" )
232+
233+ da = img .get_arrays_from_intent ("NIFTI_INTENT_POINTSET" )
231234 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" )
233244 assert_equal (len (da ), 1 )
234- da = img .getArraysFromIntent ("NIFTI_INTENT_CORREL" )
245+
246+ da = img .get_arrays_from_intent ("NIFTI_INTENT_CORREL" )
235247 assert_equal (len (da ), 0 )
236248 assert_equal (da , [])
237249
You can’t perform that action at this time.
0 commit comments