From 7cbdf2fc8dd5f2d733922a954b076bf8ba83c351 Mon Sep 17 00:00:00 2001
From: Remy Prechelt <prechelt@hawaii.edu>
Date: Sun, 7 Feb 2021 22:19:28 -1000
Subject: [PATCH] Move summary and config loading into base class.

---
 .../corsika/io/outputs/observation_plane.py   | 22 ++---------------
 python/corsika/io/outputs/output.py           | 24 +++++++++++++++----
 2 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/python/corsika/io/outputs/observation_plane.py b/python/corsika/io/outputs/observation_plane.py
index bd18edc8e..3b2680e17 100644
--- a/python/corsika/io/outputs/observation_plane.py
+++ b/python/corsika/io/outputs/observation_plane.py
@@ -30,10 +30,7 @@ class ObservationPlane(Output):
         path: str
             The path to the directory containing this output.
         """
-
-        # load and store our path and config
-        self.path = path
-        self.__config = self.load_config(path)
+        super().__init__(path)
 
         # try and load our data
         try:
@@ -53,7 +50,7 @@ class ObservationPlane(Output):
         bool:
             True if this is a good output.
         """
-        return self.__data is not None and self.__config is not None
+        return self.__data is not None
 
     def astype(self, dtype: str = "pandas", **kwargs: Any) -> Any:
         """
@@ -83,21 +80,6 @@ class ObservationPlane(Output):
                 )
             )
 
-    @property
-    def config(self) -> Dict[str, Any]:
-        """
-        Return the config file for this output.
-
-        Parameters
-        ----------
-
-        Returns
-        -------
-        Dict[str, any]
-            The configuration file for this output.
-        """
-        return self.__config
-
     def __repr__(self) -> str:
         """
         Return a string representation of this class.
diff --git a/python/corsika/io/outputs/output.py b/python/corsika/io/outputs/output.py
index 3a1353f5e..83a4c7928 100644
--- a/python/corsika/io/outputs/output.py
+++ b/python/corsika/io/outputs/output.py
@@ -20,7 +20,6 @@ class Output(ABC):
     that wish to provide reading support for CORSIKA8 outputs.
     """
 
-    @abstractmethod
     def __init__(self, path: str):
         """
         __init__ must load the output files and check
@@ -31,7 +30,10 @@ class Output(ABC):
         path: str
             The path to the directory containing this output.
         """
-        pass
+        # load and store our path and config
+        self.path = path
+        self.__config = self.load_config(path)
+        self.__summary = self.load_summary(path)
 
     @abstractmethod
     def is_good(self) -> bool:
@@ -68,7 +70,6 @@ class Output(ABC):
         pass
 
     @property
-    @abstractmethod
     def config(self) -> Dict[str, Any]:
         """
         Return the config file for this output.
@@ -81,7 +82,22 @@ class Output(ABC):
         Dict[str, any]
             The configuration file for this output.
         """
-        pass
+        return self.__config
+
+    @property
+    def summary(self) -> Dict[str, Any]:
+        """
+        Return the summary file for this output.
+
+        Parameters
+        ----------
+
+        Returns
+        -------
+        Dict[str, any]
+            The summary file for this output.
+        """
+        return self.__summary
 
     @property
     def data(self) -> Any:
-- 
GitLab