primary_beam_cuda

API documentation for primary_beam_cuda.cu.

Device methods to calculate perfect Gaussian and Analytic Dipole primary beam responses. Currently, the analytic dipole is fixed to being an MWA dipole. Both models assume there is no leakage and beams are purely real.

Functions

__device__ void twoD_Gaussian(float x, float y, float xo, float yo, float sigma_x, float sigma_y, float cos_theta, float sin_theta, float *d_beam_real, float *d_beam_imag)

Calculate a two dimensional Gaussian.

Returns the Gaussian as defined on Wikipedia here via the equation:

\[ G(x,y) = \exp \left( -\left( a(x-x_o)^2 + 2b(x-x_o)(y-y_o) + c(y-y_o)^2 \right) \right) \]

where

\[\begin{split}\begin{eqnarray*} a &=& \frac{\cos(\theta)^2}{2\sigma_x^2} + \frac{\sin(\theta)^2}{2\sigma_y^2} \\ b &=& -\frac{\sin(2\theta)}{4\sigma_x^2} + \frac{\sin(2\theta)}{4\sigma_y^2} \\ c &=& \frac{\sin(\theta)^2}{2\sigma_x^2} + \frac{\cos(\theta)^2}{2\sigma_y^2} \end{eqnarray*}\end{split}\]

with \((x_0,y_0)\) the central coordinates, \((\sigma_x,\sigma_y)\) the standard deviations.

Parameters
  • x[in] x coordinate

  • y[in] y coordinate

  • xo[in] Central x coordinate

  • yo[in] Central y coordinate

  • sigma_x[in] Square root of variance in x

  • sigma_y[in] Square root of variance in x

  • cos_theta[in] Cosine of the rotation angle

  • sin_theta[in] Sine of the rotation angle

  • *d_beam_real[inout] Real part of the Gaussian repsonse

  • *d_beam_imag[inout] Imaginary part of the Gaussian reponse

__global__ void kern_gaussian_beam(float *d_beam_ls, float *d_beam_ms, float beam_ref_freq, float *d_freqs, float fwhm_lm, float cos_theta, float sin_theta, float sin_2theta, int num_freqs, int num_times, int num_components, cuFloatComplex *d_primay_beam_J00, cuFloatComplex *d_primay_beam_J11)

Kernel to calculate a Gaussian primary beam response at the given interferometric sky \((l,m)\) coords and frequency.

The primary beam is to be calculated for each sky direction, each time step, and each frequency. The size of the beam repsonse on the sky changes with frequency, so need a reference frequency beam_ref_freq and full-width half-maximum (fwhm_lm, in \(l,m\) units) to scale the beam width with frequency. The Gaussian beam is held to point at a given az/za, so the sky positions to calculate in d_beam_ls, d_beam_ms should contain num_components*num_times values, as the COMPONENTs move through the beam with time. The outputs are stored in d_primay_beam_J00, d_primay_beam_J11, where 00 refers to the north-south polarisation, 11 the east-west polarisation, in order of time, frequency, COMPONENT.

When called with dim3 grid, threads, kernel should be called with both grid.x and grid.y defined, where:

  • grid.x * threads.x >= num_components * num_time_steps

  • grid.y * threads.y >= num_freqs

Parameters
  • *d_beam_ls[in] Array of \(l\) coords to calculate beam at

  • *d_beam_ms[in] Array pf \(m\) coords to calculate beam at

  • beam_ref_freq[in] Reference frequency at which the FWHM is applicable (Hz)

  • *d_freqs[in] Array of frequencies to calculate beam at (Hz)

  • fwhm_lm[in] FWHM of the beam in \(l,m\) coords

  • cos_theta[in] Cosine of the rotation angle

  • sin_theta[in] Sine of the rotation angle

  • sin_2theta[in] Sine of two times the rotation angle

  • num_freqs[in] Number of frequencies being calculated

  • num_times[in] Number of time steps being calculated

  • num_components[in] Number of COMPONENTS the beam is calculated for

  • *d_primay_beam_J00[inout] Device array to store the beam Jones complex J[0,0] response in

  • *d_primay_beam_J11[inout] Device array to store the beam Jones complex J[1,1] response in

void calculate_gaussian_beam(int num_components, int num_time_steps, int num_freqs, float ha0, float sdec0, float cdec0, float fwhm_lm, float cos_theta, float sin_theta, float sin_2theta, float beam_ref_freq, float *d_freqs, float *beam_has, float *beam_decs, cuFloatComplex *d_primay_beam_J00, cuFloatComplex *d_primay_beam_J11)

Calculate the Gaussian primary beam response at the given hour angle and declinations beam_point_has, beam_point_decs. Note the XX and YY repsonses are equal in this toy example.

The primary beam is to be calculated for each sky direction, each time step, and each frequency. The size of the beam repsonse on the sky changes with frequency, so need a reference frequency beam_ref_freq and full-width half-maximum (fwhm_lm, in \(l,m\) units) to scale the beam width with frequency. The Gaussian beam is held to point at a given az/za, so the sky positions to calculate in d_beam_ls, d_beam_ms should contain num_components*num_times values, as the COMPONENTs move through the beam with time. The outputs are stored in d_primay_beam_J00, d_primay_beam_J11, where 00 refers to the north-south polarisation, 11 the east-west polarisation, in order of time, frequency, COMPONENT. This function uses the beam centre pointing ha0, dec0 to calculate an \(l,m\) coord system in which to calculate the Gaussian beam, using kern_gaussian_beam.

