summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2019-06-03 11:45:18 -0400
committerEdoardo Pasca <edo.paskino@gmail.com>2019-06-03 11:45:18 -0400
commit78cd1b52af32e10752802835e91500d338d4dc06 (patch)
tree5c41d51ac9d5e0c6e93660f82c7e59a1d432d694
parent31410bc217c7de4659e5df35f3423fdbbd04f59a (diff)
parent8787adfef38ded4852b53a6d7812bb7d4f888d86 (diff)
downloadframework-78cd1b52af32e10752802835e91500d338d4dc06.tar.gz
framework-78cd1b52af32e10752802835e91500d338d4dc06.tar.bz2
framework-78cd1b52af32e10752802835e91500d338d4dc06.tar.xz
framework-78cd1b52af32e10752802835e91500d338d4dc06.zip
Merge branch 'norm2sq_bugfix' into composite_operator_datacontainer
-rwxr-xr-xWrappers/Python/ccpi/optimisation/functions/Norm2Sq.py4
-rw-r--r--Wrappers/Python/ccpi/optimisation/functions/__init__.py2
-rw-r--r--Wrappers/Python/test/test_functions.py6
-rwxr-xr-xWrappers/Python/test/test_run_test.py10
4 files changed, 11 insertions, 11 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/functions/Norm2Sq.py b/Wrappers/Python/ccpi/optimisation/functions/Norm2Sq.py
index b553d7c..0b6bb0b 100755
--- a/Wrappers/Python/ccpi/optimisation/functions/Norm2Sq.py
+++ b/Wrappers/Python/ccpi/optimisation/functions/Norm2Sq.py
@@ -21,7 +21,7 @@ import numpy
import warnings
# Define a class for squared 2-norm
-class Norm2sq(Function):
+class Norm2Sq(Function):
'''
f(x) = c*||A*x-b||_2^2
@@ -38,7 +38,7 @@ class Norm2sq(Function):
'''
def __init__(self,A,b,c=1.0,memopt=False):
- super(Norm2sq, self).__init__()
+ super(Norm2Sq, self).__init__()
self.A = A # Should be an operator, default identity
self.b = b # Default zero DataSet?
diff --git a/Wrappers/Python/ccpi/optimisation/functions/__init__.py b/Wrappers/Python/ccpi/optimisation/functions/__init__.py
index a82ee3e..c0eab31 100644
--- a/Wrappers/Python/ccpi/optimisation/functions/__init__.py
+++ b/Wrappers/Python/ccpi/optimisation/functions/__init__.py
@@ -10,4 +10,4 @@ from .FunctionOperatorComposition import FunctionOperatorComposition
from .MixedL21Norm import MixedL21Norm
from .IndicatorBox import IndicatorBox
from .KullbackLeibler import KullbackLeibler
-from .Norm2Sq import Norm2sq
+from .Norm2Sq import Norm2Sq
diff --git a/Wrappers/Python/test/test_functions.py b/Wrappers/Python/test/test_functions.py
index af419c7..523008d 100644
--- a/Wrappers/Python/test/test_functions.py
+++ b/Wrappers/Python/test/test_functions.py
@@ -20,7 +20,7 @@ from ccpi.optimisation.operators import Gradient
from ccpi.optimisation.functions import L2NormSquared
from ccpi.optimisation.functions import L1Norm, MixedL21Norm
-from ccpi.optimisation.functions import Norm2sq
+from ccpi.optimisation.functions import Norm2Sq
from ccpi.optimisation.functions import ZeroFunction
from ccpi.optimisation.functions import FunctionOperatorComposition
@@ -298,7 +298,7 @@ class TestFunction(unittest.TestCase):
b = ig.allocate(ImageGeometry.RANDOM_INT)
A = 0.5 * Identity(ig)
- old_chisq = Norm2sq(A, b, 1.0)
+ old_chisq = Norm2Sq(A, b, 1.0)
new_chisq = FunctionOperatorComposition(A, L2NormSquared(b=b))
yold = old_chisq(u)
@@ -364,4 +364,4 @@ class TestFunction(unittest.TestCase):
proxc = f.proximal_conjugate(x,1.2)
f.proximal_conjugate(x, 1.2, out=out)
- numpy.testing.assert_array_equal(proxc.as_array(), out.as_array()) \ No newline at end of file
+ numpy.testing.assert_array_equal(proxc.as_array(), out.as_array())
diff --git a/Wrappers/Python/test/test_run_test.py b/Wrappers/Python/test/test_run_test.py
index 9b4d53b..a6c13f4 100755
--- a/Wrappers/Python/test/test_run_test.py
+++ b/Wrappers/Python/test/test_run_test.py
@@ -8,7 +8,7 @@ from ccpi.framework import ImageGeometry
from ccpi.framework import AcquisitionGeometry
from ccpi.optimisation.algorithms import FISTA
#from ccpi.optimisation.algs import FBPD
-from ccpi.optimisation.functions import Norm2sq
+from ccpi.optimisation.functions import Norm2Sq
from ccpi.optimisation.functions import ZeroFunction
from ccpi.optimisation.funcs import Norm1
from ccpi.optimisation.funcs import Norm2
@@ -80,7 +80,7 @@ class TestAlgorithms(unittest.TestCase):
lam = 10
opt = {'memopt': True}
# Create object instances with the test data A and b.
- f = Norm2sq(A, b, c=0.5, memopt=True)
+ f = Norm2Sq(A, b, c=0.5, memopt=True)
g0 = ZeroFunction()
# Initial guess
@@ -144,7 +144,7 @@ class TestAlgorithms(unittest.TestCase):
lam = 10
opt = {'memopt': True}
# Create object instances with the test data A and b.
- f = Norm2sq(A, b, c=0.5, memopt=True)
+ f = Norm2Sq(A, b, c=0.5, memopt=True)
g0 = ZeroFunction()
# Initial guess
@@ -218,7 +218,7 @@ class TestAlgorithms(unittest.TestCase):
x_init = DataContainer(np.random.randn(n, 1))
# Create object instances with the test data A and b.
- f = Norm2sq(A, b, c=0.5, memopt=True)
+ f = Norm2Sq(A, b, c=0.5, memopt=True)
f.L = LinearOperator.PowerMethod(A, 25, x_init)[0]
print ("Lipschitz", f.L)
g0 = ZeroFun()
@@ -286,7 +286,7 @@ class TestAlgorithms(unittest.TestCase):
y.array = y.array + 0.1*np.random.randn(N, N)
# Data fidelity term
- f_denoise = Norm2sq(I, y, c=0.5, memopt=True)
+ f_denoise = Norm2Sq(I, y, c=0.5, memopt=True)
x_init = ImageData(geometry=ig)
f_denoise.L = LinearOperator.PowerMethod(I, 25, x_init)[0]