tud_lbm.io.plotting.regime_map_plot
Aggregate Ca(t) regime classification across many run directories.
Reads simulation_data.csv (building it on demand if missing) for every run
directory listed in a plain-text file, classifies each run into
pinning/viscous/inertial/unknown (see
tud_lbm.io.analysis.accelerations.regime_classification), and plots the
result as Bo_parallel vs Oh — the regime map.
Classes
One classified run, ready to be plotted on the regime map. |
Functions
|
Parse one run-dir path per non-blank, non- |
|
Classify one run directory, or return |
|
Scatter Bo_parallel (x) vs Oh (y), grouped by regime. |
|
Classify every run listed in |
Module Contents
- class tud_lbm.io.plotting.regime_map_plot.RunRegimeEntry[source]
One classified run, ready to be plotted on the regime map.
- run_dir: pathlib.Path[source]
- tud_lbm.io.plotting.regime_map_plot.parse_run_dir_list(txt_path: str | pathlib.Path, allowed_roots: collections.abc.Sequence[str | pathlib.Path] = ()) list[pathlib.Path][source]
Parse one run-dir path per non-blank, non-
#line.Lines may be shell-quoted/escaped (e.g. copied from a terminal listing of directory names containing spaces or special characters); such quoting is stripped and backslash escapes are resolved before building the path. This applies whether or not the line is wrapped in quotes — shell tab-completion commonly emits backslash-escaped, unquoted lines (e.g.
\$Bo_\\parallel\ \=\ 0.60\;\ Oh\ \=\ 0.30\$). A line is only treated as escaped if it contains a backslash before a shell metacharacter (space,$,;,=, a quote, or another backslash) — a lone literal backslash that is simply part of the directory name (e.g.\parallel) is left untouched.Each line is treated as exactly one path, even if it contains (escaped or unescaped) whitespace — word-splitting would silently truncate paths like
$Bo_\\parallel = 0.60; Oh = 0.30$at the first space.Every entry (relative or absolute) must resolve inside at least one trusted root:
BASE_RESULTS_DIR(this project’s default results location) plus any extra directories passed viaallowed_roots. An entry outside all of them (e.g. a relative..escape, or an absolute path pointing somewhere untrusted) is rejected withValueError. Unlike the list file’s own directory,allowed_rootsare supplied directly by the caller rather than parsed from the list file’s content, so they form a real trust boundary rather than one derived from the same untrusted text being validated (see SonarQube rulepythonsecurity:S6549— a canonicalized path is only “sanitized” if checked against a fixed, independently-supplied root).A directory name containing a literal backslash (as in the
\parallelexample above) can only be created on a POSIX filesystem — Windows always treats\as a path separator, so such a name can never exist as a single path component there. On a Windows host such an entry is instead silently split into nested path components like any other Windows path; this function does not probe the filesystem to disambiguate that case, since doing so on unvalidated, user-controlled path text would make file existence itself an oracle. Callers that hit an unexpectedly missing run directory on Windows should check the list file for a backslash that was meant as a literal character rather than a path separator.txt_pathitself (which may originate from an untrusted CLI argument, e.g. when this tool is driven by an external or automated caller) is resolved to a canonical, absolute path and confirmed to be an existing regular file before anything is read from it, so a directory, device file, or nonexistent path is rejected withValueErrorup front rather than reaching the filesystem read in an unvalidated state.
- tud_lbm.io.plotting.regime_map_plot.process_run_dir(run_dir: pathlib.Path, *, smoothing: tud_lbm.io.analysis.accelerations.Smoothing = 'raw') RunRegimeEntry | None[source]
Classify one run directory, or return
None(with a warning) when unusable.
- tud_lbm.io.plotting.regime_map_plot.plot_regime_map(entries: list[RunRegimeEntry], out_path: str | pathlib.Path) pathlib.Path[source]
Scatter Bo_parallel (x) vs Oh (y), grouped by regime.
- tud_lbm.io.plotting.regime_map_plot.build_regime_map(txt_path: str | pathlib.Path, allowed_roots: collections.abc.Sequence[str | pathlib.Path] = (), out_dir: str | pathlib.Path | None = None, *, smoothing: tud_lbm.io.analysis.accelerations.Smoothing = 'raw') pathlib.Path | None[source]
Classify every run listed in
txt_pathand save the regime map.allowed_rootsare additional trusted directories (beyond the default results root) that every run-dir entry must resolve within; seeparse_run_dir_list().smoothingcontrols the acceleration curve used for peak detection in each run’s diagnostic plot (seetud_lbm.io.analysis.accelerations.acceleration_analysis.compute_acceleration()).Returns the path to
regime_map.png, orNoneif no run produced a usable entry.