katgpucbf.fgpu.ddc module

Digital down-conversion.

class katgpucbf.fgpu.ddc.DDC(template: DDCTemplate, command_queue: AbstractCommandQueue, samples: int, n_pols: int)[source]

Bases: Operation

Operation implementating DDCTemplate.

The kernel takes 10-bit integer inputs (real) and produces 32-bit floating-point outputs (complex). The user provides a real-valued FIR baseband filter and a mixer frequency for translating the signal from the desired band to baseband.

Element j of the output contains the dot product of weights with elements \(dj, d(j+1), \ldots, d(j+taps-1)\) of the mixed signal. The mixed signal is the product of sample \(j\) of the input with \(e^{2\pi i (aj + b)}\), where \(a\) is the mix_frequency argument to configure() and \(b\) is the (settable) mix_phase property.

Slots

insamples * input_sample_bits // BYTE_BITS, uint8

Input digitiser samples in a big chunk.

outout_samples, complex64

Filtered and subsampled output data

Raises:

ValueError – If samples is not a multiple of 8, or is less than template.taps

Parameters:
  • template – Template for the PFB-FIR operation.

  • command_queue – The GPU command queue

  • samples – Number of input samples to store, per polarisation

  • n_pols – Number of polarisations

configure(mix_frequency: Fraction, weights: ndarray) None[source]

Set the mixer frequency and filter weights.

This is a somewhat expensive operation, as it computes lookup tables and transfers them to the device synchronously. It is only intended to be used at startup rather than continuously.

property mix_frequency: Fraction

Mixer frequency in cycles per ADC sample.

class katgpucbf.fgpu.ddc.DDCTemplate(context: AbstractContext, taps: int, subsampling: int, input_sample_bits: int, tuning: _TuningDict | None = None)[source]

Bases: object

Template for digital down-conversion.

See DDC for a more detailed description of what it does.

Parameters:
  • context – The GPU context that we’ll operate in

  • taps – Number of taps in the FIR filter

  • subsampling – Fraction of samples to retain after filtering

  • input_sample_bits – Bits per input sample

classmethod autotune(context: AbstractContext, taps: int, subsampling: int, input_sample_bits: int) _TuningDict[source]

Determine tuning parameters.

autotune_version = 3
instantiate(command_queue: AbstractCommandQueue, samples: int, n_pols: int) DDC[source]

Generate a DDC object based on the template.

static unroll_align(subsampling: int, input_sample_bits: int) int[source]

Determine the factor that must divide into unroll.