From 4c8a30ca9945401f31bf9f75ba833e3fcc410277 Mon Sep 17 00:00:00 2001 From: Paul Duda Date: Fri, 20 Oct 2023 14:44:03 -0400 Subject: [PATCH] HBNOutput.py -- small cleanup regression_base.py -- options for cleaner looking report --- HSP2tools/HBNOutput.py | 3 ++- tests/convert/regression_base.py | 34 ++++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/HSP2tools/HBNOutput.py b/HSP2tools/HBNOutput.py index 9e3b8ee4..adc1dbb2 100644 --- a/HSP2tools/HBNOutput.py +++ b/HSP2tools/HBNOutput.py @@ -94,7 +94,8 @@ def read_data(self) -> None: dfname = f'{operation}_{activity}_{id:03d}_{tcode}' if self.simulation_duration_count == 0: self.simulation_duration_count = len(times) - df = DataFrame(rows, index=times, columns=mapn[operation, id, activity]).sort_index('index') + # df = DataFrame(rows, index=times, columns=mapn[operation, id, activity]).sort_index('index') + df = DataFrame(rows, index=times, columns=mapn[operation, id, activity]).sort_index() self.data_frames.append(df) self.summaryindx.append(dfname) diff --git a/tests/convert/regression_base.py b/tests/convert/regression_base.py index 21d3268d..79ee3ff6 100644 --- a/tests/convert/regression_base.py +++ b/tests/convert/regression_base.py @@ -108,17 +108,31 @@ def make_html_report(self, results_dict:Dict[OperationsTuple,ResultsTuple]) -> s def make_html_comp_row(self, con:str, no_data_hsp2:bool, no_data_hspf:bool, match:bool, diff:float) -> str: """populates each constituents rows""" - if no_data_hsp2 or no_data_hspf: - html = f'-{con}NANA' - html += f'{"Not in HSP2" if no_data_hsp2 else ""}
' - html += f'{"Not in HSPF" if no_data_hspf else ""}' - html += f'\n' + diffsOnly= False + eliminateNotIns = True + html = '' + if diffsOnly: + if no_data_hsp2 or no_data_hspf: + pass + else: + if match: + pass + else: + match_symbol = f'X' + html = f'-{con}{diff}{match_symbol}\n' else: - if match: - match_symbol = f'' + if no_data_hsp2 or no_data_hspf: + if not eliminateNotIns: + html = f'-{con}NANA' + html += f'{"Not in HSP2" if no_data_hsp2 else ""}
' + html += f'{"Not in HSPF" if no_data_hspf else ""}' + html += f'\n' else: - match_symbol = f'X' - html = f'-{con}{diff}{match_symbol}\n' + if match: + match_symbol = f'' + else: + match_symbol = f'X' + html = f'-{con}{diff}{match_symbol}\n' return html def write_html(self, file:str, html:str) -> None: @@ -164,7 +178,7 @@ def check_con(self, params:OperationsTuple) -> ResultsTuple: if len(ts_hspf.shape) > 1: ts_hspf = ts_hspf.iloc[:,0] - tolerance = 1e-2 + tolerance = 1e-2 # may want to change default to max(abs(ts_hsp2.values.min()), abs(ts_hsp2.values.max())) * 1e-3 # if heat related term, compute special tolerance if constituent == 'IHEAT' or constituent == 'ROHEAT' or constituent.startswith('OHEAT') or \ constituent == 'QSOLAR' or constituent == 'QLONGW' or constituent == 'QEVAP' or \