當前位置: 首頁>>代碼示例>>Python>>正文


Python stats.circmean方法代碼示例

本文整理匯總了Python中scipy.stats.circmean方法的典型用法代碼示例。如果您正苦於以下問題:Python stats.circmean方法的具體用法?Python stats.circmean怎麽用?Python stats.circmean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scipy.stats的用法示例。


在下文中一共展示了stats.circmean方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_circmean

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_circmean(self):
        """ Test custom circular mean."""

        ref_mean = scistats.circmean(self.test_angles, **self.circ_kwargs)
        test_mean = pystats.nan_circmean(self.test_angles, **self.circ_kwargs)

        assert ref_mean == test_mean 
開發者ID:pysat,項目名稱:pysat,代碼行數:9,代碼來源:test_utils_stats.py

示例2: test_circmean_nan

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_circmean_nan(self):
        """ Test custom circular mean with NaN."""

        ref_mean = scistats.circmean(self.test_angles, **self.circ_kwargs)
        ref_nan = scistats.circmean(self.test_nan, **self.circ_kwargs)
        test_nan = pystats.nan_circmean(self.test_nan, **self.circ_kwargs)

        assert np.isnan(ref_nan)
        assert ref_mean == test_nan 
開發者ID:pysat,項目名稱:pysat,代碼行數:11,代碼來源:test_utils_stats.py

示例3: test_deprecation_warning_circmean

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_deprecation_warning_circmean(self):
        """Test if circmean in stats is deprecated"""

        with warnings.catch_warnings(record=True) as war:
            try:
                pystats.nan_circmean(None)
            except TypeError:
                # Setting input to None should produce a TypeError after
                # warning is generated
                pass

        assert len(war) >= 1
        assert war[0].category == DeprecationWarning 
開發者ID:pysat,項目名稱:pysat,代碼行數:15,代碼來源:test_utils_stats.py

示例4: test_circfuncs

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_circfuncs(self):
        x = np.array([355,5,2,359,10,350])
        M = stats.circmean(x, high=360)
        Mval = 0.167690146
        assert_allclose(M, Mval, rtol=1e-7)

        V = stats.circvar(x, high=360)
        Vval = 42.51955609
        assert_allclose(V, Vval, rtol=1e-7)

        S = stats.circstd(x, high=360)
        Sval = 6.520702116
        assert_allclose(S, Sval, rtol=1e-7) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:15,代碼來源:test_morestats.py

示例5: test_circfuncs_small

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_circfuncs_small(self):
        x = np.array([20,21,22,18,19,20.5,19.2])
        M1 = x.mean()
        M2 = stats.circmean(x, high=360)
        assert_allclose(M2, M1, rtol=1e-5)

        V1 = x.var()
        V2 = stats.circvar(x, high=360)
        assert_allclose(V2, V1, rtol=1e-4)

        S1 = x.std()
        S2 = stats.circstd(x, high=360)
        assert_allclose(S2, S1, rtol=1e-4) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:15,代碼來源:test_morestats.py

示例6: test_circmean_axis

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_circmean_axis(self):
        x = np.array([[355,5,2,359,10,350],
                      [351,7,4,352,9,349],
                      [357,9,8,358,4,356]])
        M1 = stats.circmean(x, high=360)
        M2 = stats.circmean(x.ravel(), high=360)
        assert_allclose(M1, M2, rtol=1e-14)

        M1 = stats.circmean(x, high=360, axis=1)
        M2 = [stats.circmean(x[i], high=360) for i in range(x.shape[0])]
        assert_allclose(M1, M2, rtol=1e-14)

        M1 = stats.circmean(x, high=360, axis=0)
        M2 = [stats.circmean(x[:,i], high=360) for i in range(x.shape[1])]
        assert_allclose(M1, M2, rtol=1e-14) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:17,代碼來源:test_morestats.py

示例7: test_circfuncs_array_like

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_circfuncs_array_like(self):
        x = [355,5,2,359,10,350]
        assert_allclose(stats.circmean(x, high=360), 0.167690146, rtol=1e-7)
        assert_allclose(stats.circvar(x, high=360), 42.51955609, rtol=1e-7)
        assert_allclose(stats.circstd(x, high=360), 6.520702116, rtol=1e-7) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:7,代碼來源:test_morestats.py

