#!/usr/bin/python import class_KdJamet as kdj import numpy as np import sys if len(sys.argv) != 3: print "test_class_KdNN.py must be launch with two arguments:" print " $ test_class_KdNN.py LOG_KdNeuralNetwork_TestCase_Input.csv your_output.csv" sys.exit(-1) K = kdj.KdJamet('idMERIS') tab = np.loadtxt(sys.argv[1], skiprows=1) KDs = np.zeros(tab.shape,dtype=np.float32) for i in range(tab.shape[0]): KDs[i,:] = K.compute_allKd(tab[i,:]) np.savetxt(sys.argv[2],KDs,fmt='%.7f',header="Kd%d Kd%d Kd%d Kd%d Kd%d Kd%d" %(K.WL[0],K.WL[1],K.WL[2],K.WL[3],K.WL[4],K.WL[5]))