# pydicom.values.convert_DS_string

pydicom.values.convert_DS_string(byte_string: bytes, is_little_endian: bool, struct_format: Optional[str] = None) → Union[pydicom.valuerep.DSfloat, MutableSequence[pydicom.valuerep.DSfloat], numpy.float64, numpy.ndarray]

  Return a decoded ‘DS’ value.

  Changed in version 2.0: The option to return numpy values was added.

  Parameters

    - byte_string (bytes) – The encoded ‘DS’ element value.

    - is_little_endian (bool) – `True` if the value is encoded as little endian, `False` otherwise.

    - struct_format (str, optional) – Not used.

  Returns

    If `use_DS_decimal` is `False` (default), returns a `DSfloat` or list of them

    If `use_DS_decimal` is `True`, returns a `DSdecimal` or list of them

    If `use_DS_numpy` is `True`, returns a `numpy.float64` or a `numpy.ndarray` of them

  Return type

    `DSfloat`, `DSdecimal`, `numpy.float64`, MultiValue of DSfloat/DSdecimal or `numpy.ndarray` of `numpy.float64`

  Raises

    - ValueError – If `use_DS_numpy` is `True` and the string contains non-valid characters

    - ImportError – If `use_DS_numpy` is `True` and numpy is not available