Пример #1
0
    def test_kdp_from_phidp(self, derivation_method):
        if (derivation_method == 'lstsq' and sys.platform.startswith("win")):
            pytest.skip("fails on windows due to MKL issue")

        # compare with true kdp
        out = dp.kdp_from_phidp(self.phidp_true,
                                dr=self.dr,
                                method=derivation_method)
        outx = out[:, self.pad:-self.pad]
        res = self.kdp_true[:, self.pad:-self.pad]
        np.testing.assert_array_almost_equal(outx, res, decimal=4)

        # intercompare with lanczos method with NaN handling
        out0 = dp.kdp_from_phidp(self.phidp_true,
                                 dr=self.dr,
                                 method='lanczos_conv')
        np.testing.assert_array_almost_equal(out, out0, decimal=4)

        # intercompare with lanczos method without NaN-handling
        out0 = dp.kdp_from_phidp(self.phidp_true_nan,
                                 dr=self.dr,
                                 method='lanczos_conv',
                                 skipna=False)
        outx = dp.kdp_from_phidp(self.phidp_true_nan,
                                 dr=self.dr,
                                 method=derivation_method,
                                 skipna=False)
        np.testing.assert_array_almost_equal(outx, out0, decimal=4)
Пример #2
0
    def test_unfold_phi_vulpiani(self):
        phi_true = np.arange(600)
        phi_raw1 = phi_true.copy()
        phi_raw1[phi_raw1 > 540] -= 360
        phi_raw2 = phi_raw1.copy()
        phi_raw2[phi_raw2 > 180] -= 360
        kdp1 = dp.kdp_from_phidp(phi_raw1)
        kdp2 = dp.kdp_from_phidp(phi_raw2)

        out1 = dp.unfold_phi_vulpiani(phi_raw1.copy(), kdp1)
        out2 = dp.unfold_phi_vulpiani(phi_raw2.copy(), kdp2)
        kdp3 = dp.kdp_from_phidp(out2)
        out3 = dp.unfold_phi_vulpiani(out2.copy(), kdp3)

        np.testing.assert_array_equal(out1, phi_true)
        np.testing.assert_array_equal(out2, phi_raw1)
        np.testing.assert_array_equal(out3, phi_true)
Пример #3
0
    def test_kdp_from_phidp(self, derivation_method):
        if derivation_method == "lstsq" and sys.platform.startswith("win"):
            pytest.skip("fails on windows due to MKL issue")
        if derivation_method == "lstsq" and sys.platform.startswith("linux"):
            pytest.skip("segfaults on linux for some unknow reason")

        window = 7

        # compare with true kdp
        out = dp.kdp_from_phidp(
            self.phidp_true.copy(), dr=self.dr, method=derivation_method, winlen=window
        )
        outx = out[:, self.pad : -self.pad]
        res = self.kdp_true[:, self.pad : -self.pad]
        np.testing.assert_array_almost_equal(outx, res, decimal=4)

        # intercompare with lanczos method with NaN handling
        out0 = dp.kdp_from_phidp(
            self.phidp_true.copy(), dr=self.dr, method="lanczos_conv", winlen=window
        )
        np.testing.assert_array_almost_equal(out, out0, decimal=4)
Пример #4
0
    def test_kdp_from_phidp_nan(self, derivation_method):
        if derivation_method == "lstsq" and sys.platform.startswith("win"):
            pytest.skip("fails on windows due to MKL issue")
        if derivation_method == "lstsq" and sys.platform.startswith("linux"):
            pytest.skip("segfaults on linux for some unknow reason")

        window = 7

        # intercompare with lanczos method without NaN-handling
        out0 = dp.kdp_from_phidp(
            self.phidp_true_nan.copy(),
            dr=self.dr,
            method="lanczos_conv",
            skipna=False,
            winlen=window,
        )
        outx = dp.kdp_from_phidp(
            self.phidp_true_nan.copy(),
            dr=self.dr,
            method=derivation_method,
            skipna=False,
            winlen=window,
        )
        np.testing.assert_array_almost_equal(outx, out0, decimal=4)
Пример #5
0
 def test_kdp_from_phidp(self):
     dp.kdp_from_phidp(self.phidp_raw, dr=self.dr)
     dp.kdp_from_phidp(self.phidp_raw, dr=self.dr, method='slow')
Пример #6
0
 def test_kdp_from_phidp(self):
     dp.kdp_from_phidp(self.phidp_raw, dr=self.dr)
     dp.kdp_from_phidp(self.phidp_raw, dr=self.dr, method='slow')