helper module

Define helper funcs for MultipactorTest, PowerStep.

parse_header_value(commented_lines, key)[source]

Extract a scalar value from the CSV commented header.

Parameters:
  • commented_lines (Sequence[str]) – Lines from the file header, already stripped of their comment character.

  • key (str) – The header key to look up (e.g. "Polarisation_2").

Return type:

float

Returns:

The parsed float value, or np.nan if the key is absent or the value cannot be converted (including "NaN" entries).

take_maximum(raw_data, warn_nan=False)[source]

Take the maximum of the array.

This is the default behavior for LabViewer.

Parameters:

raw_data (ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]])

Return type:

float

take_median(raw_data, first_index=0, last_index=-1)[source]

Take median from first_index to last_index.

Parameters:
Return type:

float

POWERSTEP_FILE_RECOGNIZER_T

Functions detecting if the file as argument corresponds to a PowerStep file.

alias of Callable[[Path], bool]

default_powerstep_file_valider(path)[source]

Detect CSV files.

Parameters:

path (Path)

Return type:

bool

powerstep_files(folder, file_recognizer)[source]

Gather powerstep files in `folder with their sample_index.

Parameters:
  • folder (Path) – Directory holding all the power step files of a test.

  • file_recognizer (Callable[[Path], bool]) – Takes in a path, determine if it should be loaded.

Return type:

dict[Path, int]

Returns:

Maps power step files with corresponding sample index.