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


Python LinearTimeSpectrogram.resample_time方法代码示例

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


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

示例1: test_join_nonlinear

# 需要导入模块: from sunpy.spectra.spectrogram import LinearTimeSpectrogram [as 别名]
# 或者: from sunpy.spectra.spectrogram.LinearTimeSpectrogram import resample_time [as 别名]
def test_join_nonlinear():
    image = np.random.rand(200, 3600)
    one = LinearTimeSpectrogram(
        image, np.linspace(0, 0.5 * (image.shape[1] - 1), image.shape[1]),
        np.linspace(0, image.shape[0] - 1, image.shape[0]),
        datetime(2010, 10, 10, 23, 45),
        datetime(2010, 10, 11, 0, 15,), 85500, 0.5,
    )

    image = np.random.rand(200, 3600)
    other = LinearTimeSpectrogram(
        image, np.linspace(0, image.shape[1] - 1, image.shape[1]),
        np.linspace(0, image.shape[0] - 1, image.shape[0]),
        datetime(2010, 10, 11, 0, 15),
        datetime(2010, 10, 11, 1, 15), 901, 1,
    )

    oz = other.resample_time(0.5)

    z = LinearTimeSpectrogram.join_many(
        [one, other], nonlinear=True, maxgap=2
    )

    # The - 1 is because resampling other produces an image of size
    # 2 * 3600 - 1
    assert z.shape == (200, 3 * 3600 - 1)

    assert np.array_equal(z.data[:, :3600], one.data)
    assert np.array_equal(z.time_axis[:3600], one.time_axis)
    assert np.array_equal(z.time_axis[3600:], oz.time_axis + 1801)
    assert isinstance(z, Spectrogram)
开发者ID:derdon,项目名称:sunpy,代码行数:33,代码来源:test_spectrogram.py

示例2: test_join_over_midnight

# 需要导入模块: from sunpy.spectra.spectrogram import LinearTimeSpectrogram [as 别名]
# 或者: from sunpy.spectra.spectrogram.LinearTimeSpectrogram import resample_time [as 别名]
def test_join_over_midnight():
    image = np.random.rand(200, 3600)
    one = LinearTimeSpectrogram(
        image, np.linspace(0, 0.5 * (image.shape[1] - 1), image.shape[1]),
        np.linspace(0, image.shape[0] - 1, image.shape[0]),
        datetime(2010, 10, 10, 23, 45),
        datetime(2010, 10, 11, 0, 15,), 85500, 0.5,
    )
    image = np.random.rand(200, 3600)
    other = LinearTimeSpectrogram(
        image, np.linspace(0, image.shape[1] - 1, image.shape[1]),
        np.linspace(0, image.shape[0] - 1, image.shape[0]),
        datetime(2010, 10, 11, 0, 15), datetime(2010, 10, 11, 1, 15), 900, 1,
    )

    z = LinearTimeSpectrogram.join_many(
        [one, other], nonlinear=False, maxgap=0
    )
    oz = other.resample_time(0.5)

    # The - 1 is because resampling other procuces an image of size
    # 2 * 3600 - 1
    assert z.shape == (200, 3 * 3600 - 1)

    assert np.array_equal(z[:, :3600], one)
    assert np.array_equal(z.time_axis[:3600], one.time_axis)
    assert is_linear(z.time_axis)
    assert isinstance(z, LinearTimeSpectrogram)
开发者ID:ToyDragon,项目名称:sunpy,代码行数:30,代码来源:test_spectrogram.py

示例3: test_upsample

# 需要导入模块: from sunpy.spectra.spectrogram import LinearTimeSpectrogram [as 别名]
# 或者: from sunpy.spectra.spectrogram.LinearTimeSpectrogram import resample_time [as 别名]
def test_upsample():
    image = np.array([[0, 1, 2, 3], [0, 1, 2, 3]])
    spec = LinearTimeSpectrogram(
        image, np.array([0, 1, 2]), np.array([0]),
        datetime(2012, 1, 1), datetime(2012, 1, 1, 0, 0, 3),
        0, 1
    )
    r = spec.resample_time(2)
    assert r.shape[1] == 2
开发者ID:derdon,项目名称:sunpy,代码行数:11,代码来源:test_spectrogram.py

示例4: test_resample

# 需要导入模块: from sunpy.spectra.spectrogram import LinearTimeSpectrogram [as 别名]
# 或者: from sunpy.spectra.spectrogram.LinearTimeSpectrogram import resample_time [as 别名]
def test_resample():
    image = np.array([[0, 1, 2], [0, 1, 2]])
    spec = LinearTimeSpectrogram(
        image, np.array([0, 1, 2]), np.array([0]),
        datetime(2012, 1, 1), datetime(2012, 1, 1, 0, 0, 3),
        0, 1
    )
    r = spec.resample_time(0.5)
    assert r.shape[1] == 5
    assert np.array_equal(r.time_axis, np.linspace(0, 2, 5))
开发者ID:derdon,项目名称:sunpy,代码行数:12,代码来源:test_spectrogram.py


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