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


Python mlab.rec2csv方法代码示例

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


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

示例1: test_recarray_csv_roundtrip

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import rec2csv [as 别名]
def test_recarray_csv_roundtrip(self):
        expected = np.recarray((99,),
                               [(str('x'), np.float),
                                (str('y'), np.float),
                                (str('t'), np.float)])
        # initialising all values: uninitialised memory sometimes produces
        # floats that do not round-trip to string and back.
        expected['x'][:] = np.linspace(-1e9, -1, 99)
        expected['y'][:] = np.linspace(1, 1e9, 99)
        expected['t'][:] = np.linspace(0, 0.01, 99)

        mlab.rec2csv(expected, self.fd)
        self.fd.seek(0)
        actual = mlab.csv2rec(self.fd)

        assert_allclose(expected['x'], actual['x'])
        assert_allclose(expected['y'], actual['y'])
        assert_allclose(expected['t'], actual['t']) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:20,代码来源:test_mlab.py

示例2: test_recarray_csv_roundtrip

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import rec2csv [as 别名]
def test_recarray_csv_roundtrip(tempcsv):
    expected = np.recarray((99,),
                           [(str('x'), float),
                            (str('y'), float),
                            (str('t'), float)])
    # initialising all values: uninitialised memory sometimes produces
    # floats that do not round-trip to string and back.
    expected['x'][:] = np.linspace(-1e9, -1, 99)
    expected['y'][:] = np.linspace(1, 1e9, 99)
    expected['t'][:] = np.linspace(0, 0.01, 99)
    with pytest.warns(MatplotlibDeprecationWarning):
        mlab.rec2csv(expected, tempcsv)
        tempcsv.seek(0)
        actual = mlab.csv2rec(tempcsv)

    assert_allclose(expected['x'], actual['x'])
    assert_allclose(expected['y'], actual['y'])
    assert_allclose(expected['t'], actual['t']) 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:20,代码来源:test_mlab.py

示例3: test_rec2csv_bad_shape_ValueError

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import rec2csv [as 别名]
def test_rec2csv_bad_shape_ValueError(self):
        bad = np.recarray((99, 4), [(str('x'), np.float),
                                    (str('y'), np.float)])

        # the bad recarray should trigger a ValueError for having ndim > 1.
        assert_raises(ValueError, mlab.rec2csv, bad, self.fd) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:8,代码来源:test_mlab.py

示例4: test_recarray_csv_roundtrip

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import rec2csv [as 别名]
def test_recarray_csv_roundtrip(tempcsv):
    expected = np.recarray((99,), [('x', float), ('y', float), ('t', float)])
    # initialising all values: uninitialised memory sometimes produces
    # floats that do not round-trip to string and back.
    expected['x'][:] = np.linspace(-1e9, -1, 99)
    expected['y'][:] = np.linspace(1, 1e9, 99)
    expected['t'][:] = np.linspace(0, 0.01, 99)
    with pytest.warns(MatplotlibDeprecationWarning):
        mlab.rec2csv(expected, tempcsv)
        tempcsv.seek(0)
        actual = mlab.csv2rec(tempcsv)

    assert_allclose(expected['x'], actual['x'])
    assert_allclose(expected['y'], actual['y'])
    assert_allclose(expected['t'], actual['t']) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:17,代码来源:test_mlab.py

示例5: test_rec2csv_bad_shape_ValueError

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import rec2csv [as 别名]
def test_rec2csv_bad_shape_ValueError(tempcsv):
    bad = np.recarray((99, 4), [('x', float), ('y', float)])

    # the bad recarray should trigger a ValueError for having ndim > 1.
    with pytest.warns(MatplotlibDeprecationWarning):
        with pytest.raises(ValueError):
            mlab.rec2csv(bad, tempcsv) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:9,代码来源:test_mlab.py

示例6: test_rec2csv_bad_shape_ValueError

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import rec2csv [as 别名]
def test_rec2csv_bad_shape_ValueError(tempcsv):
    bad = np.recarray((99, 4), [(str('x'), float),
                                (str('y'), float)])

    # the bad recarray should trigger a ValueError for having ndim > 1.
    with pytest.warns(MatplotlibDeprecationWarning):
        with pytest.raises(ValueError):
            mlab.rec2csv(bad, tempcsv) 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:10,代码来源:test_mlab.py


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