예제 #1
0
def plot_soutenance():
  """
  Plot des PDFs des 4 attributs définis par Clément pour le ppt 
  de la soutenance.
  """
  from options import MultiOptions
  opt = MultiOptions()
  opt.opdict['channels'] = ['Z']

  #opt.opdict['feat_train'] = 'clement_train.csv'
  #opt.opdict['feat_test'] = 'clement_test.csv'
  opt.opdict['feat_list'] = ['AsDec','Dur','Ene','KRapp']
  #opt.opdict['feat_log'] = ['AsDec','Dur','Ene','KRapp']
  opt.do_tri()
  opt.x = opt.xs[0]
  opt.y = opt.ys[0]
  opt.compute_pdfs()

  gauss = opt.gaussians

  fig = plt.figure(figsize=(12,2.5))
  fig.set_facecolor('white') 
  for ifeat,feat in enumerate(sorted(gauss)):
    ax = fig.add_subplot(1,4,ifeat+1)
    ax.plot(gauss[feat]['vec'],gauss[feat]['VT'],ls='-',c='b',lw=2.)
    ax.plot(gauss[feat]['vec'],gauss[feat]['EB'],ls='-',c='r',lw=2.)
    ax.set_title(feat)
    ax.xaxis.set_ticks_position('bottom')
    ax.xaxis.set_ticklabels('')
    ax.yaxis.set_ticks_position('left')
    ax.yaxis.set_ticklabels('')
    if ifeat == 0:
      ax.legend(['VT','EB'],loc=1,prop={'size':10})
  plt.savefig('/home/nadege/Dropbox/Soutenance/pdfs.png')
  plt.show()
예제 #2
0
def plot_soutenance():
    """
  Plot des PDFs des 4 attributs définis par Clément pour le ppt 
  de la soutenance.
  """
    from options import MultiOptions
    opt = MultiOptions()
    opt.opdict['channels'] = ['Z']

    #opt.opdict['feat_train'] = 'clement_train.csv'
    #opt.opdict['feat_test'] = 'clement_test.csv'
    opt.opdict['feat_list'] = ['AsDec', 'Dur', 'Ene', 'KRapp']
    #opt.opdict['feat_log'] = ['AsDec','Dur','Ene','KRapp']
    opt.do_tri()
    opt.x = opt.xs[0]
    opt.y = opt.ys[0]
    opt.compute_pdfs()

    gauss = opt.gaussians

    fig = plt.figure(figsize=(12, 2.5))
    fig.set_facecolor('white')
    for ifeat, feat in enumerate(sorted(gauss)):
        ax = fig.add_subplot(1, 4, ifeat + 1)
        ax.plot(gauss[feat]['vec'], gauss[feat]['VT'], ls='-', c='b', lw=2.)
        ax.plot(gauss[feat]['vec'], gauss[feat]['EB'], ls='-', c='r', lw=2.)
        ax.set_title(feat)
        ax.xaxis.set_ticks_position('bottom')
        ax.xaxis.set_ticklabels('')
        ax.yaxis.set_ticks_position('left')
        ax.yaxis.set_ticklabels('')
        if ifeat == 0:
            ax.legend(['VT', 'EB'], loc=1, prop={'size': 10})
    plt.savefig('/home/nadege/Dropbox/Soutenance/pdfs.png')
    plt.show()
