I/O Utilities

pymadng_utils.io reads and writes tab-delimited name<TAB>value knob files. Malformed lines are ignored while numeric conversion errors are reported.

Knob-file I/O.

pymadng_utils.io.read_knobs(file_path)[source]

Read knob strengths from a tab-delimited file.

Parameters:

file_path (str | Path) – File where each line is “knob_name strength”; lines without exactly two tab-separated fields are skipped.

Returns:

A dictionary mapping knob names to their float strengths.

Return type:

dict[str, float]

pymadng_utils.io.save_knobs(knobs, filepath)[source]

Write knob strengths to a tab-separated file, one “knob_name strength” line per knob.

Parameters:
  • knobs (dict[str, float]) – Dictionary of knob names and values

  • filepath (Path) – Path of the file to write

Return type:

None