本文整理汇总了Python中neo.core.analogsignal.AnalogSignal.std方法的典型用法代码示例。如果您正苦于以下问题:Python AnalogSignal.std方法的具体用法?Python AnalogSignal.std怎么用?Python AnalogSignal.std使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neo.core.analogsignal.AnalogSignal
的用法示例。
在下文中一共展示了AnalogSignal.std方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestAnalogSignalArrayArrayMethods
# 需要导入模块: from neo.core.analogsignal import AnalogSignal [as 别名]
# 或者: from neo.core.analogsignal.AnalogSignal import std [as 别名]
#.........这里部分代码省略.........
assert_arrays_equal(result.array_annotations['anno2'], np.array(['a', 'b', 'c', 'd', 'e']))
self.assertIsInstance(result.array_annotations, ArrayDict)
self.assertEqual(result.shape, (5, 5))
self.assertEqual(result.t_start, self.signal1.t_start + 2 * self.signal1.sampling_period)
self.assertEqual(result.t_stop, self.signal1.t_start + 7 * self.signal1.sampling_period)
self.assertEqual(result.sampling_rate, self.signal1.sampling_rate)
assert_arrays_equal(result, self.data1[2:7])
def test__getitem_should_return_single_quantity(self):
# quantities drops the units in this case
self.assertEqual(self.signal1[9, 3], 48000 * pq.pA)
self.assertEqual(self.signal1[9][3], self.signal1[9, 3])
self.assertTrue(hasattr(self.signal1[9, 3], 'units'))
self.assertRaises(IndexError, self.signal1.__getitem__, (99, 73))
def test_comparison_operators(self):
assert_arrays_equal(self.signal1[0:3, 0:3] >= 5 * pq.nA, np.array(
[[False, False, False], [True, True, True], [True, True, True]]))
assert_arrays_equal(self.signal1[0:3, 0:3] >= 5 * pq.pA, np.array(
[[False, True, True], [True, True, True], [True, True, True]]))
assert_arrays_equal(self.signal1[0:3, 0:3] == 5 * pq.nA, np.array(
[[False, False, False], [True, False, False], [False, False, False]]))
assert_arrays_equal(self.signal1[0:3, 0:3] == self.signal1[0:3, 0:3],
np.array([[True, True, True], [True, True, True], [True, True, True]]))
def test__comparison_with_inconsistent_units_should_raise_Exception(self):
self.assertRaises(ValueError, self.signal1.__gt__, 5 * pq.mV)
def test__simple_statistics(self):
self.assertEqual(self.signal1.max(), 54000 * pq.pA)
self.assertEqual(self.signal1.min(), 0 * pq.nA)
self.assertEqual(self.signal1.mean(), 27 * pq.nA)
self.assertEqual(self.signal1.std(), self.signal1.magnitude.std() * pq.nA)
self.assertEqual(self.signal1.var(), self.signal1.magnitude.var() * pq.nA ** 2)
def test__rescale_same(self):
result = self.signal1.copy()
result = result.rescale(pq.nA)
self.assertIsInstance(result, AnalogSignal)
assert_neo_object_is_compliant(result)
self.assertEqual(result.name, 'spam')
self.assertEqual(result.description, 'eggs')
self.assertEqual(result.file_origin, 'testfile.txt')
self.assertEqual(result.annotations, {'arg1': 'test'})
assert_arrays_equal(result.array_annotations['anno1'], np.arange(5))
assert_arrays_equal(result.array_annotations['anno2'], np.array(['a', 'b', 'c', 'd', 'e']))
self.assertIsInstance(result.array_annotations, ArrayDict)
self.assertEqual(result.units, 1 * pq.nA)
assert_arrays_equal(result, self.data1)
assert_same_sub_schema(result, self.signal1)
def test__rescale_new(self):
result = self.signal1.copy()
result = result.rescale(pq.pA)
self.assertIsInstance(result, AnalogSignal)
assert_neo_object_is_compliant(result)
self.assertEqual(result.name, 'spam')
self.assertEqual(result.description, 'eggs')
self.assertEqual(result.file_origin, 'testfile.txt')
self.assertEqual(result.annotations, {'arg1': 'test'})
assert_arrays_equal(result.array_annotations['anno1'], np.arange(5))
assert_arrays_equal(result.array_annotations['anno2'], np.array(['a', 'b', 'c', 'd', 'e']))