From 1c5f02fc452695459776676f9a52ebffe70c9b9a Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Mon, 9 May 2016 16:10:26 +0100 Subject: [PATCH] Added check for Taguchi code blocks when using --opt-taguchi argument. --- gprMax/optimisation_taguchi.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gprMax/optimisation_taguchi.py b/gprMax/optimisation_taguchi.py index 646ac103..ba0a638e 100644 --- a/gprMax/optimisation_taguchi.py +++ b/gprMax/optimisation_taguchi.py @@ -170,6 +170,9 @@ def taguchi_code_blocks(inputfile, taguchinamespace): # Strip out any newline characters and comments that must begin with double hashes inputlines = [line.rstrip() for line in f if(not line.startswith('##') and line.rstrip('\n'))] + # Store length of dict + taglength = len(taguchinamespace) + x = 0 while(x < len(inputlines)): if(inputlines[x].startswith('#taguchi:')): @@ -190,6 +193,10 @@ def taguchi_code_blocks(inputfile, taguchinamespace): exec(taguchicompiledcode, taguchinamespace) x += 1 + + # Check if any Taguchi code blocks were found + if len(taguchinamespace) == taglength: + raise CmdInputError('No #taguchi and #end_taguchi code blocks found.') return taguchinamespace