Exemplo n.º 1
0
THOR = os.fspath('P:/AHEC/Data/THOR/')
chlist = ['11CHSTLEUPTHDSXB', '11CHSTRIUPTHDSXB', '11CHSTRILOTHDSXB', '11CHSTLELOTHDSXB']

time, fulldata = openHDF5(THOR, chlist)

for ch in chlist:
    print(ch)
    fulldata[ch] = check_and_clean(fulldata[ch],1)

table = tb.get('THOR')
table = table[table.TYPE.isin(['Frontale/Véhicule']) & table.VITESSE.isin([48,56])]
ok, slip = tb.tcns(tb.split(table, column='CBL_BELT', categories=['OK','SLIP']))

#%%
if 0:
    cd = style.colordict(chlist)
    titles = dict(zip(chlist, ['Upper Left', 'Upper Right', 'Lower Right', 'Lower Left']))

    plt.close('all')
    r, c = 2, 2
    fig, axs = style.subplots(r, c, sharex='all', sharey='all')
    ok_df = pd.DataFrame()
    slip_df = pd.DataFrame()
    for i, ch in enumerate(chlist):
        ax=axs[i]
        peaks, times = data.find_peak(data.smooth(fulldata[ch]), time)
        ok_df = pd.concat([ok_df, peaks.loc[ok].dropna().abs()], axis=1)
        slip_df = pd.concat([slip_df, peaks.loc[slip].dropna().abs()], axis=1)

        hist, bin_edges = np.histogram(np.array(peaks.loc[ok].dropna().abs()), bins=np.linspace(0,60,41), normed=True)
        ax.bar(bin_edges[1:], hist, 60/40, label=titles[ch]+' ok', color=cd[ch], alpha=0.25)
Exemplo n.º 2
0
from PMG.COM.openbook import openHDF5
from PMG.COM import table as tb, plotstyle as style

table = tb.get('SLED')

SLED = 'P:/SLED/Data/'
chlist = [
    '12HEAD0000Y7ACXA', '12HEAD0000Y2ACXA', '12CHST0000Y7ACXC',
    '12CHST0000Y2ACXC', '12PELV0000Y7ACXA', '12PELV0000Y2ACXA'
]

time, fulldata = openHDF5(SLED, chlist)

#%%
table = table[table.BACK.isin(['HB', 'LB']) & table.DATA.isin(['YES'])]
colors = style.colordict(
    ['HBold_accel', 'LBold_accel', 'HBnew_accel', 'LBnew_accel'])
labels = dict(
    zip(['HBold_accel', 'LBold_accel', 'HBnew_accel', 'LBnew_accel'],
        ['Highback Old', 'Lowback Old', 'Highback New', 'Lowback New']))

channels = ['12HEAD0000Y7ACXA', '12CHST0000Y7ACXC', '12PELV0000Y7ACXA']
chname = dict(zip(channels, ['Head', 'Chest', 'Pelvis']))

