本文整理汇总了Python中sunpy.spectra.sources.callisto.CallistoSpectrogram._homogenize_params方法的典型用法代码示例。如果您正苦于以下问题:Python CallistoSpectrogram._homogenize_params方法的具体用法?Python CallistoSpectrogram._homogenize_params怎么用?Python CallistoSpectrogram._homogenize_params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sunpy.spectra.sources.callisto.CallistoSpectrogram
的用法示例。
在下文中一共展示了CallistoSpectrogram._homogenize_params方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_homogenize_rightfq
# 需要导入模块: from sunpy.spectra.sources.callisto import CallistoSpectrogram [as 别名]
# 或者: from sunpy.spectra.sources.callisto.CallistoSpectrogram import _homogenize_params [as 别名]
def test_homogenize_rightfq():
a = np.float64(np.random.randint(0, 255, 3600))[np.newaxis, :]
c1 = CallistoSpectrogram(
a,
np.arange(3600),
np.array([1]),
datetime(2011, 1, 1),
datetime(2011, 1, 1, 1),
0,
1,
'Time',
'Frequency',
'Test',
None,
None,
None,
False
)
b = 2 * a + 1
c2 = CallistoSpectrogram(
np.concatenate([
np.arange(3600)[np.newaxis, :], b,
np.arange(3600)[np.newaxis, :]
], 0),
np.arange(3600),
np.array([0, 1, 2]),
datetime(2011, 1, 1),
datetime(2011, 1, 1, 1),
0,
1,
'Time',
'Frequency',
'Test',
None,
None,
None,
False
)
pairs_indices, factors, constants = c1._homogenize_params(
c2, 0
)
assert pairs_indices == [(0, 1)]
assert_array_almost_equal(factors, [0.5], 2)
assert_array_almost_equal(constants, [-0.5], 2)
assert_array_almost_equal(factors[0] * b + constants[0], a)
示例2: test_homogenize_both
# 需要导入模块: from sunpy.spectra.sources.callisto import CallistoSpectrogram [as 别名]
# 或者: from sunpy.spectra.sources.callisto.CallistoSpectrogram import _homogenize_params [as 别名]
def test_homogenize_both():
a = np.float64(np.random.randint(0, 255, 3600))[np.newaxis, :]
c1 = CallistoSpectrogram(
a,
np.arange(3600),
np.array([1]),
datetime(2011, 1, 1),
datetime(2011, 1, 1, 1),
0,
1,
"Time",
"Frequency",
"Test",
None,
None,
None,
False,
)
b = 2 * a + 1
c2 = CallistoSpectrogram(
b,
np.arange(3600),
np.array([1]),
datetime(2011, 1, 1),
datetime(2011, 1, 1, 1),
0,
1,
"Time",
"Frequency",
"Test",
None,
None,
None,
False,
)
pairs_indices, factors, constants = c1._homogenize_params(c2, 0)
assert pairs_indices == [(0, 0)]
assert_array_almost_equal(factors, [0.5], 2)
assert_array_almost_equal(constants, [-0.5], 2)
assert_array_almost_equal(factors[0] * b + constants[0], a)