tracewin_utils.dat_files module

Define functions to load, modify and create .dat structure files.

Todo

Insert line skip at each section change in the output.dat

_is_needed_element(instruction: Instruction, indexes_to_keep: Container[int]) bool

Tell if the instruction is an element that we must keep.

_is_useful_command(instruction: Instruction, indexes_to_keep: Iterable[int]) bool

Tell if the current command has an influence on our elements.

dat_filecontent_from_smaller_list_of_elements(original_instructions: Sequence[Instruction], elts: Collection[Element]) tuple[list[list[str]], list[Instruction]]

Create a .dat with only elements of elts (and concerned commands).

Properties of the FIELD_MAP, i.e. amplitude and phase, remain untouched.

export_dat_filecontent(dat_content: Collection[Collection[str]], dat_path: Path) None

Save the content of the updated dat to a .dat.

Parameters:
  • dat_content (Collection[Collection[str]]) – Content of the .dat, line per line, word per word.

  • dat_path (Path) – Where to save the .dat.