#NEWLINE# def parse_txt_data( filename ) : #NEWLINE# #INDENT# f = open ( filename ) #NEWLINE# try : #NEWLINE# #INDENT# reader = csv . reader ( f , delimiter = ',' ) #NEWLINE# data = [ ] #NEWLINE# for row in reader : #NEWLINE# #INDENT# data . append ( list ( map ( float , row ) ) ) #NEWLINE# #UNINDENT# nc = len ( data [ 0 ] ) #NEWLINE# for i in data : #NEWLINE# #INDENT# if ( not ( nc == len ( i ) ) ) : #NEWLINE# #INDENT# raise ValueError ( i ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# f . close ( ) #NEWLINE# #UNINDENT# return np . array ( data )