예제 #3
0
def compare_clement():
    """
  Comparaison des attributs de Clément avec ceux que j'ai recalculés.
  """

    from options import MultiOptions
    opt = MultiOptions()
    opt.opdict['channels'] = ['Z']

    # Mes calculs
    opt.opdict['feat_list'] = ['Dur', 'AsDec', 'RappMaxMean', 'Kurto', 'KRapp']
    opt.opdict['feat_log'] = ['AsDec', 'RappMaxMean', 'Kurto']
    #opt.opdict['feat_list'] = ['Ene']
    #opt.opdict['feat_log'] = ['Ene']
    opt.do_tri()
    opt.x = opt.xs[0]
    opt.y = opt.ys[0]
    opt.x.columns = opt.opdict['feat_list']
    opt.compute_pdfs()
    my_gauss = opt.gaussians

    if 'Kurto' in opt.opdict['feat_list'] and 'RappMaxMean' in opt.opdict[
            'feat_list']:
        fig = plt.figure()
        fig.set_facecolor('white')
        plt.plot(np.log(opt.x.Kurto), np.log(opt.x.RappMaxMean), 'ko')
        plt.xlabel('Kurto')
        plt.ylabel('RappMaxMean')
        plt.show()

    # Les calculs de Clément
    #opt.opdict['feat_list'] = ['Dur','AsDec','RappMaxMean','Kurto','Ene']
    opt.opdict['feat_log'] = []
    opt.opdict['feat_train'] = 'clement_train.csv'
    opt.opdict['feat_test'] = 'clement_test.csv'
    opt.do_tri()
    opt.x = opt.xs[0]
    opt.y = opt.ys[0]
    opt.compute_pdfs()

    # Trait plein --> Clément
    # Trait tireté --> moi
    opt.plot_superposed_pdfs(my_gauss, save=False)
예제 #4
0
def compare_clement():
  """
  Comparaison des attributs de Clément avec ceux que j'ai recalculés.
  """

  from options import MultiOptions
  opt = MultiOptions()
  opt.opdict['channels'] = ['Z']

  # Mes calculs
  opt.opdict['feat_list'] = ['Dur','AsDec','RappMaxMean','Kurto','KRapp']
  opt.opdict['feat_log'] = ['AsDec','RappMaxMean','Kurto']
  #opt.opdict['feat_list'] = ['Ene']
  #opt.opdict['feat_log'] = ['Ene']
  opt.do_tri()
  opt.x = opt.xs[0]
  opt.y = opt.ys[0]
  opt.x.columns = opt.opdict['feat_list']
  opt.compute_pdfs()
  my_gauss = opt.gaussians

  if 'Kurto' in opt.opdict['feat_list'] and 'RappMaxMean' in opt.opdict['feat_list']:
    fig = plt.figure()
    fig.set_facecolor('white')
    plt.plot(np.log(opt.x.Kurto),np.log(opt.x.RappMaxMean),'ko')
    plt.xlabel('Kurto')
    plt.ylabel('RappMaxMean')
    plt.show()

  # Les calculs de Clément
  #opt.opdict['feat_list'] = ['Dur','AsDec','RappMaxMean','Kurto','Ene']
  opt.opdict['feat_log'] = []
  opt.opdict['feat_train'] = 'clement_train.csv'
  opt.opdict['feat_test'] = 'clement_test.csv'
  opt.do_tri()
  opt.x = opt.xs[0]
  opt.y = opt.ys[0]
  opt.compute_pdfs()

  # Trait plein --> Clément
  # Trait tireté --> moi
  opt.plot_superposed_pdfs(my_gauss,save=False)
