Ejemplo n.º 1
0
def bokeh_kin(kin_env, m_signal, color='#DF4949', alpha=1.0, **kwargs):

    m_vector = tools.to_vector(m_signal, kin_env.m_channels)
    s_signal = kin_env._multiarm.forward_kin(m_vector)

    xs, ys = [0.0], [0.0]
    for i in range(kin_env.cfg.dim):
        xs.append(s_signal['x{}'.format(i + 1)])
        ys.append(s_signal['y{}'.format(i + 1)])
    xs, ys = ys, xs  # we swap x and y for a more symmetrical look

    if isinstance(kin_env.cfg.lengths, numbers.Real):
        total_length = kin_env.cfg.lengths * kin_env.cfg.dim
    else:
        total_length = sum(kin_env.cfg.lengths)
    total_length += 0.0

    kwargs = {
        'plot_height': int(350 * 1.60),
        'plot_width': int(350 * 1.60),
        'x_range': [-1.0, 1.0],
        'y_range': [-1.0, 1.0],
        'line_color': color,
        'line_alpha': alpha,
        'fill_color': color,
        'fill_alpha': alpha,
        'title': ''
    }

    plotting.hold()
    plotting.line(xs, ys, **kwargs)
    plotting.grid().grid_line_color = None
    plotting.xaxis().major_tick_in = 0
    plotting.ygrid().grid_line_color = None
    plotting.yaxis().major_tick_in = 0

    plotting.circle(xs[:1], ys[:1], radius=0.015, **kwargs)
    plotting.circle(xs[1:-1], ys[1:-1], radius=0.008, **kwargs)
    plotting.circle(xs[-1:], ys[-1:], radius=0.01, color='red')
    plotting.hold(False)
Ejemplo n.º 2
0
def bokeh_kin(kin_env, m_signal, color='#DF4949', alpha=1.0, **kwargs):

    m_vector = tools.to_vector(m_signal, kin_env.m_channels)
    s_signal = kin_env._multiarm.forward_kin(m_vector)

    xs, ys = [0.0], [0.0]
    for i in range(kin_env.cfg.dim):
        xs.append(s_signal['x{}'.format(i+1)])
        ys.append(s_signal['y{}'.format(i+1)])
    xs, ys = ys, xs # we swap x and y for a more symmetrical look

    if isinstance(kin_env.cfg.lengths, numbers.Real):
        total_length = kin_env.cfg.lengths*kin_env.cfg.dim
    else:
        total_length = sum(kin_env.cfg.lengths)
    total_length += 0.0

    kwargs ={'plot_height' : int(350*1.60),
             'plot_width'  : int(350*1.60),
             'x_range'     : [-1.0, 1.0],
             'y_range'     : [-1.0, 1.0],
             'line_color'  : color,
             'line_alpha'  : alpha,
             'fill_color'  : color,
             'fill_alpha'  : alpha,
             'title':''
            }

    plotting.hold()
    plotting.line(xs, ys, **kwargs)
    plotting.grid().grid_line_color = None
    plotting.xaxis().major_tick_in   = 0
    plotting.ygrid().grid_line_color = None
    plotting.yaxis().major_tick_in   = 0

    plotting.circle(xs[  : 1], ys[  : 1], radius=0.015, **kwargs)
    plotting.circle(xs[ 1:-1], ys[ 1:-1], radius=0.008, **kwargs)
    plotting.circle(xs[-1:  ], ys[-1:  ], radius=0.01, color='red')
    plotting.hold(False)
Ejemplo n.º 3
0
    def _execute(self, m_signal, meta=None):
        m_vector = tools.to_vector(m_signal, self.m_channels)
        s_vector = (m_vector[0] + m_vector[1], m_vector[0] * m_vector[1])

        return tools.to_signal(s_vector, self.s_channels)
Ejemplo n.º 4
0
    def _execute(self, m_signal, meta=None):
        m_vector = tools.to_vector(m_signal, self.m_channels)
        s_vector = (m_vector[0] + m_vector[1], m_vector[0]*m_vector[1])

        return tools.to_signal(s_vector, self.s_channels)