class BaseProxy(BaseNeo): def __init__(self, array_annotations=None, **annotations): # this for py27 str vs py3 str in neo attributes ompatibility annotations = check_annotations(annotations) if 'file_origin' not in annotations: # the str is to make compatible with neo_py27 where attribute # used to be str so raw bytes annotations['file_origin'] = str(self._rawio.source_name()) if array_annotations is None: array_annotations = {} for k, v in array_annotations.items(): array_annotations[k] = np.asarray(v) # clean array annotations that are not 1D # TODO remove this once multi-dimensional array_annotations are possible array_annotations = {k: v for k, v in array_annotations.items() if v.ndim == 1} # this mock the array annotations to avoid inherits DataObject self.array_annotations = ArrayDict(self.shape[-1]) self.array_annotations.update(array_annotations) BaseNeo.__init__(self, **annotations) def load(self, time_slice=None, **kwargs): # should be implemented by subclass raise NotImplementedError def time_slice(self, t_start, t_stop): ''' Load the proxy object within the specified time range. Has the same call signature as AnalogSignal.time_slice, Epoch.time_slice, etc. ''' return self.load(time_slice=(t_start, t_stop))
class BaseProxy(BaseNeo): def __init__(self, array_annotations=None, **annotations): # this for py27 str vs py3 str in neo attributes compatibility annotations = check_annotations(annotations) if 'file_origin' not in annotations: # the str is to make compatible with neo_py27 where attribute # used to be str so raw bytes annotations['file_origin'] = str(self._rawio.source_name()) # this mock the array annotaions to avoid inherits DataObject self.array_annotations = ArrayDict(self.shape[-1]) if array_annotations is not None: self.array_annotations.update(array_annotations) BaseNeo.__init__(self, **annotations) def load(self, time_slice=None, **kwargs): # should be implemented by subclass raise NotImplementedError def time_slice(self, t_start, t_stop): ''' Load the proxy object within the specified time range. Has the same call signature as AnalogSignal.time_slice, Epoch.time_slice, etc. ''' return self.load(time_slice=(t_start, t_stop))
class BaseProxy(BaseNeo): def __init__(self, array_annotations=None, **annotations): # this for py27 str vs py3 str in neo attributes ompatibility annotations = check_annotations(annotations) if 'file_origin' not in annotations: # the str is to make compatible with neo_py27 where attribute # used to be str so raw bytes annotations['file_origin'] = str(self._rawio.source_name()) # this mock the array annotaions to avoid inherits DataObject self.array_annotations = ArrayDict(self.shape[-1]) if array_annotations is not None: self.array_annotations.update(array_annotations) BaseNeo.__init__(self, **annotations)
class BaseProxy(BaseNeo): def __init__(self, array_annotations=None, **annotations): # this for py27 str vs py3 str in neo attributes ompatibility annotations = check_annotations(annotations) if 'file_origin' not in annotations: # the str is to make compatible with neo_py27 where attribute # used to be str so raw bytes annotations['file_origin'] = str(self._rawio.source_name()) # this mock the array annotaions to avoid inherits DataObject self.array_annotations = ArrayDict(self.shape[-1]) if array_annotations is not None: self.array_annotations.update(array_annotations) BaseNeo.__init__(self, **annotations)