本文整理匯總了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")