本文整理汇总了Python中neo.core.analogsignal.AnalogSignal.t_start方法的典型用法代码示例。如果您正苦于以下问题:Python AnalogSignal.t_start方法的具体用法?Python AnalogSignal.t_start怎么用?Python AnalogSignal.t_start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neo.core.analogsignal.AnalogSignal
的用法示例。
在下文中一共展示了AnalogSignal.t_start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __getitem__
# 需要导入模块: from neo.core.analogsignal import AnalogSignal [as 别名]
# 或者: from neo.core.analogsignal.AnalogSignal import t_start [as 别名]
def __getitem__(self, i):
'''
Get the item or slice :attr:`i`.
'''
obj = super(BaseAnalogSignal, self).__getitem__(i)
if isinstance(i, int):
return obj
elif isinstance(i, tuple):
j, k = i
if isinstance(k, int):
if isinstance(j, slice): # extract an AnalogSignal
obj = AnalogSignal(obj, sampling_rate=self.sampling_rate)
if j.start:
obj.t_start = (self.t_start +
j.start * self.sampling_period)
# return a Quantity (for some reason quantities does not
# return a Quantity in this case)
elif isinstance(j, int):
obj = pq.Quantity(obj, units=self.units)
return obj
elif isinstance(j, int): # extract a quantity array
# should be a better way to do this
obj = pq.Quantity(np.array(obj), units=obj.units)
return obj
else:
return obj
elif isinstance(i, slice):
if i.start:
obj.t_start = self.t_start + i.start * self.sampling_period
return obj
else:
raise IndexError("index should be an integer, tuple or slice")