Base Report

This module contains the abstract definition of a simulation report. It has the definition of BaseReport, that should be extended, implementing its abstract methods.

Example

Creating a concrete report:

class NewReport(BaseReport):

    def _get_results(
        self, headers: Set[str], outputs: Dict[Time, DynamicSystemOutput]
    ) -> ReportResult:
        print(outputs)

Saving an output:

report.add_output({model: model_output}, 1)

Generating report:

report.generate_report()
class gsf.reports.core.base_report.BaseReport(event_bus: Optional[event_bus.bus.EventBus] = None)

Bases: object

Base report generator

_outputs

Saved outputs.

Type

Dict[Time, DynamicSystemOutput]

_headers

Headers for the report table.

Type

Set[str]

_event_bus

Event bus of the module.

Type

EventBus

abstract _get_results(headers: Set[str], outputs: Dict[float, Dict[str, Any]])Any

Generates the report.

add_output(output: Dict[str, Any], time: float)

Saves an output into the report registry.

Parameters
  • output (DynamicSystemOutput) – Report to save.

  • time (Time) – Time of the given output.

generate_report()Any

Returns the generated report from the saved outputs.

gsf.reports.core.base_report.DynamicSystemOutput

Output of the dynamic system type.

alias of Dict[str, Any]

gsf.reports.core.base_report.ReportResult = typing.Any

Report result type