From 1a8134c002f51fbbd23c8f11eb8c253bcde0da28 Mon Sep 17 00:00:00 2001 From: Sebastian Kloth Date: Tue, 7 Nov 2023 10:25:29 +0100 Subject: [PATCH] Added function to load data for multiply MDSystem --- src/mdevaluate/system.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mdevaluate/system.py b/src/mdevaluate/system.py index 86e1af5..15de993 100644 --- a/src/mdevaluate/system.py +++ b/src/mdevaluate/system.py @@ -42,3 +42,15 @@ class MDSystem(abc.ABC): ] ) run(["mv", hdf5_temp_file, hdf5_file]) + + +def load_and_concat_data(systems: list[MDSystem], key: str, verbose: bool = False): + data = [] + for system in systems: + try: + data.append(system.load_results(key=key)) + if verbose: + print(f"Load {system}") + except (FileNotFoundError, KeyError): + continue + return pd.concat(data, ignore_index=True)