Beispiel #1
0
    def alt_orbital_correction(self, ifg, deg, offset):
        data = ifg.phase_data.reshape(ifg.num_cells)
        dm = get_design_matrix(ifg, deg, offset)[~isnan(data)]
        fd = data[~isnan(data)].reshape((dm.shape[0], 1))

        dmt = dm.T
        invNbb = inv(dmt.dot(dm))
        orbparams = invNbb.dot(dmt.dot(fd))
        alt_params = lstsq(dm, fd)[0]
        # FIXME: precision
        assert_array_almost_equal(orbparams, alt_params, decimal=2)

        dm2 = get_design_matrix(ifg, deg, offset)

        if offset:
            fullorb = np.reshape(np.dot(dm2[:, :-1], orbparams[:-1]),
                                 ifg.phase_data.shape)
        else:
            fullorb = np.reshape(np.dot(dm2, orbparams), ifg.phase_data.shape)

        offset_removal = nanmedian(
            np.reshape(ifg.phase_data - fullorb, (1, -1)))
        fwd_correction = fullorb - offset_removal
        # ifg.phase_data -= (fullorb - offset_removal)
        return ifg.phase_data - fwd_correction
Beispiel #2
0
 def test_create_quadratic_dm_offsets(self):
     offset = True
     act = get_design_matrix(self.m, QUADRATIC, offset)
     self.assertEqual(act.shape, (self.m.num_cells, 6))
     exp = unittest_dm(self.m, INDEPENDENT_METHOD, QUADRATIC, offset)
     assert_array_equal(act, exp)
Beispiel #3
0
 def test_create_planar_dm_offsets(self):
     offset = True
     act = get_design_matrix(self.m, PLANAR, offset)
     self.assertEqual(act.shape, (self.m.num_cells, 3))
     exp = unittest_dm(self.m, INDEPENDENT_METHOD, PLANAR, offset)
     assert_array_almost_equal(act, exp)
Beispiel #4
0
 def test_create_partcubic_dm_offsets(self):
     offset = True
     act = get_design_matrix(self.m, PART_CUBIC, offset)
     self.assertEqual(act.shape, (self.m.num_cells, 7))
     exp = unittest_dm(self.m, INDEPENDENT_METHOD, PART_CUBIC, offset)
     assert_array_equal(act, exp)
Beispiel #5
0
 def test_create_planar_dm(self):
     offset = False
     act = get_design_matrix(self.m, PLANAR, offset)
     assert act.shape == (self.m.num_cells, 2)
     exp = unittest_dm(self.m, INDEPENDENT_METHOD, PLANAR, offset)
     assert_array_equal(act, exp)
Beispiel #6
0
 def test_create_partcubic_dm(self):
     offset = False
     act = get_design_matrix(self.m, PART_CUBIC, offset)
     assert act.shape == (self.m.num_cells, 6)
     exp = unittest_dm(self.m, INDEPENDENT_METHOD, PART_CUBIC, offset)
     assert_array_equal(act, exp)
Beispiel #7
0
 def test_create_quadratic_dm(self):
     offset = False
     act = get_design_matrix(self.m, QUADRATIC, offset)
     assert act.shape == (self.m.num_cells, 5)
     exp = unittest_dm(self.m, INDEPENDENT_METHOD, QUADRATIC, offset)
     assert_array_equal(act, exp)