本文整理匯總了Python中pycbc.types.array.Array.__getitem__方法的典型用法代碼示例。如果您正苦於以下問題:Python Array.__getitem__方法的具體用法?Python Array.__getitem__怎麽用?Python Array.__getitem__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pycbc.types.array.Array
的用法示例。
在下文中一共展示了Array.__getitem__方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __getitem__
# 需要導入模塊: from pycbc.types.array import Array [as 別名]
# 或者: from pycbc.types.array.Array import __getitem__ [as 別名]
def __getitem__(self, index):
if isinstance(index, slice):
# Set the new epoch---note that index.start may also be None
if self._epoch is None:
new_epoch = None
elif index.start is None:
new_epoch = self._epoch
else:
if index.start < 0:
raise ValueError('Negative start index not supported')
new_epoch = self._epoch + index.start * self._delta_t
return TimeSeries(Array.__getitem__(self, index), self._delta_t, new_epoch, copy=False)
else:
return Array.__getitem__(self, index)
示例2: __getitem__
# 需要導入模塊: from pycbc.types.array import Array [as 別名]
# 或者: from pycbc.types.array.Array import __getitem__ [as 別名]
def __getitem__(self, index):
if isinstance(index, slice):
# Set the new epoch---note that index.start may also be None
if self._epoch is None:
new_epoch = None
elif index.start is None:
new_epoch = self._epoch
else:
if index.start < 0:
index.start += len(self)
new_epoch = self._epoch + index.start * self._delta_t
return TimeSeries(Array.__getitem__(self, index), self._delta_t, new_epoch, copy=False)
else:
return Array.__getitem__(self, index)