Skip to content

Commit

Permalink
20240324, debug: kept report append in reporter only
Browse files Browse the repository at this point in the history
  • Loading branch information
matheme-justyn committed Mar 24, 2024
1 parent 80d01e3 commit bfc6f38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
10 changes: 2 additions & 8 deletions PETsARD/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,9 @@ def set_report(self, report: dict) -> None:
if not hasattr(self, 'report'):
raise UnexecutedError

# Row combine the report data if the experiment name already exists
# Report rows already combine in Reporter
for eval_expt_name, report_data in report.items():
if eval_expt_name in self.report:
self.report[eval_expt_name] = pd.concat(
[self.report[eval_expt_name], report_data],
ignore_index=True
)
else:
self.report[eval_expt_name] = report_data
self.report[eval_expt_name] = report_data.copy()

def get_pre_module(self, curr_module: str) -> str:
"""
Expand Down
10 changes: 4 additions & 6 deletions PETsARD/reporter/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class ReporterBase(ABC):
'Postprocessor',
'Evaluator',
'Describer',
'Reporter',
]

def __init__(self, config: dict):
Expand Down Expand Up @@ -194,7 +195,6 @@ def _verify_create_input(cls, data: dict) -> None:
# 2. Index must have an even number of elements.
if len(idx) % 2 != 0:
raise ConfigError

module_names, experiment_names = idx[::2], idx[1::2]

# 3. Every module names should be in ALLOWED_IDX_MODULE.
Expand Down Expand Up @@ -399,8 +399,6 @@ def create(self, data: dict = None) -> None:

idx_final_module: str = ''
eval_expt_name: str = ''
exist_report: dict = None
exist_result: pd.DataFrame = None
for full_expt_tuple, rpt_data in data.items():
# 1. Found final module is Evaluator/Describer
idx_final_module = full_expt_tuple[-2]
Expand All @@ -427,10 +425,10 @@ def create(self, data: dict = None) -> None:
# 4. Row append if exist_report exist
if exist_report is not None:
if eval_expt_name in exist_report:
exist_result = exist_report[eval_expt_name]
rpt_data = pd.concat(
[exist_result, rpt_data],
axis=0
[exist_report[eval_expt_name].copy(), rpt_data],
axis=0,
ignore_index=True,
)

# 5. Collect result
Expand Down

0 comments on commit bfc6f38

Please sign in to comment.