# pydicom.waveforms.numpy_handler

Use the numpy package to convert supported Waveform Data to a `numpy.ndarray`.

Added in version 2.1.

Supported data

The numpy handler supports the conversion of data in the (5400,0100) Waveform Sequence element to an `ndarray` provided the related Waveform module elements have values given in the table below.

Element | Supported values
--- | ---
Tag | Keyword | Type
(003A,0005) | NumberOfWaveformChannels | 1 | N > 0
(003A,0010) | NumberOfWaveformSamples | 1 | N > 0
(5400,1004) | WaveformBitsAllocated | 1 | 8, 16, 32, 64
(5400,1006) | WaveformSampleInterpretation | 1 | SB, UB, MB, AB, SS, US, SL, UL, SV, UV

Functions

`generate_multiplex`(ds[, as_raw]) | Yield an `ndarray` for each multiplex group in the Waveform Sequence.
`is_available`() | Return `True` if the handler has its dependencies met.
`multiplex_array`(ds, index[, as_raw]) | Return an `ndarray` for the multiplex group in the Waveform Sequence at index.

pydicom.waveforms.numpy_handler.generate_multiplex(ds: Dataset, as_raw: bool = True) → Generator[np.ndarray, None, None]

  Yield an `ndarray` for each multiplex group in the Waveform Sequence.

  Added in version 2.1.

  Parameters:

    - ds (pydicom.dataset.Dataset) – The `Dataset` containing a Waveform module and the Waveform Sequence to be converted.

    - as_raw (bool, optional) – If `True` (default), then yield the raw unitless waveform data. If `False` then attempt to convert the raw data for each channel to the quantity specified by the corresponding (003A,0210) Channel Sensitivity unit.

  Yields:

    np.ndarray – The waveform data for a multiplex group as an `ndarray` with shape (samples, channels).

pydicom.waveforms.numpy_handler.is_available() → bool

  Return `True` if the handler has its dependencies met.

  Added in version 2.1.

pydicom.waveforms.numpy_handler.multiplex_array(ds: Dataset, index: int, as_raw: bool = True) → np.ndarray

  Return an `ndarray` for the multiplex group in the Waveform Sequence at index.

  Added in version 2.1.

  Parameters:

    - ds (pydicom.dataset.Dataset) – The `Dataset` containing a Waveform module and the Waveform Sequence to be converted.

    - index (int) – The index of the multiplex group to return.

    - as_raw (bool, optional) – If `True` (default), then return the raw unitless waveform data. If `False` then attempt to convert the raw data for each channel to the quantity specified by the corresponding (003A,0210) Channel Sensitivity unit.

  Returns:

    The waveform data for a multiplex group as an `ndarray` with shape (samples, channels).

  Return type:

    np.ndarray