Example #1
0
if len(TCNs) >= 9:
    TCNgroups = [TCNs[x:x+9] for x in range(0, len(TCNs), 9)]
else:
    TCNgroups = [TCNs]
k = 1

for TCNs in TCNgroups:
    plt.figure('A%d'% k)
    i = 1
    for TCN in TCNs:
        chest = fulldata['Chest'][TCN].rolling(window=30,center=False).mean().shift(-15) 
        pelvis = fulldata['Pelvis'][TCN].rolling(window=30,center=False).mean().shift(-15) 
        [g, c] = lookup_pop([TCN],'')
        
        points = [[[],[]],[[],[]]]
        [t0, tm, st, mp] = gp.get_peak(time, chest)
        points[0][0].extend([t0,tm])
        points[0][1].extend([st,mp])
                
        [t0, tm, st, mp] = gp.get_peak(time, pelvis)
        points[1][0].extend([t0,tm])
        points[1][1].extend([st,mp])
        
        bounds = (0,0.2,math.floor(min(tot.min())),math.ceil(max(tot.max())))
        bounds = (0,0.2,-140,30)
        title = ', '.join(map(str, g.loc[0].tolist()[0:5]))
        title = '\n'.join(wrap(title, 31))

        plt.rcParams["axes.titlesize"] = 8
        ylabel = 'Acceleration (X-direction) [g]'
        
Example #2
0
tcnlist = list(table.index)

chlist = ['14CHST0000Y7ACXC', '14ILACLELOY7FOXB', '14ILACLEUPY7FOXB', '14ILACRILOY7FOXB', '14ILACRIUPY7FOXB', '14LUSP0000Y7FOXA', '14LUSP0000Y7FOZA', '14PELV0000Y7ACXA']
names = ['Chest', 'Iliac Lower Left', 'Iliac Upper Left', 'Iliac Lower Right', 'Iliac Upper Right', 'Lumbar X', 'Lumbar Z', 'Pelvis']
chname = dict(zip(chlist,names))

peakdata = {}
peaktable = pd.DataFrame()
for channel in fulldata:
    peakdata[channel] = pd.DataFrame(columns = [chname[channel]])
    for tcn in fulldata[channel].columns.intersection(tcnlist):
        if channel in ['14ILACRIUPY7FOXB','14ILACRILOY7FOXB','14ILACLEUPY7FOXB','14ILACLELOY7FOXB']:
            lim = 'max'
        else:
            lim = 'min'
        peakdata[channel].loc[tcn] = gp.get_peak(time, fulldata[channel][tcn], lim=lim).peak
    peaktable = pd.concat([peaktable, peakdata[channel]], axis=1)

t = pd.merge(temp, peaktable, how='outer', left_index=True, right_index=True)
t = t.rename(columns = {'LBS Bottom':'LBS'})
t = t[t['Type_Mannequin'] == 'HIII Enfant'].drop(['Location','Date_essai','Type_Mannequin','Seat','UAS'], axis=1)
#t = t.reset_index()

t.loc[(t.Position == 14) & (t.ModeleAuto == 'PRIUS'), 'Class'] = 'Lap'
t.loc[(t.Position == 16) & (t.ModeleAuto == 'PRIUS'), 'Class'] = 'Pelvis'
t.loc[(t.Position == 14) & (t.ModeleAuto != 'PRIUS'), 'Class'] = 'Pelvis'
t.loc[(t.Position == 16) & (t.ModeleAuto != 'PRIUS'), 'Class'] = 'Lap'

t = t.sort_values(['LBS'])
#t.to_excel('P:/BOOSTER/Plots/FullSampleData.xlsx')
t['Toward'] = -(t.loc[:,'Pelvis'] - t.loc[:,'Chest'])
Example #3
0
    by_label = OrderedDict(zip(linelabels, lines))
    plt.legend(by_label.values(), by_label.keys(), loc=4)
plt.subplots_adjust(top=0.961,
                    bottom=0.065,
                    left=0.065,
                    right=0.968,
                    hspace=0.217,
                    wspace=0.292)
#again, aligned by start time
plt.figure('Aligned')
for j, place in enumerate(title):
    peaks = {}
    plt.subplot(2, 2, j + 1)
    for tcn in plotdata[place]:
        series = plotdata[place][tcn]
        peaks[tcn] = p = gp.get_peak(time, series)
        #        series = scipy.signal.savgol_filter(plotdata[place][tcn], 91, 5)
        plt.plot(time + 0.05 - p.t0,
                 series,
                 color=colors[list(g[g.ALL.isin([tcn])].Marque)[0]],
                 label=g[g.ALL == tcn].Marque.tolist()[0])
#    names = g[g.ALL.isin(plotdata[j].columns)].iloc[:,3:5]
#    linelabels = [str(m)+' - '+str(n) for m,n in zip(list(names['Marque']), list(names['Modele']))]
#    linelabels = list(names['Marque'])

    plt.xlim([0, 0.2])
    plt.title(title[j])
    plt.ylabel(ylabel)
    plt.xlabel('Time [s]')

    handles, labels = plt.gca().get_legend_handles_labels()
Example #4
0
                    'Top Lap Belt Left', 'Top Lap Belt Right'
                ]]
                faro.loc[tcn + '_' + sheetname[-2:]] = relative.mean(axis=0)
        else:
            raw = raw['X']
            relative = (raw - raw.iloc[0]).loc[[
                'Top Lap Belt Left', 'Top Lap Belt Right'
            ]]
            faro.loc[tcn + '_' + sheetname[-2:]] = relative.mean(axis=0)
temp = pd.merge(table, faro, how='outer', left_index=True, right_index=True)
tcnlist = list(table.index)
peakdata = {}
for channel in fulldata:
    peakdata[channel] = pd.DataFrame(columns=['t0', 'tp', 'start', 'peak'])
    for tcn in fulldata[channel].columns.intersection(tcnlist):
        peakdata[channel].loc[tcn] = gp.get_peak(time, fulldata[channel][tcn])

peaktable = pd.concat(
    [peakdata['14CHST0000Y7ACXC'], peakdata['14PELV0000Y7ACXA']], axis=1)
peaktable.columns = [
    'Chest Start Time', 'Chest Peak Time', 'Chest 5% Peak', 'Chest Peak',
    'Pelvis Start Time', 'Pelvis Peak Time', 'Pelvis 5% Peak', 'Pelvis Peak'
]
t = pd.merge(temp, peaktable, how='outer', left_index=True, right_index=True)
t = t[t['Type_Mannequin'] == 'HIII Enfant'].drop('Location', axis=1)
t = t.reset_index()
t.to_excel('C:/Users/giguerf/table.xlsx', index=False)

#%%
plt.close('all')
for vitesse in [40, 48, 56]: