+ def _zip_read_1d(self, zipfile, path, info, zip_info, version):
+ expected_shape = (int(zip_info['data']['num-points']),)
+ if zip_info['data']['type'] in ['constant-data', 'raster-data']:
+ return self._zip_calculate_channel(zip_info)
+ with Closing(zipfile.open(
+ zip_info['data']['file']['name'], 'r')) as f:
+ assert zip_info['data']['file']['format'] == 'raw', \
+ 'non-raw data format:\n%s' % pprint.pformat(chan_info)
+ dtype = self._zip_channel_dtype(zip_info)
+ data = numpy.frombuffer(
+ buffer(f.read()),
+ dtype=dtype,)
+ if dtype.kind in ['i', 'u']:
+ data = self._zip_channel_decode(data, zip_info)
+ if data.shape != expected_shape:
+ raise NotImplementedError(
+ 'channel %s has strange shape %s != %s'
+ % (path, data.shape, expected_shape))
+ d = curve.Data(
+ shape=data.shape,
+ dtype=data.dtype,
+ info=zip_info)
+ d[:] = data
+ return d
+