@@ -18,52 +18,38 @@ def setUp(self):
1818 def tearDown (self ):
1919 pass
2020
21- def testDownsample2D_EvenEven (self ):
22- # source resolution: 64
23- # target resolution: 32
24- imgs_org , imgs_ds = self .createImages (64 , 32 )
21+ def _testDownsample2DCase (self , L , L_ds ):
22+ # downsampling from size L to L_ds
23+ imgs_org , imgs_ds = self .createImages (L , L_ds )
2524 # check resolution is correct
26- self .assertEqual ((self .n , 32 , 32 ), imgs_ds .shape )
27- # check individual gridpoints for all images
28- self .assertTrue (self .checkGridPoints (imgs_org , imgs_ds ))
25+ self .assertEqual ((self .n , L_ds , L_ds ), imgs_ds .shape )
26+ # check center points for all images
27+ self .assertTrue (self .checkCenterPoint (imgs_org , imgs_ds ))
2928 # check signal energy is conserved
3029 self .assertTrue (self .checkSignalEnergy (imgs_org , imgs_ds ))
3130
31+ def testDownsample2D_EvenEven (self ):
32+ # source resolution: 64
33+ # target resolution: 32
34+ self ._testDownsample2DCase (64 , 32 )
35+
3236 @unittest .skip (
3337 "Signal energy test fails for this case in current DS implementation"
3438 )
3539 def testDownsample2D_EvenOdd (self ):
3640 # source resolution: 64
3741 # target resolution: 33
38- imgs_org , imgs_ds = self .createImages (64 , 33 )
39- # check resolution is correct
40- self .assertEqual ((self .n , 33 , 33 ), imgs_ds .shape )
41- # check invidual gridpoints for all images
42- self .assertTrue (self .checkGridPoints (imgs_org , imgs_ds ))
43- # check signal energy is conserved
44- self .assertTrue (self .checkSignalEnergy (imgs_org , imgs_ds ))
42+ self ._testDownsample2DCase (64 , 33 )
4543
4644 def testDownsample2D_OddOdd (self ):
4745 # source resolution: 65
4846 # target resolution: 33
49- imgs_org , imgs_ds = self .createImages (65 , 33 )
50- # check resolution is correct
51- self .assertEqual ((self .n , 33 , 33 ), imgs_ds .shape )
52- # check invidual gridpoints for all images
53- self .assertTrue (self .checkGridPoints (imgs_org , imgs_ds ))
54- # check signal energy is conserved
55- self .assertTrue (self .checkSignalEnergy (imgs_org , imgs_ds ))
47+ self ._testDownsample2DCase (65 , 33 )
5648
5749 def testDownsample2D_OddEven (self ):
5850 # source resolution: 65
5951 # target resolution: 32
60- imgs_org , imgs_ds = self .createImages (65 , 32 )
61- # check resolution is correct
62- self .assertEqual ((self .n , 32 , 32 ), imgs_ds .shape )
63- # check invidual gridpoints for all images
64- self .assertTrue (self .checkGridPoints (imgs_org , imgs_ds ))
65- # check signal energy is conserved
66- self .assertTrue (self .checkSignalEnergy (imgs_org , imgs_ds ))
52+ self ._testDownsample2DCase (65 , 32 )
6753
6854 def checkCenterPoint (self , imgs_org , imgs_ds ):
6955 # Check that center point is the same after ds
0 commit comments