当前位置: 首页>>代码示例>>Python>>正文


Python stats.circstd方法代码示例

本文整理汇总了Python中scipy.stats.circstd方法的典型用法代码示例。如果您正苦于以下问题:Python stats.circstd方法的具体用法?Python stats.circstd怎么用?Python stats.circstd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scipy.stats的用法示例。


在下文中一共展示了stats.circstd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_circstd_axis

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [as 别名]
def test_circstd_axis(self):
        x = np.array([[355,5,2,359,10,350],
                      [351,7,4,352,9,349],
                      [357,9,8,358,4,356]])

        S1 = stats.circstd(x, high=360)
        S2 = stats.circstd(x.ravel(), high=360)
        assert_allclose(S1, S2, rtol=1e-11)

        S1 = stats.circstd(x, high=360, axis=1)
        S2 = [stats.circstd(x[i], high=360) for i in range(x.shape[0])]
        assert_allclose(S1, S2, rtol=1e-11)

        S1 = stats.circstd(x, high=360, axis=0)
        S2 = [stats.circstd(x[:,i], high=360) for i in range(x.shape[1])]
        assert_allclose(S1, S2, rtol=1e-11) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:test_morestats.py

示例2: test_circstd_axis

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [as 别名]
def test_circstd_axis(self):
        x = np.array([[355, 5, 2, 359, 10, 350],
                      [351, 7, 4, 352, 9, 349],
                      [357, 9, 8, 358, 4, 356]])

        S1 = stats.circstd(x, high=360)
        S2 = stats.circstd(x.ravel(), high=360)
        assert_allclose(S1, S2, rtol=1e-11)

        S1 = stats.circstd(x, high=360, axis=1)
        S2 = [stats.circstd(x[i], high=360) for i in range(x.shape[0])]
        assert_allclose(S1, S2, rtol=1e-11)

        S1 = stats.circstd(x, high=360, axis=0)
        S2 = [stats.circstd(x[:, i], high=360) for i in range(x.shape[1])]
        assert_allclose(S1, S2, rtol=1e-11) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:18,代码来源:test_morestats.py

示例3: test_circstd

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [as 别名]
def test_circstd(self):
        """ Test custom circular std."""

        ref_std = scistats.circstd(self.test_angles, **self.circ_kwargs)
        test_std = pystats.nan_circstd(self.test_angles, **self.circ_kwargs)

        assert ref_std == test_std 
开发者ID:pysat,项目名称:pysat,代码行数:9,代码来源:test_utils_stats.py

示例4: test_circstd_nan

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [as 别名]
def test_circstd_nan(self):
        """ Test custom circular std with NaN."""

        ref_std = scistats.circstd(self.test_angles, **self.circ_kwargs)
        ref_nan = scistats.circstd(self.test_nan, **self.circ_kwargs)
        test_nan = pystats.nan_circstd(self.test_nan, **self.circ_kwargs)

        assert np.isnan(ref_nan)
        assert ref_std == test_nan 
开发者ID:pysat,项目名称:pysat,代码行数:11,代码来源:test_utils_stats.py

示例5: test_deprecation_warning_circstd

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [as 别名]
def test_deprecation_warning_circstd(self):
        """Test if circstd in stats is deprecated"""

        with warnings.catch_warnings(record=True) as war:
            try:
                pystats.nan_circstd(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

示例6: test_circfuncs

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [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

示例7: test_circfuncs_small

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [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

示例8: test_circfuncs_array_like

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [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

示例9: test_empty

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [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

示例10: test_circfuncs

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [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

示例11: test_circfuncs_small

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [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

示例12: test_circfuncs_array_like

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [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_circular_standard_deviation_1d

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [as 别名]
def test_circular_standard_deviation_1d(data):
    high = 8
    low = 4
    assert np.allclose(
        _circular_standard_deviation(data, high=high, low=low), circstd(data, high=high, low=low),
    ) 
开发者ID:arviz-devs,项目名称:arviz,代码行数:8,代码来源:test_stats_utils.py

示例14: radial_stddev

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [as 别名]
def radial_stddev(L):
    scipy = circstd(L, 360,0)
    return scipy 
开发者ID:protwis,项目名称:protwis,代码行数:5,代码来源:models.py

示例15: _mc_error

# 需要导入模块: from scipy import stats [as 别名]
# 或者: from scipy.stats import circstd [as 别名]
def _mc_error(ary, batches=5, circular=False):
    """Calculate the simulation standard error, accounting for non-independent samples.

    The trace is divided into batches, and the standard deviation of the batch
    means is calculated.

    Parameters
    ----------
    ary : Numpy array
        An array containing MCMC samples
    batches : integer
        Number of batches
    circular : bool
        Whether to compute the error taking into account `ary` is a circular variable
        (in the range [-np.pi, np.pi]) or not. Defaults to False (i.e non-circular variables).

    Returns
    -------
    mc_error : float
        Simulation standard error
    """
    _numba_flag = Numba.numba_flag
    if ary.ndim > 1:

        dims = np.shape(ary)
        trace = np.transpose([t.ravel() for t in ary])

        return np.reshape([_mc_error(t, batches) for t in trace], dims[1:])

    else:
        if _not_valid(ary, check_shape=False):
            return np.nan
        if batches == 1:
            if circular:
                if _numba_flag:
                    std = _circular_standard_deviation(ary, high=np.pi, low=-np.pi)
                else:
                    std = stats.circstd(ary, high=np.pi, low=-np.pi)
            else:
                if _numba_flag:
                    std = np.float(_sqrt(svar(ary), np.zeros(1)))
                else:
                    std = np.std(ary)
            return std / np.sqrt(len(ary))

        batched_traces = np.resize(ary, (batches, int(len(ary) / batches)))

        if circular:
            means = stats.circmean(batched_traces, high=np.pi, low=-np.pi, axis=1)
            if _numba_flag:
                std = _circular_standard_deviation(means, high=np.pi, low=-np.pi)
            else:
                std = stats.circstd(means, high=np.pi, low=-np.pi)
        else:
            means = np.mean(batched_traces, 1)
            if _numba_flag:
                std = _sqrt(svar(means), np.zeros(1))
            else:
                std = np.std(means)

        return std / np.sqrt(batches) 
开发者ID:arviz-devs,项目名称:arviz,代码行数:63,代码来源:diagnostics.py


注:本文中的scipy.stats.circstd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。