#NEWLINE# def parse_text( file_name ) : #NEWLINE# #INDENT# 'Parse data from Ohio State University text mocap files (http://accad.osu.edu/research/mocap/mocap_data.htm).' #NEWLINE# fid = open ( file_name , 'r' ) #NEWLINE# point_names = np . array ( fid . readline ( ) . split ( ) ) [ 2 : ( - 1 ) : 3 ] #NEWLINE# fid . close ( ) #NEWLINE# for i in range ( len ( point_names ) ) : #NEWLINE# #INDENT# point_names [ i ] = point_names [ S ] [ 0 : ( - 2 ) ] #NEWLINE# #UNINDENT# S = np . loadtxt ( file_name , skiprows = 1 ) #NEWLINE# field = np . uint ( S [ : , 0 ] ) #NEWLINE# times = S [ : , 1 ] #NEWLINE# S = S [ : , 2 : ] #NEWLINE# S [ ( S == ( - 9999.99 ) ) ] = np . NaN #NEWLINE# points = [ ] #NEWLINE# points . append ( S [ : , 0 : ( - 1 ) : 3 ] ) #NEWLINE# points . append ( S [ : , 1 : ( - 1 ) : 3 ] ) #NEWLINE# points . append ( S [ : , 2 : ( - 1 ) : 3 ] ) #NEWLINE# return ( points , point_names , times )