Esempio n. 1
0
 def test_chipsize_valid(self):
     for illegal in [
             0, -1, -15, 1, 2, self.ifgs[0].ncols + 1, 4, 6, 10, 20
     ]:
         self.params[C.REF_CHIP_SIZE] = illegal
         with pytest.raises(RefPixelError):
             ref_pixel(self.ifgs, self.params)
Esempio n. 2
0
    def test_missing_search_windows(self):
        self.params[C.REFNX] = None
        with pytest.raises(ConfigException):
            ref_pixel(self.ifgs, self.params)

        self.params[C.REFNX] = REFNX
        self.params[C.REFNY] = None

        with pytest.raises(ConfigException):
            ref_pixel(self.ifgs, self.params)
Esempio n. 3
0
    def test_search_windows(self):
        # 45 is max # cells a width 3 sliding window can iterate over
        for illegal in [-5, -1, 0, 46, 50, 100]:
            self.params[C.REFNX] = illegal
            with pytest.raises(RefPixelError):
                ref_pixel(self.ifgs, self.params)

        # 40 is max # cells a width 3 sliding window can iterate over
        for illegal in [-5, -1, 0, 71, 85, 100]:
            self.params[C.REFNY] = illegal
            with pytest.raises(RefPixelError):
                ref_pixel(self.ifgs, self.params)
Esempio n. 4
0
    def test_ref_pixel(self):
        exp_refpx = (2, 25)
        self.params[C.REFNX] = 2
        self.params[C.REFNY] = 2
        self.params[C.REF_CHIP_SIZE] = 5
        self.params[C.REF_MIN_FRAC] = MIN_FRAC
        self.params[C.PARALLEL] = PARALLEL
        res = ref_pixel(self.ifgs, self.params)
        assert res == exp_refpx

        # Invalidate first data stack, get new refpix coods & retest
        for i in self.ifgs:
            i.phase_data[:30, :50] = nan

        exp_refpx = (38, 2)
        res = ref_pixel(self.ifgs, self.params)
        assert res == exp_refpx
Esempio n. 5
0
    def test_all_below_threshold_exception(self):
        # test failure when no valid stacks in dataset

        # rig mock data to be below threshold
        mock_ifgs = [MockIfg(i, 6, 7) for i in self.ifgs]
        for m in mock_ifgs:
            m.phase_data[:1] = nan
            m.phase_data[1:5] = 0.1
            m.phase_data[5:] = nan

        self.params[C.REFNX] = 2
        self.params[C.REFNY] = 2
        self.params[C.REF_CHIP_SIZE] = CHIPSIZE
        self.params[C.REF_MIN_FRAC] = MIN_FRAC
        self.params[C.PARALLEL] = PARALLEL
        with pytest.raises(ValueError):
            ref_pixel(mock_ifgs, self.params)
Esempio n. 6
0
 def test_large_window(self):
     # 5x5 view over a 5x5 ifg with 1 window/ref pix search
     chps = 5
     mockifgs = [MockIfg(i, chps, chps) for i in self.ifgs]
     self.params[C.REFNX] = 1
     self.params[C.REFNY] = 1
     self.params[C.REF_CHIP_SIZE] = chps
     self.params[C.REF_MIN_FRAC] = MIN_FRAC
     self.params[C.PARALLEL] = PARALLEL
     res = ref_pixel(mockifgs, self.params)
     assert (2, 2) == res
Esempio n. 7
0
 def test_refnxy_step_1(self):
     # test step of 1 for refnx|y gets the reference pixel for axis centre
     mock_ifgs = [MockIfg(i, 47, 72) for i in self.ifgs]
     for m in mock_ifgs:
         m.phase_data[:1] = 0.2
         m.phase_data[1:5] = 0.1
         m.phase_data[5:] = 0.3
     exp_refpx = (1, 1)
     self.params[C.REFNX] = 1
     self.params[C.REFNY] = 1
     self.params[C.REF_CHIP_SIZE] = CHIPSIZE
     self.params[C.REF_MIN_FRAC] = MIN_FRAC
     self.params[C.PARALLEL] = PARALLEL
     res = ref_pixel(mock_ifgs, self.params)
     assert exp_refpx == res
Esempio n. 8
0
 def test_minimum_fraction_threshold(self):
     for illegal in [-0.1, 1.1, 1.000001, -0.0000001]:
         self.params[C.REF_MIN_FRAC] = illegal
         with pytest.raises(RefPixelError):
             ref_pixel(self.ifgs, self.params)
Esempio n. 9
0
 def test_minimum_fraction_missing(self):
     self.params[C.REF_MIN_FRAC] = None
     with pytest.raises(ConfigException):
         ref_pixel(self.ifgs, self.params)
Esempio n. 10
0
 def test_missing_chipsize(self):
     self.params[C.REF_CHIP_SIZE] = None
     with pytest.raises(ConfigException):
         ref_pixel(self.ifgs, self.params)