pypso/reader.py

27 lines
686 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

__author__ = 'dmy'
import numpy
class IEEEData:
def __init__(self,filePath,seperator='\t'):
self._filePath=filePath
self._seperator=seperator
self._read()
def _convertToVector(self,lineVec):#把数据文件按分隔符存成矩阵像Matlab一样。
self._array=numpy.array(lineVec)
print(lineVec)
print(self._array[0])
def _read(self):
lineVec=[]
with open(self._filePath,'tr') as f:
for line in f:
if len(line.strip())==0:
continue
lineVec.append([float(x) for x in line.split(self._seperator)])
self._convertToVector(lineVec)