plt.close('all')
for ch in channels:

    fig, axs = style.subplots(2, 2, sharex='all', sharey='all')
    for i, (back, sled, ax) in enumerate(
            zip(['HB', 'HB', 'LB', 'LB'],
                ['old_accel', 'new_accel', 'old_accel', 'new_accel'], axs)):
        SEs = table[table.BACK.isin([back])
Exemplo n.º 3
0
#    colors = dict(zip(keys, values))
#
#    return colors

if __name__ == '__main__':
    import PMG.COM.data as data
    import PMG.COM.table as tb
    import PMG.COM.plotstyle as style
    THOR = 'P:/AHEC/Data/THOR/'
    chlist = ['11NECKLO00THFOXA']
    time, fulldata = data.import_data(THOR, chlist)
    df = fulldata['11NECKLO00THFOXA'].dropna(axis=1)
    table = tb.get('THOR')
    table = table[table.TYPE.isin(['Frontale/Véhicule'])]
    slips = table[table.CBL_BELT.isin(['SLIP'])].CIBLE.tolist()
    oks = table[table.CBL_BELT.isin(['OK'])].CIBLE.tolist()
    plt.close('all')
    #%%
    plt.figure()
    colors = style.colordict(df, 'order', plt.cm.YlGnBu)
    for tcn in df.columns[:]:
        plt.plot(df.loc[:, tcn], color=colors[tcn])
    #%%
    df = df.loc[:, slips + oks]
    colors = style.colordict(df, 'max', plt.cm.YlGnBu_r)
    colors = style.colordict(df, 'max', ['tab:blue', 'tab:red'], 3)
    fig, axs = plt.subplots(1, 2, sharex=True, sharey=True)
    for ax, tcns in zip(axs, [slips, oks]):
        for tcn in tcns:
            ax.plot(df.loc[:, tcn], color=colors[tcn])
Exemplo n.º 4
0
from PMG.COM import table as tb, plotstyle as style

table = tb.get('SLED')

SLED = 'P:/SLED/Data/'
chlist = [
    '12HEAD0000Y7ACXA', '12HEAD0000Y2ACXA', '12CHST0000Y7ACXC',
    '12CHST0000Y2ACXC', '12PELV0000Y7ACXA', '12PELV0000Y2ACXA'
]

time, fulldata = openHDF5(SLED, chlist)

#%%
chname = dict(
    zip(chlist, ['HEAD', 'HEAD', 'CHEST', 'CHEST', 'PELVIS', 'PELVIS']))
colors = style.colordict(['old_accel', 'new_accel', 'new_decel'])

plt.close('all')
for trio in 'ABCDEFGHIJKLMNOPQRSTU':
    SEs = table[table.TRIO == trio].SE.tolist()
    dummy = table[table.TRIO == trio].DUMMY.tolist()[0]
    model = table[table.TRIO == trio].MODEL.tolist()[0]

    fig, axs = style.subplots(2, 2, sharex='all')
    fig.suptitle(model)

    if dummy == 'Y2':
        channels = ['12HEAD0000Y2ACXA', '12CHST0000Y2ACXC', '12PELV0000Y2ACXA']
    else:
        channels = ['12HEAD0000Y7ACXA', '12CHST0000Y7ACXC', '12PELV0000Y7ACXA']
Exemplo n.º 5
0
chname = dict(zip(chlist, ['Lower Neck $F_x$', 'Upper Left Chest $D_x$']))
alltcns = bin1.CIBLE.tolist() + ok.CIBLE.tolist()

for c, (ch, group) in enumerate(
        zip([
            '11NECKLO00THFOXA', '11CHSTLEUPTHDSXB', '11NECKLO00THFOXA',
            '11CHSTLEUPTHDSXB'
        ], [bin1, bin1, ok, ok])):

    ax = axs[c]
    tcns = group.CIBLE.tolist()
    df = fulldata[ch].loc[:, tcns]
    if c in [0, 2]:
        cmap = matplotlib.colors.LinearSegmentedColormap.from_list(
            'custom', ['tab:red', 'tab:blue', 'tab:blue'], 256)
        colors = style.colordict(fulldata[ch].loc[:, alltcns], 'max', cmap)
    if c in [1, 3]:
        cmap = matplotlib.colors.LinearSegmentedColormap.from_list(
            'custom', ['tab:red', 'tab:red', 'tab:blue', 'tab:blue'], 256)
        colors = style.colordict(fulldata[ch].loc[:, alltcns], 'min', cmap)

    for tcn in df.columns:
        ax.plot(time, df[tcn], color=colors[tcn])

    if c in [0, 1]:
        points = np.array([])
        values = np.array([])
        points2 = np.array([])
        values2 = np.array([])
        for tcn in tcns:
            point = group[group.CIBLE == tcn].T1.iloc[0]
Exemplo n.º 6
0
#table = table[table.TYPE.isin(['Frontale/Véhicule'])]
#table = table[table.TYPE.isin(['Frontale/Mur'])]
slips  = table[table.CBL_BELT.isin(['SLIP'])].CIBLE.tolist()
oks = table[table.CBL_BELT.isin(['OK'])].CIBLE.tolist()

plt.rcParams['font.size']= 10

#slip_color = 'tab:blue'
#ok_color = 'tab:red'

slip_color = '#5e3c99'
slide_color = '#fdb863'
ok_color = '#e66101'

cmap_neck = matplotlib.colors.LinearSegmentedColormap.from_list('custom', [ok_color,slip_color,slip_color], 256)
colors_neck = style.colordict(fulldata['11NECKLO00THFOXA'].loc[:,slips+oks], 'max', cmap_neck)
cmap_chst = matplotlib.colors.LinearSegmentedColormap.from_list('custom', [ok_color,ok_color,slip_color,slip_color], 256)
colors_chst = style.colordict(fulldata['11CHSTLEUPTHDSXB'].loc[:,slips+oks], 'min', cmap_chst)

#%% FIGURE - DIFFERENCE IN RESPONSE BETWEEN SLIP/OK
#if 1:
#    plt.close('all')
#    chlist = ['11NECKLO00THFOXA','11NECKLO00THFOYA','11CHSTLEUPTHDSXB','11FEMRLE00THFOZB']
#    labels = ['Lower Neck $\mathregular{F_x}$ [N]',
#              'Lower Neck $\mathregular{F_y}$ [N]',
#              'Upper Left Chest $\mathregular{D_x}$ [mm]',
#              'Left Femur $\mathregular{F_x}$ [N]']
#    ylabel = dict(zip(chlist, labels))
#    xfmt = matplotlib.ticker.ScalarFormatter(useMathText=True)
#    xfmt.set_powerlimits((-3,4))
#