From 79fae282d8c03a0f50d7c2786bd124f40abc2f20 Mon Sep 17 00:00:00 2001 From: craig-warren Date: Wed, 2 Mar 2016 11:45:12 +0000 Subject: [PATCH] Updated copyright date and moved to reading objects pickled to file. --- user_libs/optimisation_taguchi_plot.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/user_libs/optimisation_taguchi_plot.py b/user_libs/optimisation_taguchi_plot.py index 2f95d713..ee35bc98 100644 --- a/user_libs/optimisation_taguchi_plot.py +++ b/user_libs/optimisation_taguchi_plot.py @@ -1,23 +1,25 @@ -# Copyright (C) 2015, Craig Warren +# Copyright (C) 2015-2016, Craig Warren # # This module is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. # To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/. # # Please use the attribution at http://dx.doi.org/10.1190/1.3548506 -import argparse -import numpy as np +import argparse, pickle from gprMax.optimisation_taguchi import plot_optimisation_history -"""Plots the results (stored in a NumPy archive) from a Taguchi optimisation process.""" +"""Plots the results (pickled to file) from a Taguchi optimisation process.""" # Parse command line arguments -parser = argparse.ArgumentParser(description='Plots the results (stored in a NumPy archive) from a Taguchi optimisation process.', usage='cd gprMax; python -m user_libs.optimisation_taguchi_plot numpyfile') -parser.add_argument('numpyfile', help='name of NumPy archive including path') +parser = argparse.ArgumentParser(description='Plots the results (pickled to file) from a Taguchi optimisation process.', usage='cd gprMax; python -m user_libs.optimisation_taguchi_plot picklefile') +parser.add_argument('picklefile', help='name of file including path') args = parser.parse_args() -results = np.load(args.numpyfile) +f = open(args.picklefile, 'rb') +optparamshist = pickle.load(f) +fitnessvalueshist = pickle.load(f) +optparamsinit = pickle.load(f) # Plot the history of fitness values and each optimised parameter values for the optimisation -plot_optimisation_history(results[fitnessvalueshist], results[optparamshist], results[optparamsinit]) \ No newline at end of file +plot_optimisation_history(fitnessvalueshist, optparamshist, optparamsinit) \ No newline at end of file