本文整理汇总了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)
示例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)
示例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
示例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))