parse_parameter

ketos.data_handling.parsing.parse_parameter(name, value)[source]

Parse the parameter value according to the type and unit specified in the audio_std_params dictionary. For example, if name=’window’ and value=’22.1 ms’, the function returns the float 0.0221.

If the parameter is not found in the audio_std_params dictionary, the function returns the input value unmodified.

Args:
name: str

Name of the parameter to be parsed

value: str

Value of the parameter to be parsed

Returns:
parsed_value: str, int, float, bool, or list

Parsed value

Example:
>>> from ketos.data_handling.parsing import parse_parameter
>>> print(parse_parameter(name='step', value='23 ms'))
0.023