diff --git a/msgpi/dakota/interface.py b/msgpi/dakota/interface.py index 52daf9e..23dc4a9 100644 --- a/msgpi/dakota/interface.py +++ b/msgpi/dakota/interface.py @@ -27,6 +27,9 @@ def __init__(self): self.das = {} self.sgs = {} + self.dakota_params_file = '' + self.dakota_results_file = '' + def initialize(self, fn_json_args): @@ -49,18 +52,18 @@ def initialize(self, fn_json_args): # ------------------------------------------------------------ try: - dakota_params_file = self.settings['dakota_parameters_file'] + self.dakota_params_file = self.settings['dakota_parameters_file'] except KeyError: - dakota_params_file = 'input.in' + self.dakota_params_file = 'input.in' try: - dakota_results_file = self.settings['dakota_results_file'] + self.dakota_results_file = self.settings['dakota_results_file'] except KeyError: - dakota_results_file = 'output.out' + self.dakota_results_file = 'output.out' try: dakota_params, dakota_results = di.read_parameters_file( - dakota_params_file, dakota_results_file + self.dakota_params_file, self.dakota_results_file ) self.evid = int(dakota_params.eval_id) @@ -152,7 +155,7 @@ def writeOutput(self, status): with open('interim.out', 'w') as fo: json.dump(self.outputs['interim'], fo, indent=4) - with open(self.settings['dakota_results_file'], 'w') as fo: + with open(self.dakota_results_file, 'w') as fo: for r in self.outputs['final']: fo.write(f'{r[1]:24.16E} {r[0]}\n') @@ -161,7 +164,7 @@ def writeOutput(self, status): elif status == 1: # Fail self.logger.info(f'{self.log_prompt} failed') - with open(self.settings['dakota_results_file'], 'w') as fo: + with open(self.dakota_results_file, 'w') as fo: fo.write('FAIL') e = tb.format_exc()