Parameters
  • num_components[in] Number of COMPONENTS the beam is calculated for

  • num_time_steps[in] Number of time steps being calculated

  • num_freqs[in] Number of frequencies being calculated

  • ha0[in] Hour angle of beam pointing centre (radians)

  • sdec0[in] Sine of Declination of the beam pointing centre (radians)

  • cdec0[in] Cosine of Declination of the beam pointing centre (radians)

  • fwhm_lm[in] FWHM of the beam in \(l,m\) coords

  • cos_theta[in] Cosine of the rotation angle

  • sin_theta[in] Sine of the rotation angle

  • sin_2theta[in] Sine of two times the rotation angle

  • beam_ref_freq[in] Reference frequency at which the FWHM is applicable (Hz)

  • *d_freqs[in] Array of frequencies to calculate beam at (Hz)

  • *beam_has[in] Array of Hour Angles to calculate the beam toward

  • *beam_decs[in] Array of Declinations to calculate the beam toward

  • *d_primay_beam_J00[inout] Device array to store the beam Jones complex J[0,0] response in

  • *d_primay_beam_J11[inout] Device array to store the beam Jones complex J[1,1] response in

__device__ void analytic_dipole(float az, float za, float wavelength, cuFloatComplex *d_beam_X, cuFloatComplex *d_beam_Y)

Calculate the beam response of a north-south (X) and east-west (Y) analytic dipole on an infinite ground screen, for the given sky direciton az,za and wavelength.

Dipoles are assumed to be MWA, and given a length of 0.3 metres. Beam size on the sky scales with frequency hence the need for wavelength

Parameters
  • az[in] Azimuth (radians)

  • za[in] Zenith Angle (radians)

  • wavelength[in] Wavelength (metres)

  • d_beam_X[inout] Complex beam value for north-south dipole

  • d_beam_Y[inout] Complex beam value for east-west dipole

__global__ void kern_analytic_dipole_beam(float *d_azs, float *d_zas, float *d_freqs, int num_freqs, int num_times, int num_components, cuFloatComplex *d_primay_beam_J00, cuFloatComplex *d_primay_beam_J11)

Kernel to calculate an Analytic MWA Dipole over an infinite ground screen at the given Azimuth and Zenith Angles d_azs, d_zas and frequencies d_freqs.

The primary beam is to be calculated for each sky direction, each time step, and each frequency. The Analytic dipole beam is stationary on the sky, so the Azimuth and Zenith Angles in azs,zas should contain num_components*num_times values, as the COMPONENTs move through the beam with time. The outputs are stored in d_primay_beam_J00, d_primay_beam_J11, where 00 refers to the north-south polarisation, 11 the east-west polarisation, in order of time, frequency, COMPONENT. Beam outputs are normalised to zenith

When called with dim3 grid, threads, kernel should be called with both grid.x and grid.y defined, where:

  • grid.x * threads.x >= num_components * num_time_steps

  • grid.y * threads.y >= num_freqs

Todo:

Make the zenith normalisation an option

Parameters
  • *d_azs[in] Array of Azimuth angles to calculate the beam towards (radians)

  • *d_zas[in] Array of Zenith Angles to calculate the beam towards (radians)

  • *d_freqs[in] Array of frequencies to calculate beam at (Hz)

  • num_freqs[in] Number of frequencies being calculated

  • num_times[in] Number of time steps being calculated

  • num_components[in] Number of COMPONENTS the beam is calculated for

  • *d_primay_beam_J00[inout] Device array to store the beam Jones complex J[0,0] response in

  • *d_primay_beam_J11[inout] Device array to store the beam Jones complex J[1,1] response in

void calculate_analytic_dipole_beam(int num_components, int num_time_steps, int num_freqs, float *azs, float *zas, float *d_freqs, cuFloatComplex *d_primay_beam_J00, cuFloatComplex *d_primay_beam_J11)

Calculate the Analytic Dipole over an infinite ground screen primary beam response at the given Azimuth and Zenith Angles azs,zas, and frequencies d_freqs.

The primary beam is to be calculated for each sky direction, each time step, and each frequency. The Analytic dipole beam is stationary on the sky, so the Azimuth and Zenith Angles in azs,zas should contain num_components*num_times values, as the COMPONENTs move through the beam with time. The outputs are stored in d_primay_beam_J00, d_primay_beam_J11, where 00 refers to the north-south polarisation, 11 the east-west polarisation, in order of time, frequency, COMPONENT. Beam outputs are normalised to zenith. Note eveything starting with d_ should be in device memory.

When called with dim3 grid, threads, kernel should be called with both grid.x and grid.y defined, where:

  • grid.x * threads.x >= num_components * num_time_steps

  • grid.y * threads.y >= num_freqs

Parameters
  • num_components[in] Number of COMPONENTS the beam is calculated for

  • num_time_steps[in] Number of time steps being calculated

  • num_freqs[in] Number of frequencies being calculated

  • *d_freqs[in] Array of frequencies to calculate beam at (Hz)

  • *azs[in] Array of Azimuth angles to calculate the beam towards (radians)

  • *zas[in] Array of Zenith Angles to calculate the beam towards (radians)

  • *d_primay_beam_J00[inout] Device array to store the beam Jones complex J[0,0] response in

  • *d_primay_beam_J11[inout] Device array to store the beam Jones complex J[1,1] response in