From 0e6c14cd25995988d14bed51409e875394309c24 Mon Sep 17 00:00:00 2001 From: robjmcgibbon Date: Fri, 2 Aug 2024 10:05:40 +0100 Subject: [PATCH] Squash bug registering field names --- swiftsimio/reader.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/swiftsimio/reader.py b/swiftsimio/reader.py index 116052dc..8ef640e8 100644 --- a/swiftsimio/reader.py +++ b/swiftsimio/reader.py @@ -924,15 +924,13 @@ def convert(name): return re.sub("([a-z0-9])([A-Z])", r"\1_\2", name).lower() # Skip fields which are groups themselves - self.field_paths = [ - f"{self.group}/{item}" - for item in self.metadata.handle[f"{self.group}"].keys() - if f"{self.group}/{item}" not in self.metadata.present_groups - ] - - self.field_names = [ - convert(item) for item in self.metadata.handle[f"{self.group}"].keys() - ] + self.field_paths = [] + self.field_names = [] + for item in self.metadata.handle[f"{self.group}"].keys(): + # Skip fields which are groups themselves + if f"{self.group}/{item}" not in self.metadata.present_groups: + self.field_paths.append(f"{self.group}/{item}") + self.field_names.append(convert(item)) return