def _readFile(self, sldir, fileName, sep):
if sldir.endswith(os.sep):<EOL><INDENT>fileName = str(sldir)+str(fileName)<EOL><DEDENT>else:<EOL><INDENT>fileName = str(sldir)+os.sep+str(fileName)<EOL><DEDENT>fileLines=[] <EOL>header=[]    <EOL>dataCols=[]  <EOL>data=[]      <EOL>cols=[]      <EOL>f=open(fileName,'<STR_LIT:r>')<EOL>fileLines=f.readlines()<EOL>i=<NUM_LIT:0><EOL>if self.datatype != '<STR_LIT>':<EOL><INDENT>while i<len(fileLines):<EOL><INDENT>if fileLines[i].startswith(self.header_char):<EOL><INDENT>tmp=fileLines[i].lstrip(self.header_char)<EOL>header.append(tmp.strip())<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT>i+=<NUM_LIT:1><EOL><DEDENT>cols=fileLines[i].split(sep)<EOL>tmp=[]<EOL>tmp1=[]<EOL>for j in range(len(cols)):<EOL><INDENT>tmp1=cols[j].strip()<EOL>if tmp1 !='<STR_LIT>':<EOL><INDENT>tmp.append(tmp1)<EOL><DEDENT><DEDENT>cols=tmp<EOL>i+=<NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>header={}<EOL>while fileLines[i].startswith('<STR_LIT:#>') or '<STR_LIT:=>' in fileLines[i]:<EOL><INDENT>if fileLines[i].startswith('<STR_LIT:#>') and cols==[]:<EOL><INDENT>cols=fileLines[i].strip('<STR_LIT:#>')<EOL>cols=cols.strip()<EOL>cols=cols.split()<EOL><DEDENT>elif fileLines[i].startswith('<STR_LIT:#>'):<EOL><INDENT>tmp1=fileLines[i].strip('<STR_LIT:#>')<EOL>tmp1=tmp1.strip()<EOL>self.headerLines.append(tmp1)<EOL><DEDENT>elif not fileLines[i].startswith('<STR_LIT:#>'):<EOL><INDENT>tmp=fileLines[i].split('<STR_LIT:=>')<EOL>tmp[<NUM_LIT:0>]=tmp[<NUM_LIT:0>].strip()<EOL>tmp[<NUM_LIT:1>]=tmp[<NUM_LIT:1>].strip()<EOL>if header=={}:<EOL><INDENT>header={str(tmp[<NUM_LIT:0>]):str(tmp[<NUM_LIT:1>])}<EOL><DEDENT>else:<EOL><INDENT>header[str(tmp[<NUM_LIT:0>])]=str(tmp[<NUM_LIT:1>])<EOL><DEDENT><DEDENT>i+=<NUM_LIT:1><EOL><DEDENT><DEDENT>while i<len(fileLines):<EOL><INDENT>if fileLines[i].startswith('<STR_LIT:#>'):<EOL><INDENT>i=i+<NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>tmp=fileLines[i].split()<EOL>for j in range(len(tmp)):<EOL><INDENT>tmp[j]=tmp[j].strip()<EOL><DEDENT>data.append(tmp)<EOL>i+=<NUM_LIT:1><EOL><DEDENT><DEDENT>tmp=[]<EOL>tmp1=[]<EOL>for j in range(len(data)):<EOL><INDENT>for k in range(len(data[j])):<EOL><INDENT>tmp1=data[j][k].strip()<EOL>if tmp1 !='<STR_LIT>':<EOL><INDENT>tmp.append(tmp1)<EOL><DEDENT><DEDENT>data[j]=tmp<EOL>tmp=[]<EOL><DEDENT>tmp=[]<EOL>for j in range(len(cols)):<EOL><INDENT>for k in range(len(data)):<EOL><INDENT>try:<EOL><INDENT>a=float(data[k][j])<EOL>tmp.append(a)<EOL><DEDENT>except ValueError:<EOL><INDENT>tmp.append(data[k][j])<EOL><DEDENT><DEDENT>tmp=array(tmp)<EOL>if j == <NUM_LIT:0>:<EOL><INDENT>dataCols={cols[j]:tmp}<EOL><DEDENT>else:<EOL><INDENT>dataCols[cols[j]]=tmp<EOL><DEDENT>tmp=[]<EOL><DEDENT>return header,dataCols<EOL>
Private method that reads in the header and column data.