예제 #5
0
def compare_lissage():
  """
  Comparaison des kurtosis avec deux lissages différents.
  """

  plot_envelopes()

  from options import MultiOptions
  opt = MultiOptions()
  opt.opdict['channels'] = ['Z']

  # Lissage sur des fenêtres de 0.5 s 
  opt.opdict['feat_list'] = ['Kurto']
  opt.opdict['feat_log'] = ['Kurto']
  opt.do_tri()
  opt.x = opt.xs[0]
  opt.y = opt.ys[0]
  opt.x.columns = opt.opdict['feat_list']
  opt.compute_pdfs()
  gauss_stand = opt.gaussians

  # Lissage sur des fenêtres de 1 s
  opt.opdict['feat_train'] = '0610_Piton_trainset.csv'
  opt.opdict['feat_test'] = '0610_Piton_testset.csv'
  opt.do_tri()
  opt.x = opt.xs[0]
  opt.y = opt.ys[0]
  opt.compute_pdfs()
  gauss_1s = opt.gaussians

  # Lissage sur des fenêtres de 5 s
  opt.opdict['feat_train'] = '1809_Piton_trainset.csv'
  opt.opdict['feat_test'] = '1809_Piton_testset.csv'
  opt.do_tri()
  opt.x = opt.xs[0]
  opt.y = opt.ys[0]
  opt.compute_pdfs()
  gauss_5s = opt.gaussians

  # Lissage sur des fenêtres de 10 s
  opt.opdict['feat_train'] = '0510_Piton_trainset.csv'
  opt.opdict['feat_test'] = '0510_Piton_testset.csv'
  opt.do_tri()
  opt.x = opt.xs[0]
  opt.y = opt.ys[0]
  opt.compute_pdfs()
  gauss_10s = opt.gaussians

  ### PLOT OF SUPERPOSED PDFs ###
  fig = plt.figure(figsize=(12,2.5))
  fig.set_facecolor('white') 
  for feat in sorted(opt.gaussians):
    maxi = int(np.max([gauss_stand[feat]['vec'],gauss_1s[feat]['vec'],gauss_5s[feat]['vec'],gauss_10s[feat]['vec']]))

    ax1 = fig.add_subplot(141)
    ax1.plot(gauss_stand[feat]['vec'],gauss_stand[feat]['VT'],ls='-',c='b',lw=2.,label='VT')
    ax1.plot(gauss_stand[feat]['vec'],gauss_stand[feat]['EB'],ls='-',c='r',lw=2.,label='EB')
    ax1.set_xlim([0,maxi])
    ax1.set_xlabel(feat)
    ax1.set_title('0.5 s')
    ax1.legend(prop={'size':10})

    ax2 = fig.add_subplot(142)
    ax2.plot(gauss_1s[feat]['vec'],gauss_1s[feat]['VT'],ls='-',c='b',lw=2.)
    ax2.plot(gauss_1s[feat]['vec'],gauss_1s[feat]['EB'],ls='-',c='r',lw=2.)
    ax2.set_xlim([0,maxi])
    ax2.set_xlabel(feat)
    ax2.set_title('1 s')
    ax2.set_yticklabels('')

    ax3 = fig.add_subplot(143)
    ax3.plot(gauss_5s[feat]['vec'],gauss_5s[feat]['VT'],ls='-',c='b',lw=2.)
    ax3.plot(gauss_5s[feat]['vec'],gauss_5s[feat]['EB'],ls='-',c='r',lw=2.)
    ax3.set_xlim([0,maxi])
    ax3.set_xlabel(feat)
    ax3.set_title('5 s')
    ax3.set_yticklabels('')

    ax4 = fig.add_subplot(144)
    ax4.plot(gauss_10s[feat]['vec'],gauss_10s[feat]['VT'],ls='-',c='b',lw=2.)
    ax4.plot(gauss_10s[feat]['vec'],gauss_10s[feat]['EB'],ls='-',c='r',lw=2.)
    ax4.set_xlim([0,maxi])
    ax4.set_xlabel(feat)
    ax4.set_title('10 s')
    ax4.set_yticklabels('')

    #plt.savefig('%s/features/comp_%s.png'%(opt.opdict['outdir'],feat))
    plt.show()
