Skip to content

Commit 1002eea

Browse files
committed
tests: tidy up filename
1 parent 60cb4a2 commit 1002eea

File tree

2 files changed

+7
-29
lines changed

2 files changed

+7
-29
lines changed

test/test_CPU_regularisers.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
###############################################################################
99

1010
class TestRegularisers(unittest.TestCase):
11+
def setUp(self):
12+
self.filename = os.path.join(os.path.dirname(__file__), "test_imageLena.bin")
13+
# lena_gray_512.tif
1114

1215
def getPars(self):
13-
#filename = os.path.join("test","lena_gray_512.tif")
1416
#plt = TiffReader()
15-
filename = os.path.join(os.path.dirname(__file__), "test_imageLena.bin")
1617
plt = BinReader()
1718
# read image
18-
Im = plt.imread(filename)
19+
Im = plt.imread(self.filename)
1920
Im = np.asarray(Im, dtype='float32')
2021
Im = Im / 255
2122
perc = 0.05

test/test_run_test.py

+3-26
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
class TestRegularisers(unittest.TestCase):
1212
def setUp(self):
1313
self.filename = os.path.join(os.path.dirname(__file__), "test_imageLena.bin")
14+
# lena_gray_512.tif
1415

1516
def test_ROF_TV_CPU_vs_GPU(self):
1617
#print ("tomas debug test function")
17-
#filename = os.path.join("test","lena_gray_512.tif")
1818
#plt = TiffReader()
19-
filename = os.path.join(os.path.dirname(__file__), "test_imageLena.bin")
2019
plt = BinReader()
2120
# read image
2221
Im = plt.imread(self.filename)
@@ -83,9 +82,7 @@ def test_ROF_TV_CPU_vs_GPU(self):
8382

8483
def test_FGP_TV_CPU_vs_GPU(self):
8584
print(__name__)
86-
#filename = os.path.join("test","lena_gray_512.tif")
8785
#plt = TiffReader()
88-
# self.filename = os.path.join("test","test_imageLena.bin")
8986
plt = BinReader()
9087
# read image
9188
Im = plt.imread(self.filename)
@@ -161,9 +158,7 @@ def test_FGP_TV_CPU_vs_GPU(self):
161158

162159
def test_PD_TV_CPU_vs_GPU(self):
163160
print(__name__)
164-
#filename = os.path.join("test","lena_gray_512.tif")
165161
#plt = TiffReader()
166-
# self.filename = os.path.join("test","test_imageLena.bin")
167162
plt = BinReader()
168163
# read image
169164
Im = plt.imread(self.filename)
@@ -243,10 +238,8 @@ def test_PD_TV_CPU_vs_GPU(self):
243238

244239
def test_SB_TV_CPU_vs_GPU(self):
245240
print(__name__)
246-
#filename = os.path.join("test","lena_gray_512.tif")
247241
#plt = TiffReader()
248242
# read image
249-
# filename = os.path.join("test","test_imageLena.bin")
250243
plt = BinReader()
251244
Im = plt.imread(self.filename)
252245
Im = np.asarray(Im, dtype='float32')
@@ -316,9 +309,7 @@ def test_SB_TV_CPU_vs_GPU(self):
316309

317310
def test_TGV_CPU_vs_GPU(self):
318311
print(__name__)
319-
#filename = os.path.join("test","lena_gray_512.tif")
320312
#plt = TiffReader()
321-
# filename = os.path.join("test","test_imageLena.bin")
322313
plt = BinReader()
323314
# read image
324315
Im = plt.imread(self.filename)
@@ -357,7 +348,7 @@ def test_TGV_CPU_vs_GPU(self):
357348
print ("#############TGV CPU####################")
358349
start_time = timeit.default_timer()
359350
infovector = np.zeros((2,), dtype='float32')
360-
tgv_cpu = TGV(pars['input'],
351+
tgv_cpu = TGV(pars['input'],
361352
pars['regularisation_parameter'],
362353
pars['alpha1'],
363354
pars['alpha0'],
@@ -374,7 +365,7 @@ def test_TGV_CPU_vs_GPU(self):
374365

375366
print ("##############TGV GPU##################")
376367
start_time = timeit.default_timer()
377-
tgv_gpu = TGV(pars['input'],
368+
tgv_gpu = TGV(pars['input'],
378369
pars['regularisation_parameter'],
379370
pars['alpha1'],
380371
pars['alpha0'],
@@ -397,10 +388,8 @@ def test_TGV_CPU_vs_GPU(self):
397388

398389
def test_LLT_ROF_CPU_vs_GPU(self):
399390
print(__name__)
400-
#filename = os.path.join("test","lena_gray_512.tif")
401391
#plt = TiffReader()
402392
# read image
403-
# filename = os.path.join("test","test_imageLena.bin")
404393
plt = BinReader()
405394
Im = plt.imread(self.filename)
406395
Im = np.asarray(Im, dtype='float32')
@@ -473,10 +462,8 @@ def test_LLT_ROF_CPU_vs_GPU(self):
473462

474463
def test_NDF_CPU_vs_GPU(self):
475464
print(__name__)
476-
#filename = os.path.join("test","lena_gray_512.tif")
477465
#plt = TiffReader()
478466
# read image
479-
# filename = os.path.join("test","test_imageLena.bin")
480467
plt = BinReader()
481468
Im = plt.imread(self.filename)
482469
Im = np.asarray(Im, dtype='float32')
@@ -551,10 +538,8 @@ def test_NDF_CPU_vs_GPU(self):
551538
self.assertLessEqual(diff_im.sum(), 1)
552539

553540
def test_Diff4th_CPU_vs_GPU(self):
554-
#filename = os.path.join("test","lena_gray_512.tif")
555541
#plt = TiffReader()
556542
# read image
557-
# filename = os.path.join(os.path.dirname(__file__), "test_imageLena.bin")
558543
plt = BinReader()
559544
Im = plt.imread(self.filename)
560545
Im = np.asarray(Im, dtype='float32')
@@ -624,10 +609,8 @@ def test_Diff4th_CPU_vs_GPU(self):
624609
self.assertLessEqual(diff_im.sum() , 1)
625610

626611
def test_FDGdTV_CPU_vs_GPU(self):
627-
#filename = os.path.join("test","lena_gray_512.tif")
628612
#plt = TiffReader()
629613
# read image
630-
# filename = os.path.join("test","test_imageLena.bin")
631614
plt = BinReader()
632615
Im = plt.imread(self.filename)
633616
Im = np.asarray(Im, dtype='float32')
@@ -704,8 +687,6 @@ def test_FDGdTV_CPU_vs_GPU(self):
704687
self.assertLessEqual(diff_im.sum(), 1)
705688
"""
706689
def test_cpu_ROF_TV(self):
707-
#filename = os.path.join(".." , ".." , ".." , "data" ,"testLena.npy")
708-
709690
filename = os.path.join("test","lena_gray_512.tif")
710691
711692
plt = TiffReader()
@@ -741,8 +722,6 @@ def test_cpu_ROF_TV(self):
741722
# now compare obtained rms with the expected value
742723
self.assertLess(abs(rms_rof-rms_rof_exp) , tolerance)
743724
def test_cpu_FGP_TV(self):
744-
#filename = os.path.join(".." , ".." , ".." , "data" ,"testLena.npy")
745-
746725
filename = os.path.join("test","lena_gray_512.tif")
747726
748727
plt = TiffReader()
@@ -782,7 +761,6 @@ def test_cpu_FGP_TV(self):
782761
self.assertLess(abs(rms_fgp-rms_fgp_exp) , tolerance)
783762
784763
def test_gpu_ROF(self):
785-
#filename = os.path.join(".." , ".." , ".." , "data" ,"testLena.npy")
786764
filename = os.path.join("test","lena_gray_512.tif")
787765
788766
plt = TiffReader()
@@ -817,7 +795,6 @@ def test_gpu_ROF(self):
817795
self.assertLess(abs(rms_rof-rms_rof_exp) , tolerance)
818796
819797
def test_gpu_FGP(self):
820-
#filename = os.path.join(".." , ".." , ".." , "data" ,"testLena.npy")
821798
filename = os.path.join("test","lena_gray_512.tif")
822799
823800
plt = TiffReader()

0 commit comments

Comments
 (0)