<jupyter_start><jupyter_text>Run `calc_all_cases.m` in the `./src` dirTakes ~30' to complete writting al result files(!), so better use `RunAllCasesByOctave-pandas` notebook.<jupyter_code>## To autoreload codein python files here.
%load_ext autoreload
%autoreload 2

## Auto-format cells to ease diffs.
%load_ext lab_black
## If you change that, restart kernel and clear all outpouts before running it
#%matplotlib widget
%matplotlib inline
from typing import Union, List, Callable, Any, Sequence as Seq
from datetime import datetime
import io
import itertools as itt
import logging
from pathlib import Path, PurePosixPath as P
import sys
import os.path as osp

from columnize import columnize
import numpy as np
import pandas as pd
from pandas import HDFStore, IndexSlice as idx
from pandas.core.generic import NDFrame
from matplotlib import pyplot as plt
from pandalone.mappings import Pstep
import qgrid

import wltp
from wltp.utils import matlab_pwd_changed

## Add tests/ into `sys.path` to import `vehdb` module.
#
proj_dir = str(Path(wltp.__file__).parents[1] / "tests")
if proj_dir not in sys.path:
    sys.path.insert(0, proj_dir)

import vehdb

idx = pd.IndexSlice
log = logging.getLogger("VMax.ipynb")
logging.getLogger("blib2to3").propagate = False  # Disable `lab_black` logs.
logging.basicConfig(
    level=logging.DEBUG,
    format="%(asctime)s|%(levelname)5.5s|%(name)s:[%(funcName)s]:\n  +--> %(message)s",
    datefmt="%Y-%m-%d,%H:%M:%S",
)
pd.set_option("display.max_columns", 64)
## Setup Octave to execute wltp's MATLAB sources.
#
from oct2py import octave as oc

# See https://nbviewer.jupyter.org/github/blink1073/oct2py/blob/master/example/octavemagic_extension.ipynb?create=1
%load_ext oct2py.ipython

wltp_mat_sources_path = str(Path("src").absolute())
mat_path = set(oc.path().split(osp.pathsep))
if wltp_mat_sources_path not in mat_path:
    oc.addpath(wltp_mat_sources_path)
def run_mat():
    start_time = datetime.now()
    try:
        with matlab_pwd_changed("outs", oc):
            oc.calc_all_cases()
    finally:
        end_time = datetime.now()
        display(f"\nStart-time: {start_time}, end-time: {end_time}")


%time run_mat()<jupyter_output>read input files :
- case.txt
warning: fopen: '/home/ankostis/Work/wltp.git/Notebooks/Matlab/src/case.txt' found by searching load path
- vehicle.txt
warning: fopen: '/home/ankostis/Work/wltp.git/Notebooks/Matlab/src/vehicle.txt' found by searching load path
- engine.txt
warning: fopen: '/home/ankostis/Work/wltp.git/Notebooks/Matlab/src/engine.txt' found by searching load path
- gearbox.txt
warning: fopen: '/home/ankostis/Work/wltp.git/Notebooks/Matlab/src/gearbox.txt' found by searching load path
- phase.txt
warning: fopen: '/home/ankostis/Work/wltp.git/Notebooks/Matlab/src/phase.txt' found by searching load path
- trace.txt
warning: fopen: '/home/ankostis/Work/wltp.git/Notebooks/Matlab/src/trace.txt' found by searching load path
- scale.txt
warning: fopen: '/home/ankostis/Work/wltp.git/Notebooks/Matlab/src/scale.txt' found by searching load path
write formatted input files :
- case_formatted.txt
- vehicle_formatted.txt
- engine_formatted.txt
- gearbox_formatted.txt
- trace_formatted.[...]
{'fraction_non_alphanumeric': 0.11751801942964588, 'fraction_numerical': 0.005954246317768724, 'mean_word_length': 4.741007194244604, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '194475', 'license': 'Apache-2.0', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1126, 'n_words': 283, 'path': 'Notebooks/Matlab/RunAllCasesByOctave-fully.ipynb', 'repo_name': 'JRCSTU/wltp', 'size': '3191'}