Closed MattCarrickPL closed 1 month ago
The quantize() function computes the maximum quantization based on the magnitude of a complex number but quantizes against real and imaginary independently.
max_value = max(np.abs(tensor)) + 1e-9 bins = np.linspace(-max_value, max_value, num_levels + 1) # Digitize to bins quantized_real = np.digitize(tensor.real, bins) quantized_imag = np.digitize(tensor.imag, bins)
https://github.com/TorchDSP/torchsig/blob/v0.4.2/torchsig/transforms/functional.py#L1029
The solution is to compute the max of real and imaginary independently, then take the max of their max, ex:
max_value = max( np.abs(np.real(tensor)), np.abs(np.imag(tensor)) )
Old issue, closing.
The quantize() function computes the maximum quantization based on the magnitude of a complex number but quantizes against real and imaginary independently.
https://github.com/TorchDSP/torchsig/blob/v0.4.2/torchsig/transforms/functional.py#L1029
The solution is to compute the max of real and imaginary independently, then take the max of their max, ex: