Beispiel #1
0
    # get sync file
        syncloc = os.path.join(datadir, testsubj, testcase,
                               testcase + '.bpr.sync.txt')
        if not os.path.isfile(syncloc):
            continue
        try:
            utt_frametimes = audo.get_datadf_2der(bpr, au, syncloc, maxhz=270)
        except IndexError:
            continue
        except struct.error as err:
            print(err)
            continue
        windowlen = 0.075
        utt_frametimes = audo.syncmatch(utt_frametimes,
                                        windowlen=windowlen,
                                        offset=0)
        utt_frametimes = audo.get_corr_pos(utt_frametimes, tg)
        # get r and p for acceleration
        rs = []
        ps = []
        acc_df = None
        acc_df = utt_frametimes[np.isfinite(utt_frametimes['us_acc'])]
        #    print(acc_df.head())`
        starttimes = [
            t for t in acc_df['time'] if t + windowlen < np.max(acc_df['time'])
        ]
        for starttime in starttimes:
            subdf = acc_df[(acc_df['time'] >= starttime - windowlen / 2)
                           & (acc_df['time'] <= starttime + windowlen / 2)]
            sts = stats.linregress(x=subdf['us_acc'], y=subdf['au_acc'])
Beispiel #2
0
                                                  au,
                                                  syncloc,
                                                  maxhz=270)
     #print(utt_frametimes_base.head())
 except IndexError:
     continue
 except struct.error as err:
     print(err)
     continue
 windowlens = [.150, .175, .200, .225]
 for win in windowlens:
     print(win)
     offsets = [0, 0.05, 0.1, 0.15]
     for ofs in offsets:
         utt_frametimes = audo.syncmatch(utt_frametimes_base,
                                         windowlen=win,
                                         offset=ofs)
         utt_frametimes = audo.get_corr_pos(utt_frametimes, tg)
         nutts = len(utt_frametimes.index)
         windowlength = [win] * nutts
         subject = [testsubj] * nutts
         offset = [ofs] * nutts
         utt_frametimes = pd.concat([
             utt_frametimes,
             pd.DataFrame({'windowlength': windowlength})
         ],
                                    ignore_index=False,
                                    axis=1)
         utt_frametimes = pd.concat(
             [utt_frametimes,
              pd.DataFrame({'subject': subject})],