def __getitem__(self, *idx):
"""TuningCurve1D index access.
Accepts integers, slices, and lists"""
idx = [ii for ii in idx]
if len(idx) == 1 and not isinstance(idx[0], int):
idx = idx[0]
if isinstance(idx, tuple):
idx = [ii for ii in idx]
if self.isempty:
return self
try:
out = copy.copy(self)
out._ratemap = self.ratemap[idx,:]
out._unit_ids = (np.asanyarray(out._unit_ids)[idx]).tolist()
out._unit_labels = (np.asanyarray(out._unit_labels)[idx]).tolist()
return out
except Exception:
raise TypeError(
'unsupported subsctipting type {}'.format(type(idx)))
评论列表
文章目录