本文整理汇总了Python中hyperspy.signal.Signal.as_spectrum方法的典型用法代码示例。如果您正苦于以下问题:Python Signal.as_spectrum方法的具体用法?Python Signal.as_spectrum怎么用?Python Signal.as_spectrum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hyperspy.signal.Signal
的用法示例。
在下文中一共展示了Signal.as_spectrum方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from hyperspy.signal import Signal [as 别名]
# 或者: from hyperspy.signal.Signal import as_spectrum [as 别名]
class Test2d:
def setUp(self):
self.s = Signal(np.random.random((2, 3)))
def test_as_image_T(self):
assert_true(
self.s.data.T.shape == self.s.as_image((0, 1)).data.shape)
def test_as_image(self):
assert_true(
self.s.data.shape == self.s.as_image((1, 0)).data.shape)
def test_as_spectrum_T(self):
assert_true(
self.s.data.T.shape == self.s.as_spectrum(0).data.shape)
def test_as_spectrum(self):
assert_true(
self.s.data.shape == self.s.as_spectrum(1).data.shape)
def test_s2EELS2im2s(self):
s = self.s.as_spectrum(0)
s.set_signal_type("EELS")
im = s.as_image((1, 0))
assert_equal(im.metadata.Signal.signal_type, "EELS")
s = im.as_spectrum(0)
assert_equal(s.metadata.Signal.signal_type, "EELS")
assert_true(isinstance(s, signals.EELSSpectrum))
示例2: Test1d
# 需要导入模块: from hyperspy.signal import Signal [as 别名]
# 或者: from hyperspy.signal.Signal import as_spectrum [as 别名]
class Test1d():
def setUp(self):
self.s = Signal(np.arange(2))
@raises(DataDimensionError)
def test_as_image(self):
assert_true((self.s.data == self.s.as_image((0,1)).data).all())
def test_as_spectrum(self):
assert_true((self.s.data == self.s.as_spectrum(0).data).all())
def test_set_EELS(self):
s = self.s.as_spectrum(0)
s.set_signal_type("EELS")
assert_equal(s.mapped_parameters.signal_type, "EELS")
assert_true(isinstance(s, signals.EELSSpectrum))
示例3: setUp
# 需要导入模块: from hyperspy.signal import Signal [as 别名]
# 或者: from hyperspy.signal.Signal import as_spectrum [as 别名]
class Test1d:
def setUp(self):
self.s = Signal(np.arange(2))
@nt.raises(DataDimensionError)
def test_as_image(self):
self.s.as_image((0, 1))
def test_as_spectrum(self):
np.testing.assert_array_equal(self.s.data, self.s.as_spectrum(0).data)
def test_set_EELS(self):
s = self.s.as_spectrum(0)
s.set_signal_type("EELS")
nt.assert_equal(s.metadata.Signal.signal_type, "EELS")
nt.assert_is_instance(s, signals.EELSSpectrum)