def transform_streamels(self, streamels): check_streamels_1D(streamels) check_streamels_continuous(streamels) check_streamels_range(streamels, 0, 1) n = streamels.size streamels2 = np.zeros(n + 2, streamel_dtype) streamels2['kind'][:] = ValueFormats.Continuous streamels2['lower'][:n] = 0 streamels2['upper'][:n] = +1 # this is the mean streamels2['lower'][n] = np.mean(streamels['lower']) streamels2['upper'][n] = np.mean(streamels['upper']) # this is the spread of the data streamels2['lower'][n + 1] = 0 # XXX: we should find a different bounded streamels2['upper'][n + 1] = (np.max(streamels['upper']) - np.min(streamels['lower'])) # Save this so we can enforce it later self.lower = streamels2['lower'].copy() self.upper = streamels2['upper'].copy() streamels2['default'] = self.transform_value(streamels['default']) return streamels2
def transform_streamels(self, streamels): check_streamels_1D(streamels) check_streamels_continuous(streamels) if self.A0 is not None: check_streamels_1D_size(streamels, self.A0.shape[1]) self.A = self._get_A(streamels) if self.A.shape[1] != streamels.size: msg = ('I expect a matrix with rows %d, got %s' % (streamels.size, self.A.shape)) raise ValueError(msg) # Save original constraints that we can pass to inverse() self.old_streamels = streamels.copy() streamels2 = np.zeros(self.A.shape[0], streamel_dtype) streamels2['kind'][:] = ValueFormats.Continuous find_polytope_bounds_after_linear(streamels, self.A, streamels2) self.lower = streamels2['lower'].copy() self.upper = streamels2['upper'].copy() streamels2['default'] = self.transform_value(streamels['default']) return streamels2
def transform_streamels(self, streamels): # Check that it is a 2D float image check_streamels_2D(streamels) check_streamels_continuous(streamels) self.shape_from = streamels.shape self.vmin = np.min(streamels['lower']) self.vmax = np.max(streamels['upper']) return make_streamels_2D_float(self.shape_to, lower=self.vmin, upper=self.vmax)
def transform_streamels(self, streamels): check_streamels_2D(streamels) check_streamels_continuous(streamels) check_streamels_range(streamels, 0, 1) N, _ = streamels.shape shape2 = N, streamels2 = np.empty(shape=shape2, dtype=streamel_dtype) streamels2['kind'].flat[:] = ValueFormats.Continuous streamels2['lower'].flat[:] = 0 streamels2['upper'].flat[:] = 1 streamels2['default'] = self.transform_value(streamels['default']) return streamels2
def transform_streamels(self, streamels): check_streamels_continuous(streamels) # Save these so we can use them later self.lower = streamels['lower'].copy() self.upper = streamels['upper'].copy() streamels2 = np.empty_like(streamels) streamels2['kind'] = ValueFormats.Discrete streamels2['lower'] = 0 streamels2['upper'] = self.levels - 1 streamels2['default'] = self.transform_value(streamels['default']) return streamels2
def transform_streamels(self, streamels): check_streamels_1D(streamels) check_streamels_continuous(streamels) check_streamels_range(streamels, 0.0, 1.0) M = streamels.size n = M - 2 streamels2 = np.zeros(n, streamel_dtype) streamels2['kind'][:] = ValueFormats.Continuous streamels2['lower'][:] = 0 streamels2['upper'][:] = +1 streamels2['default'] = self.transform_value(streamels['default']) return streamels2
def transform_streamels(self, streamels): # check_streamels_1D(streamels) check_streamels_continuous(streamels) streamels2 = np.zeros(streamels.shape, streamel_dtype) streamels2["kind"][:] = ValueFormats.Continuous streamels2["lower"][:] = self.ymin streamels2["upper"][:] = self.ymax # Save this so we can enforce it later self.lower = streamels2["lower"].copy() self.upper = streamels2["upper"].copy() streamels2["default"] = self.transform_value(streamels["default"]) return streamels2
def transform_streamels(self, streamels): check_streamels_1D(streamels) check_streamels_continuous(streamels) if not np.all(streamels['lower'] == 0): raise UnsupportedSpec("I only accept signals with lower=0.") if not np.all(streamels['upper'] == 1): raise UnsupportedSpec("I only accept signals with upper=1.") # TODO: check all floats and in 0--1 shape2 = streamels.shape[0], self.resolution streamels2 = np.empty(shape=shape2, dtype=streamel_dtype) streamels2['kind'].flat[:] = ValueFormats.Continuous streamels2['lower'].flat[:] = 0 streamels2['upper'].flat[:] = 1 streamels2['default'] = popcode(streamels['default'], self.resolution) return streamels2
def transform_streamels(self, streamels): check_streamels_continuous(streamels) self.streamels = streamels.copy() return self.streamels