def publish(self, pub): diffeo = self.summarize() pub.array_as_image('mle', diffeomorphism_to_rgb(diffeo.d)) pub.array_as_image('angle', diffeo_to_rgb_angle(diffeo.d)) pub.array_as_image('norm', diffeo_to_rgb_norm(diffeo.d, max_value=10)) pub.array_as_image('curv', diffeo_to_rgb_curv(diffeo.d)) pub.array_as_image('variance', diffeo.variance, filter='scale') pub.text('num_samples', self.num_samples) pub.text('statistics', diffeo_text_stats(diffeo.d)) pub.array_as_image('legend', angle_legend((50, 50))) n = 20 M = None for i in range(n): # @UnusedVariable c = self.flattening.random_coords() Mc = self.get_similarity(c) if M is None: M = np.zeros(Mc.shape) M.fill(np.nan) ok = np.isfinite(Mc) Mmax = np.nanmax(Mc) if Mmax < 0: Mc = -Mc Mmax = -Mmax if Mmax > 0: M[ok] = Mc[ok] / Mmax pub.array_as_image('coords', M, filter='scale') if self.last_y0 is not None: y0 = self.last_y0 y1 = self.last_y1 none = np.logical_and(y0 == 0, y1 == 0) x = y0 - y1 x[none] = np.nan pub.array_as_image('motion', x, filter='posneg')
def get_rgb_angle(self): from diffeo2d import diffeo_to_rgb_angle return diffeo_to_rgb_angle(self.get_discretized_diffeo())