#NEWLINE# def get_label( self , subj , ser_id ) : #NEWLINE# #INDENT# file_pattern = os . path . join ( self . datadir , 'labels' , ( 'S%03d_%03d_*.txt' % ( subj , ser_id ) ) ) #NEWLINE# files = glob . glob ( file_pattern ) #NEWLINE# if ( len ( files ) == 1 ) : #NEWLINE# #INDENT# return read_label ( ser_id [ 0 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( files ) == 0 ) : #NEWLINE# #INDENT# return ( - 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise Exception ( ( 'Found more than 1 label file for series: %s' % files ) )