comnum.dac#

comnum.dac(x, bits, *, fs=1.0, full_scale=None, loading=None, hold=1, bandwidth_hz=None)#

A digital-to-analogue converter: a uniform mid-rise quantiser of bits bits on the in-phase and quadrature components, a zero-order hold of hold output samples per input sample, then the analogue bandwidth (Gaussian, 3 dB at bandwidth_hz).

Parameters:
  • x (array_like) – the digital samples (complex).

  • bits (int) – resolution N.

  • fs (float) – input sampling rate (Hz); the output is at hold × fs.

  • full_scale (float, optional) – the full scale of each dimension.

  • loading (float, optional) – without full_scale, the full scale in RMS values of one dimension of x (optimal_loading by default).

  • hold (int) – output samples per input sample.

  • bandwidth_hz (float, optional) – 3 dB bandwidth of the output (Hz).

Returns:

the analogue signal (complex128), hold × len(x) samples.

Return type:

numpy.ndarray

Raises:

ValueError – for an invalid parameter or input (the message names it).

Examples

>>> import comnum, numpy as np
>>> comnum.dac(np.array([0.3 + 0.0j]), 3, full_scale=1.0, hold=2).real.tolist()
[0.375, 0.375]