当前位置: 首页>>代码示例>>Python>>正文


Python Options.plot_one_pdf方法代码示例

本文整理汇总了Python中options.Options.plot_one_pdf方法的典型用法代码示例。如果您正苦于以下问题:Python Options.plot_one_pdf方法的具体用法?Python Options.plot_one_pdf怎么用?Python Options.plot_one_pdf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在options.Options的用法示例。


在下文中一共展示了Options.plot_one_pdf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: event_classes

# 需要导入模块: from options import Options [as 别名]
# 或者: from options.Options import plot_one_pdf [as 别名]
def event_classes(DIC,save=False):

  """
  - for each event, looks for the class it belongs to for each training set ; 
  if the event is not classified, class label is set to 99 by default.
  - it the labels are different from a set to another, then displays the 
  waveform and ask the user to assign a class manually.
  - if save=True: saves the new classification in a new file.
  """

  from options import Options
  opt = Options()
  all = np.array(map(str,list(opt.raw_df[opt.raw_df.columns[0]])))
  types = np.unique(opt.raw_df.Type).values
  df = opt.raw_df
  df.index = all

  manuals = opt.manuals
  manuals.index = map(str,list(manuals[manuals.columns[0]]))

  new_class = []

  all_classes = []
  for event in all:
    l = []
    for iter in sorted(DIC):
      if iter != 'features':
        marker = 0
        for it,t in enumerate(types):
          if event in DIC[iter][t]['index_ok']:
            l.append(it)
            marker = 1
            continue
          for tup in DIC[iter][t]['i_other']:
             if event in tup[1]:
               itype = np.where(types==t)[0][0]
               l.append(itype)
               marker = 1
        if marker == 0:
          l.append(99)

    print event, l
    cl = np.unique(np.array(l))
    date_ok = event[:8]+'_'+event[8:]
    mant = manuals.reindex(index=[event],columns=['Type']).values[0][0]
    m = 0
    if len(cl) == 1 and cl[0] != 99 and types[cl[0]] != mant:
      m = 1
    if len(cl) > 1 or m==1:
      if 99 not in cl:
        print "\t", mant, types[cl]
      else:
        print "\t", mant, types[cl[:-1]], 'unclassified'
        m = 2
      if m == 2 and len(types[cl[:-1]])== 1:
        final_cl = types[cl[:-1]][0]
      elif len(cl) == 1: # if the automatic classification is systematically the same whatever training set is used, BUT different from the manual classification, then...
        final_cl = types[cl][0]
      #else:
        file = glob.glob('/home/nadege/Desktop/IJEN_GOOD/DATA/*%s*.SAC'%date_ok)[0]
        a = df.reindex(index=[event])
        st = read(file)
        st[0].plot()
        for feat in opt.opdict['feat_list']:
          if feat != 'NbPeaks':
            opt.plot_one_pdf(feat,[(mant,a[feat].values,final_cl)])
        if save:
          final_cl = str(raw_input("\t Quelle classe ? "))
        print "\n"
    else:
      if l[0] != 99:
        final_cl = types[l[0]]
      else:
        final_cl = 'Unclass'
    new_class.append(final_cl)
  if save:
    df_new = manuals.reindex(columns=['Filename','Type'])
    df_new['NewType'] = new_class
    df_new.to_csv('../lib/Ijen/svm_reclass.csv')
开发者ID:amaggi,项目名称:discrimination,代码行数:81,代码来源:extraction.py


注:本文中的options.Options.plot_one_pdf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。