本文整理汇总了Python中hyperspy.signal.Signal._print_summary方法的典型用法代码示例。如果您正苦于以下问题:Python Signal._print_summary方法的具体用法?Python Signal._print_summary怎么用?Python Signal._print_summary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hyperspy.signal.Signal
的用法示例。
在下文中一共展示了Signal._print_summary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from hyperspy.signal import Signal [as 别名]
# 或者: from hyperspy.signal.Signal import _print_summary [as 别名]
#.........这里部分代码省略.........
np.testing.assert_array_equal(self.signal.data.sum(0), s.data)
nt.assert_equal(s.data.ndim, 1)
nt.assert_equal(s.axes_manager.navigation_dimension, 0)
def test_sum_x_E(self):
s = self.signal.sum(("x", "E"))
_verify_test_sum_x_E(self, s)
s = self.signal.sum((0, "E"))
_verify_test_sum_x_E(self, s)
s = self.signal.sum((self.signal.axes_manager[0], "E"))
_verify_test_sum_x_E(self, s)
s = self.signal.sum("x").sum("E")
_verify_test_sum_x_E(self, s)
def test_axis_by_str(self):
m = mock.Mock()
s1 = self.signal.deepcopy()
s1.events.data_changed.connect(m.data_changed)
s2 = self.signal.deepcopy()
s1.crop(0, 2, 4)
nt.assert_true(m.data_changed.called)
s2.crop("x", 2, 4)
nt.assert_true((s1.data == s2.data).all())
def test_crop_int(self):
s = self.signal
d = self.data
s.crop(0, 2, 4)
nt.assert_true((s.data == d[2:4, :]).all())
def test_crop_float(self):
s = self.signal
d = self.data
s.crop(0, 2, 2.)
nt.assert_true((s.data == d[2:4, :]).all())
def test_split_axis0(self):
result = self.signal.split(0, 2)
nt.assert_true(len(result) == 2)
nt.assert_true((result[0].data == self.data[:2, :]).all())
nt.assert_true((result[1].data == self.data[2:4, :]).all())
def test_split_axis1(self):
result = self.signal.split(1, 2)
nt.assert_true(len(result) == 2)
nt.assert_true((result[0].data == self.data[:, :5]).all())
nt.assert_true((result[1].data == self.data[:, 5:]).all())
def test_split_axisE(self):
result = self.signal.split("E", 2)
nt.assert_true(len(result) == 2)
nt.assert_true((result[0].data == self.data[:, :5]).all())
nt.assert_true((result[1].data == self.data[:, 5:]).all())
def test_split_default(self):
result = self.signal.split()
nt.assert_true(len(result) == 5)
nt.assert_true((result[0].data == self.data[0]).all())
def test_histogram(self):
result = self.signal.get_histogram(3)
nt.assert_true(isinstance(result, signals.Spectrum))
nt.assert_true((result.data == np.array([17, 16, 17])).all())
nt.assert_true(result.metadata.Signal.binned)
def test_estimate_poissonian_noise_copy_data(self):
self.signal.estimate_poissonian_noise_variance()
variance = self.signal.metadata.Signal.Noise_properties.variance
nt.assert_true(
variance.data is not self.signal.data)
def test_estimate_poissonian_noise_noarg(self):
self.signal.estimate_poissonian_noise_variance()
variance = self.signal.metadata.Signal.Noise_properties.variance
nt.assert_true((variance.data == self.signal.data).all())
def test_estimate_poissonian_noise_with_args(self):
self.signal.estimate_poissonian_noise_variance(
expected_value=self.signal,
gain_factor=2,
gain_offset=1,
correlation_factor=0.5)
variance = self.signal.metadata.Signal.Noise_properties.variance
nt.assert_true(
(variance.data == (self.signal.data * 2 + 1) * 0.5).all())
def test_unfold_image(self):
s = self.signal
s.axes_manager.set_signal_dimension(2)
s.unfold()
nt.assert_equal(s.data.shape, (50,))
def test_unfold_image_returns_true(self):
s = self.signal
s.axes_manager.set_signal_dimension(2)
nt.assert_true(s.unfold())
def test_print_summary(self):
# Just test if it doesn't raise an exception
self.signal._print_summary()