示例8: test_empty

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_empty(self):
        assert_(np.isnan(stats.circmean([])))
        assert_(np.isnan(stats.circstd([])))
        assert_(np.isnan(stats.circvar([]))) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:6,代碼來源:test_morestats.py

示例9: test_circfuncs

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_circfuncs(self):
        x = np.array([355, 5, 2, 359, 10, 350])
        M = stats.circmean(x, high=360)
        Mval = 0.167690146
        assert_allclose(M, Mval, rtol=1e-7)

        V = stats.circvar(x, high=360)
        Vval = 42.51955609
        assert_allclose(V, Vval, rtol=1e-7)

        S = stats.circstd(x, high=360)
        Sval = 6.520702116
        assert_allclose(S, Sval, rtol=1e-7) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:15,代碼來源:test_morestats.py

示例10: test_circfuncs_small

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_circfuncs_small(self):
        x = np.array([20, 21, 22, 18, 19, 20.5, 19.2])
        M1 = x.mean()
        M2 = stats.circmean(x, high=360)
        assert_allclose(M2, M1, rtol=1e-5)

        V1 = x.var()
        V2 = stats.circvar(x, high=360)
        assert_allclose(V2, V1, rtol=1e-4)

        S1 = x.std()
        S2 = stats.circstd(x, high=360)
        assert_allclose(S2, S1, rtol=1e-4) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:15,代碼來源:test_morestats.py

示例11: test_circmean_axis

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_circmean_axis(self):
        x = np.array([[355, 5, 2, 359, 10, 350],
                      [351, 7, 4, 352, 9, 349],
                      [357, 9, 8, 358, 4, 356]])
        M1 = stats.circmean(x, high=360)
        M2 = stats.circmean(x.ravel(), high=360)
        assert_allclose(M1, M2, rtol=1e-14)

        M1 = stats.circmean(x, high=360, axis=1)
        M2 = [stats.circmean(x[i], high=360) for i in range(x.shape[0])]
        assert_allclose(M1, M2, rtol=1e-14)

        M1 = stats.circmean(x, high=360, axis=0)
        M2 = [stats.circmean(x[:, i], high=360) for i in range(x.shape[1])]
        assert_allclose(M1, M2, rtol=1e-14) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:17,代碼來源:test_morestats.py

示例12: test_circfuncs_array_like

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_circfuncs_array_like(self):
        x = [355, 5, 2, 359, 10, 350]
        assert_allclose(stats.circmean(x, high=360), 0.167690146, rtol=1e-7)
        assert_allclose(stats.circvar(x, high=360), 42.51955609, rtol=1e-7)
        assert_allclose(stats.circstd(x, high=360), 6.520702116, rtol=1e-7) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:7,代碼來源:test_morestats.py

示例13: test_circmean_range

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_circmean_range(self):
        # regression test for gh-6420: circmean(..., high, low) must be
        # between `high` and `low`
        m = stats.circmean(np.arange(0, 2, 0.1), np.pi, -np.pi)
        assert_(m < np.pi)
        assert_(m > -np.pi) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:8,代碼來源:test_morestats.py

示例14: test_circfuncs_unit8

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_circfuncs_unit8(self):
        # regression test for gh-7255: overflow when working with
        # numpy uint8 data type
        x = np.array([150, 10], dtype='uint8')
        assert_equal(stats.circmean(x, high=180), 170.0)
        assert_allclose(stats.circvar(x, high=180), 437.45871686, rtol=1e-7)
        assert_allclose(stats.circstd(x, high=180), 20.91551378, rtol=1e-7) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:9,代碼來源:test_morestats.py

示例15: test_can_predict_from_data

# 需要導入模塊: from scipy import stats [as 別名]
# 或者: from scipy.stats import circmean [as 別名]
def test_can_predict_from_data():
    Invt_model = InvertedEncoding()
    Invt_model.fit(X, y)
    m_reconstruct = []
    for j in np.arange(dim):
        preds = Invt_model.predict(X2[n_*j:n_*(j+1), :])
        tmp = circmean(np.deg2rad(preds))
        m_reconstruct.append(np.rad2deg(tmp))
    logger.info('Reconstructed angles: ' + str(m_reconstruct))


# Show that prediction is invalid when input data is wrong size 
開發者ID:brainiak,項目名稱:brainiak,代碼行數:14,代碼來源:test_iem.py


注:本文中的scipy.stats.circmean方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。