From 7fd03ff7f7e283662eb04c3b7108ab067d4bdcf9 Mon Sep 17 00:00:00 2001
From: kohlhaasrebecca <rebecca.kohlhaas@outlook.com>
Date: Wed, 9 Oct 2024 12:17:21 +0200
Subject: [PATCH] [tests] Add some PCE PostProcessing tests

---
 .../post_processing/post_processing.py        | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/bayesvalidrox/post_processing/post_processing.py b/src/bayesvalidrox/post_processing/post_processing.py
index 2d3ba0196..eb467c53a 100644
--- a/src/bayesvalidrox/post_processing/post_processing.py
+++ b/src/bayesvalidrox/post_processing/post_processing.py
@@ -571,9 +571,9 @@ class PostProcessing:
         # This function currently only supports PCE/aPCE
         PCEModel = self.engine.MetaModel
         if not hasattr(PCEModel, 'meta_model_type'):
-            raise AttributeError('Sobol indices currently only support PCE-type models!')
+            raise AttributeError('Sobol indices only support PCE-type models!')
         if PCEModel.meta_model_type.lower() not in ['pce', 'apce']:
-            raise AttributeError('Sobol indices currently only support PCE-type models!')
+            raise AttributeError('Sobol indices only support PCE-type models!')
             
         # Extract the necessary variables
         basis_dict = PCEModel._basis_dict
@@ -969,10 +969,14 @@ class PostProcessing:
 
     # -------------------------------------------------------------------------
     def eval_pce_model_3d(self):
+        # This function currently only supports PCE/aPCE
+        PCEModel = self.engine.MetaModel
+        if not hasattr(PCEModel, 'meta_model_type'):
+            raise AttributeError('This evaluation only support PCE-type models!')
+        if PCEModel.meta_model_type.lower() not in ['pce', 'apce']:
+            raise AttributeError('This evaluation only support PCE-type models!')
 
         self.n_samples = 1000
-
-        PCEModel = self.engine.MetaModel
         n_samples = self.n_samples
 
         # Create 3D-Grid
@@ -1197,6 +1201,13 @@ class PostProcessing:
         None.
 
         """
+        # This function currently only supports PCE/aPCE
+        PCEModel = self.engine.MetaModel
+        if not hasattr(PCEModel, 'meta_model_type'):
+            raise AttributeError('This evaluation only support PCE-type models!')
+        if PCEModel.meta_model_type.lower() not in ['pce', 'apce']:
+            raise AttributeError('This evaluation only support PCE-type models!')
+
         newpath = f'Outputs_PostProcessing_{self.name}/'
         if not os.path.exists(newpath):
             os.makedirs(newpath)
-- 
GitLab