Analog Digital Converter¶
- class AnalogDigitalConverter(num_quantization_bits=None, gain=None, quantizer_type=QuantizerType.MID_RISER)[source]¶
Bases:
Serializable
Implements an ADC (analog-to-digital converter)
Models the behaviour of an ADC, including: - Sampling Jitter (to be implemented) - Automatic Gain Control - Quantization. Currently only uniform and symmetric quantization is supported.
This class only implements the quantization noise, the output data is still in floating point representation with the same amplitude as the input.
- Parameters:
num_quantization_bits (int, optional) – ADC resolution in bits. Default is infinite resolution (no quantization)
gain (Gain, optional) – Amplitude gain control at ADC input. Default is Gain(1.0), i.e., no gain.
quantizer_type (QuantizerType, optional) – Determines quantizer behaviour at zero. Default is QuantizerType.MID_RISER.
- convert(input_signal, frame_duration=0.0)[source]¶
Converts an analog signal into a digitally quantized signal.
- Parameters:
- Return type:
Returns: Gain adjusted and quantized signal.
- plot_quantizer(input_samples=None, label='', fig_axes=None)[source]¶
Plot the quantizer characteristics.
Generates a matplotlib plot depicting the staircase amplitude response. Note that only the real part is plotted, as the quantizer is applied separately in the real and imaginary parts.
- Parameters:
input_samples (numpy.ndarray, optional) – Sample points at which to evaluate the characteristics, i.e., the x-axis of the resulting characteristics plot. It should be a sorted number sequence.
label (str, optional) – A label describing the desired plot.
fig_axes (Optional[plt.axes], optional) – Axes to which to plot the charateristics. By default, a new figure is created.
- Return type:
- gain: Gain¶
- property num_quantization_bits: int | None¶
Quantization resolution in bits
- Returns:
Bit resolution, None if no quantization is applied.
- Raises:
ValueError – If resolution is less than zero.
- property num_quantization_levels: float¶
Number of quantization levels
- Returns:
Number of levels
- Return type:
- property quantizer_type: QuantizerType¶
Type of quantizer
- QuantizationType.MID_TREAD: 0 can be the output of a quantization step. Since the number of quantization step
must be even, negative values will have one step more than positive values
- QuantizerType.MID_RISE: input values around zero are quantized as either -delta/2 or delta/2, with delta the
quantization step
- Returns:
type of quantizer
- Return type:
- yaml_tag: Optional[str] = 'ADC'¶
YAML serialization tag