示例#1
0
def power_over_time(ax, session_data):
    race_time = data_processing.get_run_time_cleaned(session_data=session_data)
    energy, kinetic_energy, potential_energy = data_processing.get_energy(
        session_data=session_data)
    power = data_processing.derive_no_nan(energy, race_time)
    full_acceleration = data_processing.get_full_acceleration_mask(
        session_data=session_data)
    not_full_acceleration = np.logical_not(full_acceleration)
    power_full_acceleration = power.copy()
    power_full_acceleration[not_full_acceleration] = 0.0
    power_not_full_acceleration = power.copy()
    power_not_full_acceleration[full_acceleration] = 0.0
    power_data = np.array(
        [power_full_acceleration, power_not_full_acceleration])

    labels = ['Power at full throttle (kW)', 'Power otherwise (kW)']
    y_points = power_data
    x_points = np.array([race_time] * y_points.shape[0])

    line_plot(ax,
              x_points=x_points,
              y_points=y_points,
              title='Power over time',
              labels=labels,
              alpha=0.5,
              x_label='Time (s)',
              y_label='Power (kW)',
              min_max_annotations=False)
示例#2
0
def plot_energy_over_2d_pos(ax, session_data):

    scale_factor = 100.0
    gear = session_data[networking.Fields.gear.value]
    pos_x, pos_y = data_processing.get_2d_coordinates(session_data)
    range_gears = np.unique(gear)

    energy, kinetic_energy, potential_energy = data_processing.get_energy(
        session_data=session_data)
    energy_truncated = energy - np.min(energy)
    energy_normalized = energy_truncated / np.max(energy_truncated)

    labels = ['Gear {}'.format(str(g)) for g in range_gears]
    lines_x = []
    lines_y = []
    scales = []
    for i, g in enumerate(range_gears):
        current_gear = session_data[networking.Fields.gear.value] == g
        lines_x += [pos_x[current_gear]]
        lines_y += [pos_y[current_gear]]
        scales += [energy_normalized[current_gear] * scale_factor]

    plot_over_2d_pos(ax,
                     session_data=session_data,
                     lines_x=lines_x,
                     lines_y=lines_y,
                     scale=scales,
                     alpha=0.5,
                     title='Gear at 2D positions, scaled by energy',
                     labels=labels)
示例#3
0
def energy_over_time(ax, session_data):
    race_time = data_processing.get_run_time_cleaned(session_data=session_data)
    energy, kinetic_energy, potential_energy = data_processing.get_energy(
        session_data=session_data)
    energy_data = np.array([energy, kinetic_energy, potential_energy])

    labels = ['Energy (kJ)', 'Kinetic Energy (kJ)', 'Potential Energy (kJ)']
    y_points = energy_data
    x_points = np.array([race_time] * y_points.shape[0])

    line_plot(ax,
              x_points=x_points,
              y_points=y_points,
              title='Energy over time',
              labels=labels,
              alpha=0.5,
              x_label='Time (s)',
              y_label='Energy (kJ)',
              min_max_annotations=False)
示例#4
0
def plot_p_over_vel(ax, session_data):

    data_gear = session_data[networking.Fields.gear.value]
    range_gears = list(set(data_gear))
    range_gears.sort()

    labels = ['Gear {}'.format(str(g)) for g in range_gears]
    scale = 50.0
    alphas = [0.5] * len(labels)
    colors = [static_colors[i] for i, g in enumerate(range_gears)]
    full_acceleration_mask = data_processing.get_full_acceleration_mask(
        session_data=session_data)

    energy, kinetic_energy, potential_energy = data_processing.get_energy(
        session_data=session_data)
    times_steps = data_processing.get_run_time_cleaned(
        session_data=session_data)
    power = data_processing.derive_no_nan(x=energy,
                                          time_steps=times_steps) / 1000.0

    x_points = []
    y_points = []
    scales = []
    for gear in range_gears:
        current_gear = session_data[networking.Fields.gear.value] == gear
        interesting = np.logical_and(current_gear, full_acceleration_mask)

        speed_ms = session_data[networking.Fields.speed_ms.value]
        x_points += [speed_ms[interesting]]
        y_points += [power[interesting]]
        scales += [np.ones_like(speed_ms[interesting]) * scale]

    scatter_plot(ax,
                 x_points=x_points,
                 y_points=y_points,
                 title='Power over velocity (full throttle)',
                 labels=labels,
                 colors=colors,
                 scales=scales,
                 alphas=alphas,
                 x_label='Velocity (m/s)',
                 y_label='Power (kW)')