From 740dae19fa6a8373b1dfed5a1ceb3fb8f7693f3e Mon Sep 17 00:00:00 2001
From: Maria Fernanda Morales <65073126+mfmo45@users.noreply.github.com>
Date: Thu, 18 Jul 2024 17:04:05 +0200
Subject: [PATCH] Fixed bug with 1D test case in MCMC

---
 .idea/bayesvalidrox.iml                   | 2 +-
 .idea/misc.xml                            | 2 +-
 examples/user_guide/example_user_guide.py | 2 +-
 src/bayesvalidrox/bayes_inference/mcmc.py | 5 +++++
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/.idea/bayesvalidrox.iml b/.idea/bayesvalidrox.iml
index fab03b6ec..f1f562a22 100644
--- a/.idea/bayesvalidrox.iml
+++ b/.idea/bayesvalidrox.iml
@@ -5,7 +5,7 @@
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
     </content>
-    <orderEntry type="inheritedJdk" />
+    <orderEntry type="jdk" jdkName="Python 3.10 (env_bvr)" jdkType="Python SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
   </component>
   <component name="PyDocumentationSettings">
diff --git a/.idea/misc.xml b/.idea/misc.xml
index a6218fed0..b4038aec5 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,5 +3,5 @@
   <component name="Black">
     <option name="sdkName" value="Python 3.11" />
   </component>
-  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" />
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (env_bvr)" project-jdk-type="Python SDK" />
 </project>
\ No newline at end of file
diff --git a/examples/user_guide/example_user_guide.py b/examples/user_guide/example_user_guide.py
index 50b555f3b..aa583c5fa 100644
--- a/examples/user_guide/example_user_guide.py
+++ b/examples/user_guide/example_user_guide.py
@@ -120,7 +120,7 @@ if __name__ == '__main__':
     obsData = pd.DataFrame(Model.observations, columns=Model.Output.names)
     DiscrepancyOpts = Discrepancy('')
     DiscrepancyOpts.type = 'Gaussian'
-    DiscrepancyOpts.parameters = obsData**2
+    DiscrepancyOpts.parameters = obsData**2 + 0.01
     
     BayesObj = BayesInference(Engine_)
     BayesObj.emulator = True
diff --git a/src/bayesvalidrox/bayes_inference/mcmc.py b/src/bayesvalidrox/bayes_inference/mcmc.py
index ad7c9f1e5..a9914826a 100755
--- a/src/bayesvalidrox/bayes_inference/mcmc.py
+++ b/src/bayesvalidrox/bayes_inference/mcmc.py
@@ -319,6 +319,11 @@ class MCMC:
                     )
                 initsamples = inputSamples[random_indices]
 
+            # Check if ndim == 1, change to 2D vector (nwalkers, ndim)
+            # ToDo: Check if it is better to change this in how the samples are taken (line 309)
+            if initsamples.ndim == 1:
+                initsamples = initsamples.reshape(-1, 1)
+
         else:
             if self.initsamples.ndim == 1:
                 # When MAL is given.
-- 
GitLab