Esempio n. 1
0
import cauldron as cd
import plotly.graph_objs as go
from cauldron import plotting
from tracksim.coupling import prss
from tracksim.coupling.plotting import scatter

cd.refresh(prss)

cd.display.markdown("""
    ## Persistent Residuals (PRSS)
    """)

df = cd.shared.df
data = prss.compute_many(cd.shared.trials)
fitness = prss.to_fitness(data['prss_norm'])
df['persistence'] = [fitness[tid] for tid in df.id]

cd.display.plotly(
    data=scatter.create(
        data_frame=df,
        value_column=[data['prss'][tid].value for tid in df.id],
        uncertainty_column=[data['prss'][tid].uncertainty for tid in df.id],
        x_column='order'),
    layout=plotting.create_layout(
        {'hovermode': 'closest'},
        title='Coupling Length Persistent Residual Sum of Squares',
        x_label='Trial Index (#)',
        y_label='Persistent RSS'))

cd.display.plotly(
    data=scatter.create(df, [data['prss_norm'][tid].value for tid in df.id],
Esempio n. 2
0
import cauldron as cd
from tracksim.coupling import loader as tk_loader

cd.refresh(tk_loader)

data = tk_loader.load([
    'CRO-500-2004-3-S-2_v0_full_dc50',
    'CRO-500-2004-3-S-2_v0_full',
    'CRO-500-2004-3-S-2_v0_full_dc75'
    ],
    row_filter=tk_loader.redundant_filter
)

cd.shared.groups = data['groups']
cd.shared.trials = data['trials']
cd.shared.df = data['df']

cd.display.table(data['df'][[
    'short_id', 'coupling_length', 'uncertainty',
    'start_time', 'end_time'
]])
Esempio n. 3
0
import cauldron as cd
import pandas as pd
from cauldron import plotting
from plotly import graph_objs as go
from tracksim import coupling
from tracksim.coupling.plotting import stem

cd.refresh(coupling)
cd.refresh(stem)

df = cd.shared.df  # type: pd.DataFrame

cd.display.header('Solution Fitness')

traces = []
for gait_id in df.gait_id.unique():
    df_slice = df[df.gait_id == gait_id]
    traces.append(go.Scatter(
        x=df_slice['persistence'],
        y=df_slice['swing'],
        mode='markers',
        marker={
            'size': 8,
            'color': df_slice.iloc[0].color
        },
        name=gait_id,
        text=df_slice.short_id
    ))

cd.display.plotly(
    data=traces,
Esempio n. 4
0
import cauldron as cd
import plotly.graph_objs as go
from cauldron import plotting
from tracksim.coupling import swing
from tracksim.coupling.plotting import scatter

cd.refresh(swing)

df = cd.shared.df
swing_data = swing.compute_many(cd.shared.trials)
fitness = swing.to_fitness(swing_data)
df['swing'] = [fitness[tid] for tid in df.id]

cd.display.plotly(
    data=scatter.create(df, [swing_data[tid].value for tid in df.id],
                        [swing_data[tid].uncertainty for tid in df.id],
                        x_column='order'),
    layout=plotting.create_layout(title='Normalized Swing by Trial',
                                  x_label='Trial Index (#)',
                                  y_label='Swing'))

cd.display.plotly(data=go.Bar(y=df.swing,
                              text=df.short_id,
                              marker=dict(color=df.color)),
                  layout=plotting.create_layout(
                      title='Swing Deviation',
                      x_label='Trial Index (#)',
                      y_label='Fractional Deviation'))
Esempio n. 5
0
import cauldron as cd
import plotly.graph_objs as go
from cauldron import plotting
from tracksim.coupling import swing
from tracksim.coupling.plotting import scatter

cd.refresh(swing)

df = cd.shared.df
swing_data = swing.compute_many(cd.shared.trials)
fitness = swing.to_fitness(swing_data)
df['swing'] = [fitness[tid] for tid in df.id]

cd.display.plotly(
    data=scatter.create(
        df,
        [swing_data[tid].value for tid in df.id],
        [swing_data[tid].uncertainty for tid in df.id],
        x_column='order'
    ),
    layout=plotting.create_layout(
        title='Normalized Swing by Trial',
        x_label='Trial Index (#)',
        y_label='Swing'
    )
)

cd.display.plotly(
    data=go.Bar(
        y=df.swing,
        text=df.short_id,
import cauldron as cd
from cauldron import plotting
from tracksim.coupling.plotting import band

cd.refresh(band)

df = cd.shared.df.sort_values(by='fitness', ascending=False).head()

cd.display.header('Highest Fitness Trials', 2)
cd.display.markdown(
    """
    The following are the coupling length plots for the simulation trials
    with the highest fitness values
    """
)


def plot(trial):
    plot_data = band.coupling(trial)
    cd.display.plotly(
        data=plot_data['data'],
        layout=plotting.create_layout(
            plot_data['layout'],
            title='{} Coupling Length'.format(trial['short_id']),
            x_label='Cycle (#)',
            y_label='Coupling Length (m)'
        )
    )

ids = df['id'].tolist()
import cauldron as cd
from cauldron import plotting
from tracksim.coupling.plotting import band

cd.refresh(band)

df = cd.shared.df.sort_values(by='fitness', ascending=False).head()

cd.display.header('Highest Fitness Trials', 2)
cd.display.markdown("""
    The following are the coupling length plots for the simulation trials
    with the highest fitness values
    """)


def plot(trial):
    plot_data = band.coupling(trial)
    cd.display.plotly(data=plot_data['data'],
                      layout=plotting.create_layout(
                          plot_data['layout'],
                          title='{} Coupling Length'.format(trial['short_id']),
                          x_label='Cycle (#)',
                          y_label='Coupling Length (m)'))


ids = df['id'].tolist()

for t in cd.shared.trials:
    if t['id'] in ids:
        plot(t)
Esempio n. 8
0
import cauldron as cd
import pandas as pd
from cauldron import plotting
from plotly import graph_objs as go
from tracksim import coupling
from tracksim.coupling.plotting import stem

cd.refresh(coupling)
cd.refresh(stem)

df = cd.shared.df  # type: pd.DataFrame

cd.display.header('Solution Fitness')

traces = []
for gait_id in df.gait_id.unique():
    df_slice = df[df.gait_id == gait_id]
    traces.append(
        go.Scatter(x=df_slice['persistence'],
                   y=df_slice['swing'],
                   mode='markers',
                   marker={
                       'size': 8,
                       'color': df_slice.iloc[0].color
                   },
                   name=gait_id,
                   text=df_slice.short_id))

cd.display.plotly(data=traces,
                  layout=plotting.create_layout({'hovermode': 'closest'},
                                                title='Fitness Parameters',
Esempio n. 9
0
import cauldron as cd
import pandas as pd
import plotly.graph_objs as go
from cauldron import plotting
from tracksim.coupling.plotting import scatter

cd.refresh(scatter)

df = cd.shared.df  # type: pd.DataFrame

cd.display.markdown(
    """
    ## Median Coupling Lengths

    The median coupling length values, and their uncertainties, for each
    simulation are shown below ordered from smallest to largest.
    """
)

cd.display.plotly(
    data=scatter.create(df, 'coupling_length', 'uncertainty', 'order'),
    layout=plotting.create_layout(
        title='Median Coupling Lengths by Trial',
        x_label='Trial Index (#)',
        y_label='Coupling Length (m)'
    )
)

cd.display.markdown(
    """
    The uncertainties in the simulation trials do not scale with coupling
Esempio n. 10
0
import cauldron as cd
import plotly.graph_objs as go
from cauldron import plotting
from tracksim import coupling

cd.refresh(coupling)

df = cd.shared.df
dist_data = coupling.distribution(df, 1.23, 2.1, 0.13)

distribution_trace = go.Scatter(
    x=dist_data['values']['x'],
    y=dist_data['values']['y'],
    name='Distribution',
    mode='lines',
    fill='tozeroy'
)

segment_trace = go.Scatter(
    x=dist_data['segment']['x'],
    y=dist_data['segment']['y'],
    mode='lines',
    name='Region',
    line=go.Line(
        color=plotting.get_color(1, 1.0),
        width=4
    )
)

gaussian_trace = go.Scatter(
    x=dist_data['gauss']['x'],