예제 #6
0
def compare_lissage():
    """
  Comparaison des kurtosis avec deux lissages différents.
  """

    plot_envelopes()

    from options import MultiOptions
    opt = MultiOptions()
    opt.opdict['channels'] = ['Z']

    # Lissage sur des fenêtres de 0.5 s
    opt.opdict['feat_list'] = ['Kurto']
    opt.opdict['feat_log'] = ['Kurto']
    opt.do_tri()
    opt.x = opt.xs[0]
    opt.y = opt.ys[0]
    opt.x.columns = opt.opdict['feat_list']
    opt.compute_pdfs()
    gauss_stand = opt.gaussians

    # Lissage sur des fenêtres de 1 s
    opt.opdict['feat_train'] = '0610_Piton_trainset.csv'
    opt.opdict['feat_test'] = '0610_Piton_testset.csv'
    opt.do_tri()
    opt.x = opt.xs[0]
    opt.y = opt.ys[0]
    opt.compute_pdfs()
    gauss_1s = opt.gaussians

    # Lissage sur des fenêtres de 5 s
    opt.opdict['feat_train'] = '1809_Piton_trainset.csv'
    opt.opdict['feat_test'] = '1809_Piton_testset.csv'
    opt.do_tri()
    opt.x = opt.xs[0]
    opt.y = opt.ys[0]
    opt.compute_pdfs()
    gauss_5s = opt.gaussians

    # Lissage sur des fenêtres de 10 s
    opt.opdict['feat_train'] = '0510_Piton_trainset.csv'
    opt.opdict['feat_test'] = '0510_Piton_testset.csv'
    opt.do_tri()
    opt.x = opt.xs[0]
    opt.y = opt.ys[0]
    opt.compute_pdfs()
    gauss_10s = opt.gaussians

    ### PLOT OF SUPERPOSED PDFs ###
    fig = plt.figure(figsize=(12, 2.5))
    fig.set_facecolor('white')
    for feat in sorted(opt.gaussians):
        maxi = int(
            np.max([
                gauss_stand[feat]['vec'], gauss_1s[feat]['vec'],
                gauss_5s[feat]['vec'], gauss_10s[feat]['vec']
            ]))

        ax1 = fig.add_subplot(141)
        ax1.plot(gauss_stand[feat]['vec'],
                 gauss_stand[feat]['VT'],
                 ls='-',
                 c='b',
                 lw=2.,
                 label='VT')
        ax1.plot(gauss_stand[feat]['vec'],
                 gauss_stand[feat]['EB'],
                 ls='-',
                 c='r',
                 lw=2.,
                 label='EB')
        ax1.set_xlim([0, maxi])
        ax1.set_xlabel(feat)
        ax1.set_title('0.5 s')
        ax1.legend(prop={'size': 10})

        ax2 = fig.add_subplot(142)
        ax2.plot(gauss_1s[feat]['vec'],
                 gauss_1s[feat]['VT'],
                 ls='-',
                 c='b',
                 lw=2.)
        ax2.plot(gauss_1s[feat]['vec'],
                 gauss_1s[feat]['EB'],
                 ls='-',
                 c='r',
                 lw=2.)
        ax2.set_xlim([0, maxi])
        ax2.set_xlabel(feat)
        ax2.set_title('1 s')
        ax2.set_yticklabels('')

        ax3 = fig.add_subplot(143)
        ax3.plot(gauss_5s[feat]['vec'],
                 gauss_5s[feat]['VT'],
                 ls='-',
                 c='b',
                 lw=2.)
        ax3.plot(gauss_5s[feat]['vec'],
                 gauss_5s[feat]['EB'],
                 ls='-',
                 c='r',
                 lw=2.)
        ax3.set_xlim([0, maxi])
        ax3.set_xlabel(feat)
        ax3.set_title('5 s')
        ax3.set_yticklabels('')

        ax4 = fig.add_subplot(144)
        ax4.plot(gauss_10s[feat]['vec'],
                 gauss_10s[feat]['VT'],
                 ls='-',
                 c='b',
                 lw=2.)
        ax4.plot(gauss_10s[feat]['vec'],
                 gauss_10s[feat]['EB'],
                 ls='-',
                 c='r',
                 lw=2.)
        ax4.set_xlim([0, maxi])
        ax4.set_xlabel(feat)
        ax4.set_title('10 s')
        ax4.set_yticklabels('')

        #plt.savefig('%s/features/comp_%s.png'%(opt.opdict['outdir'],feat))
        plt.show()