Skip to content
Snippets Groups Projects

moved tests performed in __init__ to load()

Merged David GEISSBUHLER requested to merge fix_init into master
1 file
+ 20
21
Compare changes
  • Side-by-side
  • Inline
+ 20
21
@@ -688,27 +688,6 @@ class StreamView(StreamFilter):
+ "."
)
if not all(self.shape): # true if a dimension in shape is 0: resulting stream has no data.
if not all(self.shape):
raise ValueError(
str(view_indices)
+ " in stream with shape "
+ str(parent.shape)
+ " results in empty stream. (shape "
+ str(self.shape)
+ ")"
)
# If slice operates on more dimension than available.
if self.bulk_view is not None and self.parent.ndim <= len(self.bulk_view):
raise ValueError(
"Got "
+ str(len(self.bulk_view) + 1)
+ " indices for stream with shape "
+ str(self.parent.shape)
+ ". Too many indices !"
)
# shape property
@property
def shape(self):
@@ -774,6 +753,26 @@ class StreamView(StreamFilter):
:obj:`numpy.ndarray`
Data at `index` in the stream.
"""
if not all(self.shape): # true if a dimension in shape is 0: resulting stream has no data.
raise ValueError(
str(view_indices)
+ " in stream with shape "
+ str(parent.shape)
+ " results in empty stream. (shape "
+ str(self.shape)
+ ")"
)
# If slice operates on more dimension than available.
if self.bulk_view is not None and self.parent.ndim <= len(self.bulk_view):
raise ValueError(
"Got "
+ str(len(self.bulk_view) + 1)
+ " indices for stream with shape "
+ str(self.parent.shape)
+ ". Too many indices !"
)
parent_indices = get_index_list(self.frame_view, self.parent.shape[0])
view_indices = get_index_list(index, self.shape[0])
indices = [parent_indices[i] for i in view_indices]
Loading