qudi.util.helpers.csv_2_list

qudi.util.helpers.csv_2_list(csv_string: str, str_2_val: Callable[[str], Any] | None = None) List[Any][source]

Parse a list literal (with or without square brackets) given as a string containing comma-separated int or float values to a Python list.

Blanks before and after commas are handled.

Parameters:
csv_stringstr

Scalar number literals as strings separated by a single comma and any number of blanks. Brackets are ignored. Example: ‘[1e-6,2.5e6, 42]’ or ‘1e-6, 2e-6, 42’.

str_2_valfunction, optional

Function to use for casting substrings into single values.

Returns:
list

List of float values. If str_2_val is provided, type is invoked by this function.