encode_parameter
- ketos.data_handling.parsing.encode_parameter(name, value)[source]
Encode paramater as a string with an SI unit, according to the unit specified in the audio_std_params dictionary. For example, if name=’window’ and value=4.22, the function returns the str ‘4.22 s’.
If the parameter is not found in the audio_std_params dictionary, the function returns the input value unmodified, unless the parameter is a tuple in which case it is converted to a string.
- Args:
- name: str
Name of the parameter to be encoded
- value: str
Value of the parameter to be encoded
- Returns:
- encoded_value: str or type of input value
Encoded value
- Example:
>>> from ketos.data_handling.parsing import encode_parameter >>> print(encode_parameter(name='step', value=0.037)) 0.037 s