Exemplo n.º 1
0
    def test_get_bin_count(self):

        V = Variogram(self.c, self.v)

        # check type
        assert isinstance(V.bin_count, np.ndarray)

        # check against real bin count
        assert np.array_equal(
            V.bin_count, np.array([22, 54, 87, 65, 77, 47, 46, 24, 10, 2]))

        # check property gets updated
        old_bin_count = V.bin_count

        # when setting binning function
        V.bin_func = 'uniform'
        assert not np.array_equal(V.bin_count, old_bin_count)

        # when setting maxlag
        old_bin_count = V.bin_count
        V.maxlag = 25
        assert not np.array_equal(V.bin_count, old_bin_count)

        # when setting nlags
        V.n_lags = 5
        assert len(V.bin_count) == 5
Exemplo n.º 2
0
    def test_binning_change_nlags(self):
        V = Variogram(self.c, self.v, n_lags=5)

        # 5 lags are awaited
        self.assertTrue(V.n_lags == 5)

        # switch to fd rule
        V.bin_func = 'fd'

        self.assertTrue(V.n_lags == 13)
Exemplo n.º 3
0
    def test_binning_method_setting(self):
        V = Variogram(self.c, self.v, n_lags=4)

        # lags
        even = [10.58, 21.15, 31.73, 42.3]
        uniform = [10.25, 16.21, 22.71, 42.3]

        # test even
        assert_array_almost_equal(even, V.bins, decimal=2)

        # set to uniform
        V.set_bin_func('uniform')
        assert_array_almost_equal(uniform, V.bins, decimal=2)

        # restore even
        V.bin_func = 'even'
        assert_array_almost_equal(even, V.bins, decimal=2)