Signal Processing¶
- genalyzer.downsample(a, ratio, interleaved=False)¶
Downsample a waveform
- Args:
a
(ndarray
) : Input array of typecomplex128
,int16
,int32
, orint64
ratio
(int
) : Downsample ratiointerleaved
(double
) : If true,a
is interleaved I/Q data- Returns:
out
(ndarray
) :float64
,int16
,int32
, orint64
numpy
array consisting of downsampled waveform
- genalyzer.fshift(a, *args)¶
Perform frequency shift
- Args:
a
(ndarray
) : Input array of typecomplex128
,float64
,int16
,int32
, orint64
args
(list
)Additional argumentsIf
a
is of typecomplex128
orfloat64
, then perform frequency shift of interleaved normalized samples with the following interpretation.fs
(double
) : Sample ratefshift_
(double
) : Shift frequencyIn this case, if
a
is not complex, then a is interpreted to contain interleaved I/Q samples.If
a
is of typefloat64
, then perform frequency shift of split normalized samples.q
(float64
) : Quadrature componentfs
(double
) : Sample ratefshift_
(double
) : Shift frequencyIn this case,
a
is interpreted to be the In-phase component.If
a
is of typeint16
,int32
, orint64
, then perform frequency shift of interleaved quantized samples with the following interpretation.n
(int
) : Resolution (Bitwidth of a)fs
(double
) : Sample ratefshift_
(double
) : Shift frequencyfmt
(CodeFormat
): Code formatIn this case,
a
is interpreted to contain interleaved quantized samples.If
a
is of typeint16
,int32
, orint64
, then perform frequency shift of split quantized samples with the following interpretation.q
(int16
,int32
, orint64
) : Quadrature componentn
(int
) : Resolution (Bitwidth ofa
)fs
(double
) : Sample ratefshift_
(double
) : Shift frequencyfmt
(CodeFormat
): Code formatIn this case,
a
is interpreted to to be the In-phase component.
- Returns:
out
(ndarray
) : Frequency-shifted input waveform. The output datatype is the same as the input datatype.
- genalyzer.normalize(a, n, fmt=CodeFormat.TWOS_COMPLEMENT)¶
Normalize a waveform
- Args:
a
(ndarray
) : Input array of typeint16
,int32
, orint64
n
(int
) : Resolution (Bitwidth ofa
)fmt
(CodeFormat
): Code format- Returns:
out
(ndarray
) :float64
numpy
array consisting of normalized input waveform
- genalyzer.polyval(a, c)¶
Apply distortion as a polynomial function
- Args:
a
(ndarray
) : Input array of typefloat64
c
(ndarray
) : Polynomial coefficient array of typefloat64
- Returns:
out
(ndarray
) :float64
numpy
array consisting of distorted input waveform
- genalyzer.quantize16(a, fsr, n, noise=0.0, fmt=CodeFormat.TWOS_COMPLEMENT)¶
Quantize a floating-point waveform
- Args:
a
(ndarray
) : Input array of typefloat64
fsr
(double
) : Full-scale range of the waveformn
(int
) : Resolution (Bitwidth ofa
)noise
(double
) : Quantization Noise RMS levelfmt
(CodeFormat
): Code format- Returns:
out
(ndarray
) :int16
numpy
array consisting of quantized input waveform
- genalyzer.quantize32(a, fsr, n, noise=0.0, fmt=CodeFormat.TWOS_COMPLEMENT)¶
Quantize a floating-point waveform
- Args:
a
(ndarray
) : Input array of typefloat64
fsr
(double
) : Full-scale range of the waveformn
(int
) : Resolution (Bitwidth ofa
)noise
(double
) : Quantization Noise RMS levelfmt
(CodeFormat
): Code format- Returns:
out
(ndarray
) :int32
numpy
array consisting of quantized input waveform
- genalyzer.quantize64(a, fsr, n, noise=0.0, fmt=CodeFormat.TWOS_COMPLEMENT)¶
Quantize a floating-point waveform
- Args:
a
(ndarray
) : Input array of typefloat64
fsr
(double
) : Full-scale range of the waveformn
(int
) : Resolution (Bitwidth ofa
)noise
(double
) : Quantization Noise RMS levelfmt
(CodeFormat
): Code format- Returns:
out
(ndarray
) :int64
numpy
array consisting of quantized input waveform
- genalyzer.quantize(a, fsr, n, noise=0.0, fmt=CodeFormat.TWOS_COMPLEMENT)¶
Quantize a floating-point waveform
- Args:
a
(ndarray
) : Input array of typefloat64
fsr
(double
) : Full-scale range of the waveformn
(int
) : Resolution (Bitwidth ofa
)noise
(double
) : Quantization Noise RMS levelfmt
(CodeFormat
): Code format- Returns:
out
(ndarray
) :numpy
array consisting of quantized input waveform of datatypeint16
ifn <= 16
,int32
otherwise