katgpucbf.xbgpu.beamform module

Implement the calculations for beamforming.

class katgpucbf.xbgpu.beamform.Beam(pol: int, dither: DitherType)[source]

Bases: object

Compile-time parameters for a single-polarisation beam.

dither: DitherType

The type of dithering to apply before quantisation.

pol: int

Either 0 or 1, to indicate which input polarisation to use in the beam.

class katgpucbf.xbgpu.beamform.Beamform(template: BeamformTemplate, command_queue: AbstractCommandQueue, n_batches: int, n_ants: int, n_channels_per_substream: int, seed: int, sequence_first: int, sequence_step: int = 1)[source]

Bases: Operation

Operation for beamforming.

For ease-of-use with the data formats used in the rest of katgpucbf, time is split into two dimensions: a coarse outer dimension (called “batches”) and a finer inner dimension (“spectra”).

Slots

inn_batches × n_ants × n_channels_per_substream × n_spectra_per_batch × N_POLS × COMPLEX, int8

Complex (Gaussian integer) input channelised voltages

outn_batches × n_beams × n_channels_per_substream × n_spectra_per_batch × COMPLEX, int8

Complex (Gaussian integer) output channelised voltages

saturated: n_beams, uint32

Number of saturated output values, per beam. This value is incremented by the kernel, so should be explicitly zeroed first if desired.

weightsn_ants × n_beams, complex64

Complex scale factor to apply to each antenna for each beam

delaysn_ants × n_beams, float32

Delay used to compute channel-dependent phase rotation. The rotation applied is \(e^{j\pi cd}\) where \(c\) is the channel number and \(d\) is the delay value. Note that this will not apply any rotation to the first channel in the data; any such rotation needs to be baked into weights.

rand_statesn_batches × n_channels_per_substream × n_spectra_per_batch, randState_t (packed)

Independent random states for generating dither values. This is set up by the constructor and should not normally need to be touched. It is only present if dithering is enabled on at least one beam.

Parameters:
  • template – The template for the operation

  • command_queue – The command queue on which to enqueue the work

  • n_batches – Number of batches (coarse time dimension)

  • n_ants – Number of antennas

  • n_channels_per_substream – Number of frequency channels

  • seed – See RandomStateBuilder. These are ignored if the template disables dithering.

  • sequence_first – See RandomStateBuilder. These are ignored if the template disables dithering.

  • sequence_step – See RandomStateBuilder. These are ignored if the template disables dithering.

class katgpucbf.xbgpu.beamform.BeamformTemplate(context: AbstractContext, beams: Sequence[Beam], n_spectra_per_batch: int)[source]

Bases: object

Template for beamforming.

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

  • beams – One entry per single-polarisation output beam.

  • n_spectra_per_batch – Number of samples in time axis for each batch (fine time dimension) - see Beamform.

  • dither – One entry per single-polarisation output beam. Each entry indicates the type of dithering to apply before quantisation.

instantiate(command_queue: AbstractCommandQueue, n_batches: int, n_ants: int, n_channels_per_substream: int, seed: int, sequence_first: int, sequence_step: int = 1) Beamform[source]

Generate a Beamform object based on the template.