本文整理汇总了Python中neo.test.tools.assert_same_sub_schema函数的典型用法代码示例。如果您正苦于以下问题:Python assert_same_sub_schema函数的具体用法?Python assert_same_sub_schema怎么用?Python assert_same_sub_schema使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_same_sub_schema函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test__add_two_consistent_signals_should_preserve_data_complement
def test__add_two_consistent_signals_should_preserve_data_complement(self):
data2 = np.arange(10.0, 20.0)
data2quant = data2*pq.mV
signal2 = IrregularlySampledSignal(self.time1quant, signal=data2quant)
assert_neo_object_is_compliant(signal2)
result = self.signal1 + signal2
self.assertIsInstance(result, IrregularlySampledSignal)
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'})
targ = IrregularlySampledSignal(self.time1quant,
signal=np.arange(10.0, 30.0, 2.0),
units="mV",
name='spam', description='eggs',
file_origin='testfile.txt',
arg1='test')
assert_neo_object_is_compliant(targ)
assert_array_equal(result, targ)
assert_array_equal(self.time1quant, targ.times)
assert_array_equal(result.times, targ.times)
assert_same_sub_schema(result, targ)
示例2: test__add_two_consistent_signals_should_preserve_data_complement
def test__add_two_consistent_signals_should_preserve_data_complement(self):
data2 = np.arange(10.0, 20.0)
data2quant = data2 * pq.mV
signal2 = AnalogSignal(data2quant, sampling_rate=1 * pq.kHz)
assert_neo_object_is_compliant(signal2)
result = self.signal1 + signal2
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"})
targ = AnalogSignal(
np.arange(10.0, 30.0, 2.0),
units="mV",
sampling_rate=1 * pq.kHz,
name="spam",
description="eggs",
file_origin="testfile.txt",
arg1="test",
)
assert_neo_object_is_compliant(targ)
assert_arrays_equal(result, targ)
assert_same_sub_schema(result, targ)
示例3: test__filter_single_annotation_nodata_container
def test__filter_single_annotation_nodata_container(self):
targ = [self.segs1[1], self.chxs1[1],
self.units1[1],
self.units1[3]]
res0 = self.targobj.filter(j=1,
data=False, container=True)
assert_same_sub_schema(res0, targ)
示例4: test__time_slice__offset
def test__time_slice__offset(self):
self.signal2.t_start = 10.0 * pq.s
assert_neo_object_is_compliant(self.signal2)
t_start = 12 * pq.s
t_stop = 14 * pq.s
result = self.signal2.time_slice(t_start, t_stop)
self.assertIsInstance(result, AnalogSignalArray)
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'})
targ = AnalogSignalArray(np.array([[2, 3], [2, 3]]).T,
t_start=12.0*pq.ms,
sampling_rate=1.0*pq.Hz, units='mV',
name='spam', description='eggs',
file_origin='testfile.txt', arg1='test')
assert_neo_object_is_compliant(result)
self.assertEqual(self.signal2.t_start, 10.0 * pq.s)
self.assertEqual(result.t_stop, t_stop)
self.assertEqual(result.t_start, t_start)
self.assertEqual(result.sampling_rate, targ.sampling_rate)
assert_arrays_equal(result, targ)
assert_same_sub_schema(result, targ)
示例5: test__time_slice__different_units
def test__time_slice__different_units(self):
self.signal2.t_start = 10.0 * pq.ms
assert_neo_object_is_compliant(self.signal2)
t_start = 2 * pq.s + 10.0 * pq.ms
t_stop = 4 * pq.s + 10.0 * pq.ms
result = self.signal2.time_slice(t_start, t_stop)
self.assertIsInstance(result, AnalogSignalArray)
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'})
targ = AnalogSignalArray(np.array([[2, 3], [2, 3]]).T,
t_start=t_start.rescale(pq.ms),
sampling_rate=1.0*pq.Hz, units='mV',
name='spam', description='eggs',
file_origin='testfile.txt', arg1='test')
assert_neo_object_is_compliant(result)
assert_neo_object_is_compliant(self.signal2)
self.assertEqual(self.signal2.t_start, 10.0 * pq.ms)
self.assertAlmostEqual(result.t_stop, t_stop, delta=1e-12*pq.ms)
self.assertAlmostEqual(result.t_start, t_start, delta=1e-12*pq.ms)
assert_arrays_almost_equal(result.times, targ.times, 1e-12*pq.ms)
self.assertEqual(result.sampling_rate, targ.sampling_rate)
assert_arrays_equal(result, targ)
assert_same_sub_schema(result, targ)
示例6: test__filter_single_annotation_container
def test__filter_single_annotation_container(self):
targ = [self.sigarrs1[1], self.irrsig1[1],
self.trains1[1], self.trains1[3],
self.units1[1]]
res0 = self.targobj.filter(j=1, container=True)
assert_same_sub_schema(res0, targ)
示例7: test_segment_take_analogsignal_by_unit
def test_segment_take_analogsignal_by_unit(self):
result1 = self.seg1.take_analogsignal_by_unit()
result21 = self.seg1.take_analogsignal_by_unit([self.unit1])
result22 = self.seg1.take_analogsignal_by_unit([self.unit2])
self.assertEqual(result1, [])
assert_same_sub_schema(result21, [self.sigs1a[0]])
assert_same_sub_schema(result22, [self.sigs1a[1]])
示例8: test_segment_take_spiketrains_by_unit
def test_segment_take_spiketrains_by_unit(self):
result1 = self.seg1.take_spiketrains_by_unit()
result21 = self.seg1.take_spiketrains_by_unit([self.unit1])
result22 = self.seg1.take_spiketrains_by_unit([self.unit2])
self.assertEqual(result1, [])
assert_same_sub_schema(result21, [self.trains1a[0]])
assert_same_sub_schema(result22, [self.trains1a[1]])
示例9: test__merge
def test__merge(self):
unit1a = fake_neo(Unit, seed=self.seed1, n=self.nchildren)
assert_same_sub_schema(self.unit1, unit1a)
unit1a.annotate(seed=self.seed2)
unit1a.spiketrains.append(self.trains2[0])
unit1a.merge(self.unit2)
self.check_creation(self.unit2)
assert_same_sub_schema(self.trains1a + self.trains2,
unit1a.spiketrains)
示例10: test_segment_take_analogsignal_by_channelindex
def test_segment_take_analogsignal_by_channelindex(self):
ind1 = self.unit1.channel_indexes[0]
ind2 = self.unit2.channel_indexes[0]
result1 = self.seg1.take_analogsignal_by_channelindex()
result21 = self.seg1.take_analogsignal_by_channelindex([ind1])
result22 = self.seg1.take_analogsignal_by_channelindex([ind2])
self.assertEqual(result1, [])
assert_same_sub_schema(result21, [self.sigs1a[0]])
assert_same_sub_schema(result22, [self.sigs1a[1]])
示例11: test__filter_single_annotation_container
def test__filter_single_annotation_container(self):
targ = ([self.epcs1[1], self.evts1[1]] +
self.sigarrs1[1::2] +
[self.epcs1[3], self.evts1[3]] +
self.irsigs1[1::2] +
self.trains1[1::2] +
[self.segs1[1], self.chxs1[1],
self.units1[1],
self.units1[3]])
res0 = self.targobj.filter(j=1, container=True)
assert_same_sub_schema(res0, targ)
示例12: test_reading_same
def test_reading_same(self):
for ioobj, path in self.iter_io_objects(return_path=True):
obj_reader_base = create_generic_reader(ioobj, target=False)
obj_reader_single = create_generic_reader(ioobj)
obj_base = obj_reader_base()
obj_single = obj_reader_single()
try:
assert_same_sub_schema(obj_base, obj_single)
except BaseException as exc:
exc.args += ("from " + os.path.basename(path),)
raise
示例13: test_against_reference
def test_against_reference(self):
for obj, path in self.iter_objects(return_path=True):
filename = os.path.basename(path)
refpath = os.path.splitext(path)[0] + self.suffix
refobj = proc_f32(refpath)
try:
assert_neo_object_is_compliant(obj)
assert_neo_object_is_compliant(refobj)
assert_same_sub_schema(obj, refobj)
except BaseException as exc:
exc.args += ("from " + filename,)
raise
示例14: test__filter_annotation_single
def test__filter_annotation_single(self):
targ = [self.trains1a[1]]
res0 = self.targobj.filter(j=1)
res1 = self.targobj.filter({'j': 1})
res2 = self.targobj.filter(targdict={'j': 1})
res3 = self.targobj.filter([{'j': 1}])
res4 = self.targobj.filter(targdict=[{'j': 1}])
assert_same_sub_schema(res0, targ)
assert_same_sub_schema(res1, targ)
assert_same_sub_schema(res2, targ)
assert_same_sub_schema(res3, targ)
assert_same_sub_schema(res4, targ)
示例15: test_seg_take_slice_of_analogsignalarray_by_unit
def test_seg_take_slice_of_analogsignalarray_by_unit(self):
seg = self.seg1
result1 = seg.take_slice_of_analogsignalarray_by_unit()
result21 = seg.take_slice_of_analogsignalarray_by_unit([self.unit1])
result23 = seg.take_slice_of_analogsignalarray_by_unit([self.unit3])
self.assertEqual(result1, [])
targ1 = [self.sigarrs1a[0][:, np.array([True])],
self.sigarrs1a[1][:, np.array([False])]]
targ3 = [self.sigarrs1a[0][:, np.array([False])],
self.sigarrs1a[1][:, np.array([True])]]
assert_same_sub_schema(result21, targ1)
assert_same_sub_schema(result23, targ3)