Exemplo n.º 1
0
def add_header_section(
        report: reporting.Report,
        settings: dict,
        activity_phases: limb.Property
):
    """

    :param report:
    :param settings:
    :param activity_phases:
    :return:
    """

    activity_phases = activity_phases.values()
    support_phases = settings['support_phases']

    activity_phases = ['{}%'.format(round(100 * x)) for x in activity_phases]
    support_phases = ['{}%'.format(round(100 * x)) for x in support_phases]

    report.add_template(
        paths.resource('trial', 'header.html'),
        title=settings.get('name'),
        summary=settings.get('summary'),
        duty_cycle=round(100.0 * settings['duty_cycle']),
        activity_phases=activity_phases,
        support_phases=support_phases,
        date=datetime.utcnow().strftime("%m-%d-%Y %H:%M")
    )
Exemplo n.º 2
0
def add_info(report: reporting.Report, settings: dict, coupling_data: dict):
    """
    Adds the info section to the report, which is an existing html template
    that is pre-populated with data by rendering it with Jinja2

    :param report:
        The report being created
    :param settings:
        Configuration settings for the trial simulation
    :param coupling_data:
        Coupling analysis data
    :return:
    """

    bounds = coupling_data['bounds']
    bounds = [mstats.value.round_significant(b, 4) for b in bounds]

    report.add_template(
        paths.resource('trial', 'info.html'),
        coupling_length=coupling_data['value'].html_label,
        coupling_bounds=bounds
    )
Exemplo n.º 3
0
def add_header_section(
        report: reporting.Report,
        settings: dict,
        trials: typing.List[dict]
):
    trial_data = []
    for t in trials:
        color = plotting.get_color(t['index'] - 1, as_string=True)

        trial_data.append(dict(
            index=t['index'],
            id=t['id'],
            name=t['settings']['name'],
            summary=t['settings'].get('summary', ''),
            back_color=color
        ))

    report.add_template(
        path=paths.resource('group', 'header.html'),
        title=settings['name'],
        date=datetime.utcnow().strftime("%m-%d-%Y %H:%M"),
        summary=settings.get('summary'),
        trials=trial_data
    )