예제 #1
0
import matplotlib.pyplot as plt
import ParsePowerEDFA
from sklearn.metrics import mean_squared_error
from sklearn.metrics import mean_absolute_error
import math
import sys
import configparser
import random

print(tf.__version__)
# In case we need to average results of 5 different debug files and plot them on a graph.
# ParsePowerEDFA.getTestFiles()

# Average files by name and then write collected results into a csv file.
[testdb, testmse, testmae, tr2, tr4, tr6, tr8, tr1, mse_tr,
 mae_tr] = ParsePowerEDFA.averageResults("TestPar45_60_10")
[val2, val4, val6, val8, val1, mse_val,
 mae_val] = ParsePowerEDFA.averageResults_val("TestPar45_60_10")
ParsePowerEDFA.plot_to_matrix(tr2, tr4, tr6, tr8, tr1, mse_tr, mae_tr)
ParsePowerEDFA.plot_to_matrix_Val(val2, val4, val6, val8, val1, mse_val,
                                  mae_val)
ParsePowerEDFA.plot_to_matrix_test(testdb, testmse, testmae)
# 20%
# [testdb, val2, val4, val6, val8, val1] = ParsePowerEDFA.averageResults([
#     "./TestPar29.ini140-debug.log",
#     "./TestPar29.ini84-debug.log",
#     "./TestPar29.ini150-debug.log"
# ])

# [testdb, val2, val4, val6, val8, val1] = ParsePowerEDFA.averageResults(["./test/TestPar25.ini-smaller53-debug.log", "./test/TestPar25.ini-smaller103-debug.log", "./test/TestPar25.ini-smaller25-debug.log", "./test/TestPar25.ini-smaller37-debug.log", "./test/TestPar25.ini-smaller30-debug.log"])
# ParsePowerEDFA.plotGraph(val2, val4, val6, val8, val1)
예제 #2
0
num_iterations = int(config.get(configuration, 'iterations'))
learning_rate = float(config.get(configuration, 'epsilon'))
decrease_rate = float(config.get(configuration, 'decrease_rate'))
out_channel = int(config.get(configuration, 'output_shape'))
scale = int(config.get(configuration, 'scaler'))
scale_in = int(config.get(configuration, 'scaleInput'))
only_on = config.get(configuration, 'onlyOn')
train_percentage = float(config.get(configuration, 'trainPercent'))
test_percentage = float(config.get(configuration, 'testPercent'))
isLoging = config.get(configuration, 'debugFile')
data_percentage = float(config.get(configuration, 'dataPercentage'))
file1 = config.get(configuration, 'dataFile')
chan_num = int(config.get(configuration, 'activeChannel'))

[counter, input_dict,
 output_dict] = ParsePowerEDFA.ParseDataFileSingleChannel(file1)

# Set a single channel out of the dictionary
input_power = input_dict[chan_num]
output_power = output_dict[chan_num]

# Save print outputs into a log file, always works with most updated file at a time.
if (isLoging == "on"):
    old_stdout = sys.stdout
    try:
        files = [f for f in os.listdir('.') if os.path.isfile(f)]
        wantedLogFiles = [
            filename for filename in files if filename.startswith(config_file)
        ]
        wantedLogFiles = [
            file for file in wantedLogFiles if file.replace(config_file, "")