torchsig.transforms.functional.quantize

torchsig.transforms.functional.quantize(data: ndarray, num_bits: int, ref_level_adjustment_db: float = 0.0, rounding_mode: str = 'floor') ndarray[source]

Quantize input to number of levels specified.

This function quantizes the input data to a specified number of bits, with options for reference level adjustment and rounding mode.

Default implementation is ceiling.

Parameters:
  • data – IQ data.

  • num_bits – Number of bits to simulate.

  • ref_level_adjustment_db – Changes the relative scaling of the input. For example, ref_level_adjustment_db = 3.0, the average power is now 3 dB above full scale and into saturation. For ref_level_adjustment_db = -3.0, the average power is now 3 dB below full scale and simulates a loss of dynamic range. Default is 0.

  • rounding_mode – Represents either rounding to ‘floor’ or ‘ceiling’. Default is ‘floor’.

Raises:
Returns:

Quantized IQ data.