Skip to content

Scripts

This module contains various scripts (functions) that can be used with the argument --script. Typically they will produce some output file (e.g. a csv or plot) for some data of interest from a log file. The avaliable functions are intended to be called from the command line and not to to be used directly. The make use of the matbii.extras.analysis module to produce files and plots.

summary(**kwargs)

Produce a summary from the given logging directory.

Source code in matbii\extras\scripts.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def summary(**kwargs: dict[str, Any]) -> None:
    """Produce a summary from the given logging directory."""
    parser = argparse.ArgumentParser(
        description="Produce a summary from the given logging directory."
    )
    parser.add_argument(
        "--path", type=str, required=True, help="The path to the logging directory."
    )
    parser.add_argument(
        "--output",
        type=str,
        required=False,
        help="The path to the output directory, if left unspecified files will be written to <--path>/summary.",
    )
    args, _ = parser.parse_known_intermixed_args()  # ignore unknown args
    path = Path(args.path)
    log_file, config_file = _validate_logging_path(path)
    config = _load_config(config_file, context=kwargs)

    if args.output:
        output_dir = Path(args.output)
    else:
        output_dir = path / "summary"
    output_dir.mkdir(parents=True, exist_ok=True)
    _summary(log_file, config, output_dir)