In [5]:
import sys
from explauto.utils import rand_bounds
sys.path.append('../')

from play.environment.arm_diva_env import PlayEnvironment
%matplotlib inline
import matplotlib.pyplot as plt

env = PlayEnvironment(tau=0.5)


human sounds ['oie', 'oeu', 'eiy', 'eiu', 'uyo', 'uiy', 'uio', 'eyi', 'euy', 'eui', 'oyi', 'eio', 'iou', 'oiu', 'iyu', 'oyu', 'uoe', 'yue', 'yoe', 'iuo', 'oei', 'yeo', 'ioe', 'ouy', 'yio', 'uey', 'uye', 'yuo', 'uyi', 'oiy', 'ieu', 'eyu', 'ieo', 'iue', 'yie', 'yui', 'eou', 'iyo', 'iuy', 'uie', 'yiu', 'uoi', 'yoi', 'yeu', 'oui', 'eyo', 'euo', 'oey', 'iye', 'oue', 'eoy', 'yei', 'oye', 'ioy', 'iey', 'you', 'eoi', 'uei', 'ueo', 'uoy']

In [77]:
# Vocal BFS
bfs_shapes = env.diva.dmp.dmp.gen_psi(env.diva.dmp.dmp.cs.rollout())

plt.plot([list(reversed(l)) for l in bfs_shapes], lw=3)

plt.rc('text', usetex=True)
plt.rc('font', family='serif')

plt.legend(["basis function 1", "basis function 2"], fontsize=16)
plt.xlabel("Timesteps", fontsize=16)
plt.ylabel("Power", fontsize=16)

plt.xticks(fontsize = 16)
plt.yticks(fontsize = 16)


Out[77]:
(array([-0.2,  0. ,  0.2,  0.4,  0.6,  0.8,  1. ,  1.2]),
 <a list of 8 Text yticklabel objects>)

In [88]:
# Arm BFS
bfs_shapes = env.arm.motor_dmp.dmp.gen_psi(env.arm.motor_dmp.dmp.cs.rollout())
plt.plot([list(reversed(l)) for l in bfs_shapes], lw=3)

plt.rc('text', usetex=True)
plt.rc('font', family='serif')

frame = plt.legend(["bf1", "bf2", "bf3", "bf4", 
            "bf5", "bf6"], ncol=2, fontsize=14, loc="upper right")

plt.xlabel("Timesteps", fontsize=16)
plt.ylabel("Power", fontsize=16)

plt.xticks(fontsize = 16)
plt.yticks(fontsize = 16)


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-88-749c0365acc3> in <module>()
      8 frame = plt.legend(["bf1", "bf2", "bf3", "bf4", 
      9             "bf5", "bf6"], ncol=2, fontsize=14, loc="upper right")
---> 10 frame.set_facecolor('green')
     11 plt.xlabel("Timesteps", fontsize=16)
     12 plt.ylabel("Power", fontsize=16)

AttributeError: 'Legend' object has no attribute 'set_facecolor'

In [68]:
# Vocal DMP
for i in range(1):
    m = env.motor_babbling(audio=True)
    plt.plot(env.diva.trajectory(m[21:]), lw=3)
    
plt.legend(["art1", "art2", "art3", "art4", "art5", "art6", "art7"], ncol=2)
plt.ylim([-1., 1.])

plt.rc('text', usetex=True)
plt.rc('font', family='serif')

plt.xlabel("Timesteps", fontsize=16)
plt.ylabel("Articulator position", fontsize=16)

plt.xticks(fontsize = 16)
plt.yticks(fontsize = 16)


Out[68]:
(array([-1.  , -0.75, -0.5 , -0.25,  0.  ,  0.25,  0.5 ,  0.75,  1.  ]),
 <a list of 9 Text yticklabel objects>)

In [58]:
# Arm DMP
for i in range(1):
    m = env.motor_babbling(arm=True)
    plt.plot(env.arm.compute_traj(m[:21]), lw=3)
    
plt.legend(["joint1", "joint2", "joint3"], ncol=3)
plt.ylim([-1., 1.])


Out[58]:
(-1.0, 1.0)

In [ ]: