Example #1
0
def animate(cut=0.0033, cutmax=0.02, res=400, w=0.001):
    #if 1==1:
    import matplotlib.pyplot as plt
    import matplotlib.animation as animation
    import GitHub.COM.openbook as ob
    time, data = ob.openbook('P:/AHEC/SAI/')
    #    x = data['10CVEHCG0000ACXD'].loc[:,'TC15-163']-data['10SIMERI00INACXD'].loc[:,'TC15-163']
    #    x = data['10CVEHCG0000ACXD'].iloc[:,0]
    x = data['11CHST0000H3ACXC'].loc[:, 'TC12-012']

    x1, z, z1, freq = lowpass_plot(x, cut)

    plt.close('all')
    fig, axs = plt.subplots(1, 2, figsize=(21, 7))

    line0, = axs[0].plot(time, x)
    line1, = axs[1].plot(freq, abs(z))
    line2, = axs[1].plot(freq, abs(z1))
    line3, = axs[0].plot(time, x1)
    line4, = axs[0].plot(time, x - x1)

    lines = [line0, line1, line2, line3, line4]

    axs[0].set_xlim(-0.01, 0.3)
    axs[0].set_ylim(-35, 10)
    axs[1].set_xlim(-0.01, 0.07)
    return animation.FuncAnimation(fig,
                                   plotfunc,
                                   res,
                                   fargs=(cutmax, res, lines, time, x, w),
                                   interval=50,
                                   blit=True)
Example #2
0
    'TIGUAN', 'YARIS'
]  #['Camry','Cruze','Jetta','Escape','Mazda','Civic','Focus','Rogue']
linelist = ['10CVEHCG0000ACXD']

# Titles and subloc
figtitle = 'Vehicle CG accelerations by model'
subtitle = ''

#subloc = dict(zip(sublist, [1, 4, 5, 4, 5, 2, 3, 1]))
subloc = dict([(subID, i + 1) for i, subID in enumerate(sublist)])
sharex = 'all'
sharey = 'all'

# Data to use

time, fulldata = ob.openbook('P:/AHEC/SAI/')
singles, pairs = ob.lookup_pairs(project='THOR')
###---------------------------------------------------------------------------
# Notes on Usage and main loop
###---------------------------------------------------------------------------

# for _ID in _list
#   datadict = {} [leave alone]
#   [shorthands go here]
#   vars = [change this]

datadict = {}
figtitledict = {}
subtitledict = {}
linelabeldict = {}
linecolordict = {}
Example #3
0
linelist = ['14CHST0000' + dummy + 'ACXC', '14PELV0000' + dummy + 'ACXA']

# Titles and subloc
figtitle = 'Relative Chest and Pelvis Accelerations:\n'
subtitle = ''

#subloc = dict(zip(sublist, [1, 4, 5, 4, 5, 2, 3, 1]))
subloc = dict([(subID, i + 1) for i, subID in enumerate(sublist)])
#bounds = [style.bounds(measure='AC') for i in range(4)]
#boundsdict = dict(zip(sublist, bounds))
sharex = 'all'
sharey = 'all'

# Data to use

time, fulldata, veh, sled = ob.openbook(readdir)
groupdict = ob.popgrids(
    fulldata, ['14CHST0000' + dummy + 'ACXC', '14PELV0000' + dummy + 'ACXA'])
groupnames = {
    '40': 'Speed: 40 km/h',
    '48': 'Speed: 48 km/h',
    '56': 'Speed: 56 km/h'
}
titles = {
    'On': 'Conventional Boosters',
    'Close': 'Special Population',
    'Away': 'Belt Far From Pelvis',
    'UAS': 'UAS-Enabled Boosters'
}
###---------------------------------------------------------------------------
# Notes on Usage and main loop
Example #4
0
import os
import sys
import pandas as pd
import numpy as np
import scipy.stats
import matplotlib.pyplot as plt
if 'C:/Users/giguerf/Documents' not in sys.path:
    sys.path.insert(0, 'C:/Users/giguerf/Documents')
from GitHub.COM import openbook as ob
#from GitHub.COM import plotstyle as style
from GitHub.COM import get_peak as gp

readdir = os.fspath('P:/BOOSTER/SAI/Y7')
savedir = os.fspath('P:/BOOSTER/Plots/Y7')

time, fulldata, *_ = ob.openbook(readdir)
#time, fulldata = time, fulldata
#%%

table = pd.read_excel('P:/BOOSTER/boostertable.xlsx', index_col = 0)
import xlrd
faro = pd.DataFrame(columns = ['LBS Top','LBS Bottom'])
for file in os.listdir('P:/BOOSTER/Faro/'):
    tcn = file[:-4]
    for sheetname in ['BELT MEASURE POSITION 14','BELT MEASURE POSITION 16']:
        try:
            raw = pd.read_excel('P:/BOOSTER/Faro/'+tcn+'.xls', sheetname=sheetname, index_col=4)
        except xlrd.XLRDError:
            try:
                raw = pd.read_excel('P:/BOOSTER/Faro/'+tcn+'.xls', sheetname=sheetname.title(), index_col=4)
            except xlrd.XLRDError:
Example #5
0
"""
import os
import pandas as pd
import matplotlib.pyplot as plt
from GitHub.COM import openbook as ob
from GitHub.COM import plotstyle as style
from GitHub.COM.fft import lowpass

readdir = os.fspath('P:/AHEC/SAI/')
savedir = os.fspath('P:/AHEC/Plots/')

subdir = 'test/'
tcns = None
#chlist = ['10SIMELE00INACXD', '10SIMERI00INACXD', '10CVEHCG0000ACXD']

time, data = ob.openbook(readdir)

left = data['10SIMELE00INACXD']
center = data['10CVEHCG0000ACXD']
right = data['10SIMERI00INACXD']

plt.close('all')

r, c = style.sqfactors(len(center.columns[:9]))
fig, axs = style.subplots(r, c, sharey='all', figsize=(10 * c, 6.25 * r))
ylim = style.ylim_no_outliers([center - right, center, right])

for i, tcn in enumerate(center.columns[:9]):
    ax = axs[i]
    try:
        ax.plot(time, center.loc[:, tcn] - right.loc[:, tcn], color='k')