import numpy as np
filename_phi='samples_phi3.txt'
filename_psi='samples_psi3.txt'
import re
X = []
y=[]

with open(filename_phi) as phi:
    while True:
        line = phi.readline()
        line = line[:-1]
        if not line:
            break
        lines = re.split(pattern=',| +|\t', string=line)
        X.append([float(item.strip()) for item in lines])
        y.append(1)

with open(filename_psi) as psi:
    while True:
        line = psi.readline()
        line = line[:-1]
        if not line:
            break
        lines = re.split(pattern=',| +|\t', string=line)
        X.append([float(item.strip()) for item in lines])
        y.append(-1)
with open('out.csv', mode='w+') as out:
    for i in range(len(X)):
        out.write(str(X[i][0]))
        out.write(',')
        out.write(str(X[i][1]))
        out.write(',')
        out.write(str(y[i]))
        out.write('\n')