@@ -155,6 +155,7 @@ def rgba(self, rgba):
155155 raise ValueError ('rgba must be length 4.' )
156156 self .red , self .green , self .blue , self .alpha = rgba
157157
158+
158159def _arr2txt (arr , elem_fmt ):
159160 arr = np .asarray (arr )
160161 assert arr .dtype .names is None
@@ -404,7 +405,7 @@ def labeltable(self, labeltable):
404405
405406 """
406407 if not isinstance (labeltable , GiftiLabelTable ):
407- raise ValueError ("Not a valid GiftiLabelTable instance" )
408+ raise TypeError ("Not a valid GiftiLabelTable instance" )
408409 self ._labeltable = labeltable
409410
410411 @np .deprecate_with_doc ("Use the gifti_img.labeltable property instead." )
@@ -432,7 +433,7 @@ def meta(self, meta):
432433 None
433434 """
434435 if not isinstance (meta , GiftiMetaData ):
435- raise ValueError ("Not a valid GiftiMetaData instance" )
436+ raise TypeError ("Not a valid GiftiMetaData instance" )
436437 self ._meta = meta
437438
438439 @np .deprecate_with_doc ("Use the gifti_img.labeltable property instead." )
@@ -450,10 +451,9 @@ def add_gifti_data_array(self, dataarr):
450451 ----------
451452 dataarr : GiftiDataArray
452453 """
453- if isinstance (dataarr , GiftiDataArray ):
454- self .darrays .append (dataarr )
455- else :
456- raise ValueError ("dataarr paramater must be of type GiftiDataArray" )
454+ if not isinstance (dataarr , GiftiDataArray ):
455+ raise TypeError ("dataarr paramater must be of type GiftiDataArray" )
456+ self .darrays .append (dataarr )
457457
458458 def remove_gifti_data_array (self , ith ):
459459 """ Removes the ith data array element from the GiftiImage """
0 commit comments