Repository: CUQI-DTU/CUQIpy-FEniCS (language: python)

Issue:
sync array module updates in CUQIpy-FEniCS



Discussion / hints:

Fix patch:
diff --git a/cuqipy_fenics/pde.py b/cuqipy_fenics/pde.py
index f48d19d..b4b0800 100644
--- a/cuqipy_fenics/pde.py
+++ b/cuqipy_fenics/pde.py
@@ -1,7 +1,7 @@
 import numpy as np
 from abc import ABC, abstractmethod
 from cuqi.pde import PDE
-from cuqi.samples import CUQIarray
+from cuqi.array import CUQIarray
 import dolfin as dl
 import ufl
 from copy import copy
diff --git a/demos/demo05_reuse_assemble.py b/demos/demo05_reuse_assemble.py
index a1a9628..2cf3a9f 100644
--- a/demos/demo05_reuse_assemble.py
+++ b/demos/demo05_reuse_assemble.py
@@ -84,7 +84,7 @@ def rhs_form2(m,p):
 
 
 #%% 2.6. Create exact solution and data
-exact_solution =cuqi.samples.CUQIarray( 
+exact_solution =cuqi.array.CUQIarray( 
     np.random.randn(domain_geometry.par_dim),
     is_par=True,geometry= domain_geometry )
 


Test patch:
diff --git a/cuqipy_fenics/testproblem.py b/cuqipy_fenics/testproblem.py
index a98c02d..65adf5b 100644
--- a/cuqipy_fenics/testproblem.py
+++ b/cuqipy_fenics/testproblem.py
@@ -120,7 +120,7 @@ def form(m,u,p):
             exactSolution = np.ones(N)*.8
             exactSolution[np.where(grid > endpoint/2.0)
                           ] = fun(grid[np.where(grid > endpoint/2.0)])
-            exactSolution = cuqi.samples.CUQIarray(
+            exactSolution = cuqi.array.CUQIarray(
                 exactSolution, geometry=domain_geometry)
 
         # Generate exact data
@@ -132,7 +132,7 @@ def form(m,u,p):
         noise = np.random.normal(0, 1, b_exact.shape)
         alpha = np.linalg.norm(b_exact)/(np.sqrt(SNR)*np.linalg.norm(noise))
 
-        data = cuqi.samples.CUQIarray(
+        data = cuqi.array.CUQIarray(
             b_exact + alpha*noise, geometry=range_geometry)
 
         # Create likelihood
diff --git a/tests/test_PDEModel.py b/tests/test_PDEModel.py
index 69b3365..66e7452 100644
--- a/tests/test_PDEModel.py
+++ b/tests/test_PDEModel.py
@@ -14,7 +14,7 @@ def test_model_input():
 
     # Test passing a CUQIarray containing parameters
     u = dl.Function(V)
-    u_CUQIarray = cuqi.samples.CUQIarray(u.vector().get_local(), is_par=True, geometry=model.domain_geometry)
+    u_CUQIarray = cuqi.array.CUQIarray(u.vector().get_local(), is_par=True, geometry=model.domain_geometry)
     y = model(u_CUQIarray)
 
     # Test passing parameters as a numpy array
@@ -24,13 +24,13 @@ def test_model_input():
 
     # Test passing a CUQIarray containing dolfin function
     u = dl.Function(V)
-    u_CUQIarray = cuqi.samples.CUQIarray(u, is_par=False, geometry=model.domain_geometry)
+    u_CUQIarray = cuqi.array.CUQIarray(u, is_par=False, geometry=model.domain_geometry)
     y = model(u_CUQIarray)
 
     # Test passing a CUQIarray containing dolfin function wrapped in np.array
     # This is not recommended, but should work
     u = dl.Function(V)
-    u_CUQIarray = cuqi.samples.CUQIarray(np.array(u, dtype='O'), is_par=False, geometry=model.domain_geometry)
+    u_CUQIarray = cuqi.array.CUQIarray(np.array(u, dtype='O'), is_par=False, geometry=model.domain_geometry)
     y = model(u_CUQIarray)  
 
     # Test passing a dolfin function (should fail)
@@ -244,7 +244,7 @@ def u_boundary(x, on_boundary):
 
     # Create exact solution and data
     np.random.seed(0)
-    exact_solution = cuqi.samples.CUQIarray(
+    exact_solution = cuqi.array.CUQIarray(
         np.random.randn(domain_geometry.par_dim),
         is_par=True, geometry=domain_geometry)