FEE_primary_beam_cuda¶
The MWA Fully Embedded Element primary beam model (Sokolowski et al. 2017) is
at the time of writing the most accurate and advanced MWA primary beam model.
The model is stored in spherical harmonic coefficients, at a frequency
resolution of 1.28MHz, in an hdf5 file called
mwa_full_embedded_element_pattern.h5. I have done my best to document the RTS
code I have used. The RTS code makes use of the Legendre Polynomial code
available here by John Burkardt, and is included in the WODEN distribution
as legendre_polynomial.c.
Device methods to calculate the MWA FEE primary beam response
- Author
J.L.B. Line
Functions
-
void copy_FEE_primary_beam_to_GPU(RTS_MWA_FEE_beam_t *FEE_beam)¶
Copy the spherical harmonic MWA FEE coeffs from host to device.
Copies
FEE_beam->M,FEE_beam->N,FEE_beam->Q1,FEE_beam->Q2intoFEE_beam->d_M,FEE_beam->d_N,FEE_beam->d_Q1,FEE_beam->d_Q2, reshaping from 2D arrays into 1D arrays.- Parameters
*FEE_beam – [inout]
RTS_MWA_FEE_beam_twhich has been initialised withFEE_primary_beam.RTS_MWAFEEInit
-
__device__ void RTS_CUDA_pm_polynomial_value_single(int n, int m, user_precision_t x, user_precision_t *values)¶
RTS GPU implemtation of John Burkardt’s
legendre_polynomial.pm_polynomial_value. Evaluates all legendre polynomials up to the specified orders, for a single evaluation pointx. Original documentation frompm_polynomial_valueincluded below.Note the original function evaluated for mulitple
xvales, so needed a number of evalutation pointsmm, which is set to 1.0 in this RTS GPU code.Purpose:
PM_POLYNOMIAL_VALUE evaluates the Legendre polynomials Pm(n,m,x).
Differential equation:
(1-X*X) * Y’’ - 2 * X * Y + ( N (N+1) - (M*M/(1-X*X)) * Y = 0
First terms:
M = 0 ( = Legendre polynomials of first kind P(N,X) )
Pm(0,0,x) = 1 Pm(1,0,x) = 1 X Pm(2,0,x) = ( 3 X^2 - 1)/2 Pm(3,0,x) = ( 5 X^3 - 3 X)/2 Pm(4,0,x) = ( 35 X^4 - 30 X^2 + 3)/8 Pm(5,0,x) = ( 63 X^5 - 70 X^3 + 15 X)/8 Pm(6,0,x) = (231 X^6 - 315 X^4 + 105 X^2 - 5)/16 Pm(7,0,x) = (429 X^7 - 693 X^5 + 315 X^3 - 35 X)/16
M = 1
Pm(0,1,x) = 0 Pm(1,1,x) = 1 * SQRT(1-X^2) Pm(2,1,x) = 3 * SQRT(1-X^2) * X Pm(3,1,x) = 1.5 * SQRT(1-X^2) * (5*X^2-1) Pm(4,1,x) = 2.5 * SQRT(1-X^2) * (7*X^3-3*X)
M = 2
Pm(0,2,x) = 0 Pm(1,2,x) = 0 Pm(2,2,x) = 3 * (1-X^2) Pm(3,2,x) = 15 * (1-X^2) * X Pm(4,2,x) = 7.5 * (1-X^2) * (7*X^2-1)
M = 3
Pm(0,3,x) = 0 Pm(1,3,x) = 0 Pm(2,3,x) = 0 Pm(3,3,x) = 15 * (1-X^2)^1.5 Pm(4,3,x) = 105 * (1-X^2)^1.5 * X
M = 4
Pm(0,4,x) = 0 Pm(1,4,x) = 0 Pm(2,4,x) = 0 Pm(3,4,x) = 0 Pm(4,4,x) = 105 * (1-X^2)^2
Recursion:
if N < M: Pm(N,M,x) = 0 if N = M: Pm(N,M,x) = (2*M-1)!! * (1-X*X)^(M/2) where N!! means the product of all the odd integers less than or equal to N. if N = M+1: Pm(N,M,x) = X*(2*M+1)*Pm(M,M,x) if M+1 < N: Pm(N,M,x) = ( X*(2*N-1)*Pm(N-1,M,x) - (N+M-1)*Pm(N-2,M,x) )/(N-M)
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
08 August 2013
Author:
John Burkardt
Reference:
Milton Abramowitz, Irene Stegun, Handbook of Mathematical Functions, National Bureau of Standards, 1964, ISBN: 0-486-61272-4, LC: QA47.A34.
Parameters:
Input, int MM, the number of evaluation points.
Input, int N, the maximum first index of the Legendre function, which must be at least 0.
Input, int M, the second index of the Legendre function, which must be at least 0, and no greater than N.
Input, double X[MM], the point at which the function is to be evaluated.
Output, double PM_POLYNOMIAL_VALUE[MM*(N+1)], the function values.
- Parameters
n – [in] The maximum first index of the Legendre function, which must be at least 0
m – [in] The second index of the Legendre function,which must be at least 0, and no greater than N
x – [in] The point at which the function is to be evaluated
values – [inout] Array to store calculated function values within
-
__global__ void RTS_P1SINfKernel(user_precision_t *d_theta, cuFloatComplex *rts_P_sin, cuFloatComplex *rts_p1, int nmax, int num_coords)¶
This grabs a legendre polynomial value for a
thetavalue ind_thetaand a given order, and inserts the output intorts_p1, and the output /sin(theta)intorts_P_sin.The outputs are scaled correctly for the FEE model resolution, and dumped into
rts_p1,rts_P_sinin order ofthetavalue first, order of legendre polynomial second.rts_p1andrts_P_sinshould benum_coords*(nmax*nmax + 2*nmax)long.When called with
dim3 grid, threads, kernel should be called with bothgrid.xandgrid.ydefined, where:grid.x * threads.x >=
num_coordsgrid.y * threads.y >=
nmax*nmax + 2*nmax
- Parameters
d_theta – [in] Array of theta values (radians)
rts_P_sin – [inout] Output array to store l. poly. value / sin(theta) in
rts_p1 – [inout] Output array to store l. poly. value in
nmax – [in] Maximum order of legendre polynomial to calculate to
num_coords – [in] Number of theta coords
-
__global__ void RTS_getTileGainsKernel(user_precision_t *d_phi, user_precision_t *d_theta, int nMN, int num_coords, user_precision_t *pb_M, user_precision_t *pb_N, cuFloatComplex *pb_Q1, cuFloatComplex *pb_Q2, cuFloatComplex *rts_P_sin, cuFloatComplex *rts_P1, cuFloatComplex *emn_T, cuFloatComplex *emn_P)¶
This kernel grabs all the FEE beam coeffs and generated legendre polynomial values, combines them to get the spherical harmonic values for all available orders, and converts them into complex field values.
pb_M,pb_N,pb_Q1,pb_Q2should have been calculated usingFEE_primary_beam.RTS_MWAFEEInitand transferred to the device usingFEE_primary_beam_cuda.copy_FEE_primary_beam_to_GPU.rts_P_sin,rts_p1and should have been calculated usingFEE_primary_beam_cuda.RTS_P1SINfKernel. The output arraysemn_T,emn_Pcontain the theta and phi polarisation outputs for both the north-south and east-west dipoles, and contain separate values for all spherical harmonic values, and so contain2*num_coords*nMNvalues.When called with
dim3 grid, threads, kernel should be called with allgrid.x,grid.y, andgrid.zdefined, where:grid.x * threads.x >=
num_coordsgrid.y * threads.y >=
nMNgrid.z * threads.z >= 2 (number of polarisations)
- Parameters
d_phi – [in] Array of phi values (radians) (these are azimuth values)
d_theta – [in] Array of theta values (radians) (these are zenith angles)
nMN – [in] Total number of legendre polynomial values to be used (if
nmaxis the maximum order to use,nMN = nmax*nmax + 2*nmax)num_coords – [in] Number of theta/phi coords
pb_M – [in] Precalculated FEE beam params
pb_N – [in] Precalculated FEE beam params
pb_Q1 – [in] Precalculated FEE beam params
pb_Q2 – [in] Precalculated FEE beam params
rts_P_sin – [in] Calculated l. poly. value / sin(theta)
rts_P1 – [in] Calculated l. poly. value in
emn_T – [inout] Complex theta polarisation output for all sky coords, still separated by order of spherical harmonic
emn_P – [inout] Complex phi polarisation output for all sky coords, still separated by order of spherical harmonic
-
__global__ void kern_sum_emn_PT_by_M(cuFloatComplex *emn_T, cuFloatComplex *emn_P, user_precision_t *d_emn_T_sum_real, user_precision_t *d_emn_T_sum_imag, user_precision_t *d_emn_P_sum_real, user_precision_t *d_emn_P_sum_imag, user_precision_t *d_m_range, user_precision_t *d_M, int nMN, int nmax, int num_coords)¶
This kernel takes comlex polarisation outputs of
RTS_getTileGainsKernel, which are separated by spherical harmonic order, and sums over the spherical harmonics, to return a single complex beam gain direction on sky.The summation happens over the
mindex of the spherical harmonic, and so we require an array containing the range of possiblemvalues (d_m_range) and an array that contains themvalue of all outputs inemn_T,emn_P(d_M), to ensure we are summing the correct values and not double counting anything.When called with
dim3 grid, threads, kernel should be called with allgrid.xandgrid.ydefined, where:grid.x * threads.x >=
num_coordsgrid.y * threads.y >=
2*nmax + 1
- Parameters
emn_T – [in] theta polarisation outputs of
RTS_getTileGainsKernelemn_P – [in] phi polarisation outputs of
RTS_getTileGainsKerneld_emn_T_sum_real – [inout] Real part of summed theta polarisation
d_emn_T_sum_imag – [inout] Imaginary part of summed theta polarisation
d_emn_P_sum_real – [inout] Real part of summed phi polarisation
d_emn_P_sum_imag – [inout] Imaginary part of summed phi polarisation
d_m_range – [in] All possible
mvalues (from -nmaxto +nmax)d_M – [in] The
mvalue corresponding to values inemn_T,emn_PnMN – [in] Total number of spherical harmonics,
nMN = nmax*nmax + 2*nmaxnmax – [in] Maximum order of spherical harmonic
num_coords – [in] Number of theta/phi coords
-
__global__ void kern_map_emn(cuFloatComplex *TileGainMatrices, user_precision_t *d_emn_T_sum_real, user_precision_t *d_emn_T_sum_imag, user_precision_t *d_emn_P_sum_real, user_precision_t *d_emn_P_sum_imag, int nmax, int num_coords)¶
This basically just maps the outputs of
kern_sum_emn_PT_by_Minto a single complex array, ordered by polarisation and dipole orientation, and then sky coordinate.The summation happens over the
mindex of the spherical harmonic, and so we require an array containing the range of possiblemvalues (d_m_range) and an array that contains themvalue of all outputs inemn_T,emn_P(d_M), to ensure we are summing the correct values and not double counting anything.Output ordering in
TileGainMatricesis ordered byJ_theta_x,J_phi_x,J_theta_y,J_phi_y(wheretheta,phiis polarisation,x,yare dipole orientation), and these four values are then repeated for each direction on the sky.When called with
dim3 grid, threads, kernel should be called withgrid.xandgrid.ydefined, where:grid.x * threads.x >=
num_coordsgrid.y * threads.y >=
2
- Parameters
TileGainMatrices – [in] A single 1D array that contains all complex beam gains for all polaristations, dipole orientations, and sky coords
d_emn_T_sum_real – [inout] Real part of summed theta polarisation
d_emn_T_sum_imag – [inout] Imaginary part of summed theta polarisation
d_emn_P_sum_real – [inout] Real part of summed phi polarisation
d_emn_P_sum_imag – [inout] Imaginary part of summed phi polarisation
nmax – [in] Maximum order of spherical harmonic
num_coords – [in] Number of sky direction coords
-
__global__ void kern_apply_FEE_norm(cuFloatComplex *TileGainMatrices, cuFloatComplex *d_norm_fac, int num_coords)¶
Normalises the complex beam gains in
TileGainMatricesto the zenith reponse of a zenith beam pointing,d_norm_fac. The latter array should have been calcuated usingFEE_primary_beam_cuda.get_HDFBeam_normalisation.This normalisation should be applied while the polarisations values in
TileGainMatricesare still tied to thephi,thetacoord system (i.e.) before any parallactic angle rotation).d_norm_facshould be an array of 4 values, appropriate to each polarisation inTileGainMatrices. The values ind_norm_facshould be the absolute value of the zenith gain, but input as auser_precision_complex_ttype (so just have imaginary set to zero).When called with
dim3 grid, threads, kernel should be called withgrid.xdefined, where:grid.x * threads.x >=
num_coords
- Parameters
TileGainMatrices – [in] A single 1D array that contains all complex beam gains for all polaristations, dipole orientations, and sky coords
d_norm_fac – [in] Normalisation factor for each polarisation
num_coords – [in] Number of sky direction coords
-
__global__ void kern_rotate_FEE_beam(cuFloatComplex *d_FEE_beam_gain_matrices, user_precision_t *d_sin_para_angs, user_precision_t *d_cos_para_angs, int num_coords)¶
Takes the beam gains in
d_FEE_beam_gain_matrices, which are intheta,phipolarisations, and rotates them by the parallactic angle, to align them into north-south and east-west gain and leakage terms, which can be used to create XX,XY,YX,YY polarisations.d_FEE_beam_gain_matricesshould be as output byFEE_primary_beam_cuda.kern_map_emn, ordered byJ_theta_x,J_phi_x,J_theta_y,J_phi_y(wheretheta,phiis polarisation,x,yare dipole orientation).d_sin_para_angsandd_cos_para_angsshould be the sine and cosine of the parallactic angle that corresponds to each sky direction ind_FEE_beam_gain_matrices, repectively. Once the rotation has been applied, the complex beam values are ordered asg_x, D_x, D_y, g_ywheregmeans gain,Dmeans leakage,xmeans dipole aligned north-south,yaligned east-west.The original FEE beam code has a different east-west / north-south convention, and the sense of azimuth rotation, and so a reordering / sign flip is applied here to match up with Stokes parameters.
When called with
dim3 grid, threads, kernel should be called withgrid.xdefined, where:grid.x * threads.x >=
num_coords
- Parameters
d_FEE_beam_gain_matrices – [inout] A single 1D array that contains all complex beam gains for all polaristations, dipole orientations, and sky coords
d_sin_para_angs – [in] Sine of the parallactic angle for all sky directions
d_cos_para_angs – [in] Cosine of the parallactic angle for all sky directions
num_coords – [in] Number of sky directions in
d_FEE_beam_gain_matrices
-
void RTS_CUDA_get_TileGains(user_precision_t *phi, user_precision_t *theta, user_precision_t *sin_para_angs, user_precision_t *cos_para_angs, int num_time_steps, int num_components, user_precision_t rotation, RTS_MWA_FEE_beam_t *primary_beam, user_precision_complex_t *TileGainMatrices, int scaling)¶
For the given
phi(azimuth) andtheta(zenith angle) sky coords, calculate the MWA FEE beam model response for all polarisation and dipole orientations, given the initialised beam modelprimary_beam. Optionally normalise the beam to zenith (scaling=1) and rotate into a frame compatible with Stokes parameters (rotation=1).primary_beamshould have been intialised usingFEE_primary_beam.RTS_MWAFEEInitandFEE_primary_beam_cuda.copy_FEE_primary_beam_to_GPU.If
scaling == 1, normalises the beam to zenith. For this,FEE_primary_beam_cuda.get_HDFBeam_normalisationshould have already be run to setup the correct attributes inprimary_beam.If
rotation == 1, rotate the beam gains from a instrument sky-lockedtheta,phipolarisation system into one aligned with Stokes parameters (for creatingXX, XY, YX, YYbeams that can be combined with Stokes I,Q,U,V to generate instrumental visibilities). For this,sin_para_angs,cos_para_angsmust be allocated.Calls the following kernels from
FEE_primary_beam_cuda. See their documentation for more detail.RTS_P1SINfKernelRTS_getTileGainsKernelkern_sum_emn_PT_by_Mkern_map_emnkern_apply_FEE_norm(optional)kern_rotate_FEE_beam(optional)
- Parameters
phi – [in] Array of phi values (radians) (these are azimuth values)
theta – [in] Array of theta values (radians) (these are zenith angles)
sin_para_angs – [in] Sine of the parallactic angle for all sky directions
cos_para_angs – [in] Cosine of the parallactic angle for all sky directions
num_time_steps – [in] Number of time steps in simulation
num_components – [in] Number of COMPONENTs being used here
rotation – [in] 0=False, 1=True, rotate results by parallactic angle
primary_beam – [in] An initialised
RTS_MWA_FEE_beam_tcontaining MWA FEE spherical harmonic coeffs for this pointingTileGainMatrices – [inout] A single 1D array that contains all complex beam gains for all polaristations, dipole orientations, and sky coords
scaling – [in] 0=False, 1=True, Normlise results to zenith
-
void calc_CUDA_FEE_beam(user_precision_t *azs, user_precision_t *zas, user_precision_t *sin_para_angs, user_precision_t *cos_para_angs, int num_components, int num_time_steps, RTS_MWA_FEE_beam_t *FEE_beam, int rotation, int scaling)¶
This function is basically a wrapper to
FEE_primary_beam_cuda.RTS_CUDA_get_TileGains, by cudaMalloc-ing an appropriate array to store the outputs in. If you want to call the MWA FEE beam, and only use the outputs in device memory, this is the function you want.This function cudaMallocs
FEE_beam->d_FEE_beam_gain_matricesand sets all array entries to zero, before passing intoRTS_CUDA_get_TileGains. SeeRTS_CUDA_get_TileGainsfor more detail.FEE_beamshould have been intialised usingFEE_primary_beam.RTS_MWAFEEInitandFEE_primary_beam_cuda.copy_FEE_primary_beam_to_GPU.If
scaling == 1, normalises the beam to zenith. For this,FEE_primary_beam_cuda.get_HDFBeam_normalisationshould have already be run to setup the correct attributes inprimary_beam.If
rotation == 1, rotate the beam gains from a instrument sky-lockedtheta,phipolarisation system into one aligned with Stokes parameters (for creatingXX, XY, YX, YYbeams that can be combined with Stokes I,Q,U,V to generate instrumental visibilities). For this,sin_para_angs,cos_para_angsmust be allocated.- Parameters
azs – [in] Array of azimuth values (radians)
zas – [in] Array of zenith angle values (radians)
sin_para_angs – [in] Sine of the parallactic angle for all az,za
cos_para_angs – [in] Cosine of the parallactic angle for all az,za
num_components – [in] Number of COMPONENTs being used here
num_time_steps – [in] Number of time steps in simulation
FEE_beam – [inout] An initialised
RTS_MWA_FEE_beam_tcontaining MWA FEE spherical harmonic coeffs for this pointingrotation – [in] 0=False, 1=True, rotate results by parallactic angle
scaling – [in] 0=False, 1=True, Normlise results to zenith
-
__global__ void kern_make_norm_abs(cuFloatComplex *d_norm_fac)¶
We want to normalise by the absolute value of the FEE primary beam, so take the absolute of the cuFloatComplex values in
d_norm_facBeam values to be normalised are stil cuFloatComplex, so easy to just keep
d_norm_facas a complex, and put the absolute value in the real and set imaginary to zero. There should be 16 values to normalise, as there are four az/za directions and four polarisations for eachWhen called with
dim3 grid, threads, kernel should be called withgrid.xset, where:grid.x * threads.x >= 16
- Parameters
d_norm_fac – [inout] Complex values to convert to absolute
-
void get_HDFBeam_normalisation(RTS_MWA_FEE_beam_t *FEE_beam_zenith, RTS_MWA_FEE_beam_t *FEE_beam)¶
Using
FEE_beam_zenith, calculate the zenith normlisation values for both dipoles and both polarisations in the native FEE beam coodinate system.The FEE beam model is stored in theta/phi (instrument locked) polarisations. To therefore calculate the zenith normalisation values, actually need to calculate the beam at zenith with multiple azimuth values, and then from those directions, select the correct east-west/north south dipole and theta/phi polarisation output.
This function copies the zenith beam to device, calculates normalistaion values by calling
copy_FEE_primary_beam_to_GPUcalc_CUDA_FEE_beamkern_make_norm_abs
and then inserts the correct normalisation values into
FEE_beam->norm_fac, which can be used later on bycalc_CUDA_FEE_beamwithscaling=1.Both
FEE_beam_zenithandFEE_beamshould have been initialised usingFEE_primary_beam.RTS_MWAFEEInit, with the former having all delays set to zero.- Parameters
FEE_beam_zenith – [in] An initialised
RTS_MWA_FEE_beam_twith zero delaysFEE_beam – [in] An initialised
RTS_MWA_FEE_beam_tof the same frequency in which to store the normalisation outputs for later use
-
__global__ void kern_map_FEE_beam_gains(cuUserComplex *d_FEE_beam_gain_matrices, cuUserComplex *d_primay_beam_J00, cuUserComplex *d_primay_beam_J01, cuUserComplex *d_primay_beam_J10, cuUserComplex *d_primay_beam_J11, int num_freqs, int num_components, int num_visis, int num_baselines, int num_times)¶
Map the RTS ordered FEE gain array in four separate arrays, each corresponding to a different element in the beam Jones matrix.
The visibility functions in
source_components.cuexpect the primary beam Jones matrix in four 1D cuFloatComplex arrays. This mapping should be done after rotation by parallatic angle, to be consistent with other primary beam functions in WODEN. The arrays map to the physical dipoles asd_primay_beam_J00: north-south gaind_primay_beam_J01: north-south leakaged_primay_beam_J10: east-west leakaged_primay_beam_J11: east-west gain
Within each array, the outputs are stored by time index (slowest changing), frequency index, then COMPONENT index (fastest changing). This is important to ensure visibility functions in
source_components.cugrab the correct values later on.When called with
dim3 grid, threads, kernel should be called with bothgrid.xandgrid.yset, where:grid.x * threads.x >=
num_visisgrid.y * threads.y >=
num_components
- Parameters
d_FEE_beam_gain_matrices – [in] A single 1D array that contains all complex beam gains for all polaristations, dipole orientations, and sky coords, as output by
calc_CUDA_FEE_beamd_primay_beam_J00 – [inout] Array to store north-south gain on device memory
d_primay_beam_J01 – [inout] Array to store north-south leakage on device memory
d_primay_beam_J10 – [inout] Array to store east-west leakage on device memory
d_primay_beam_J11 – [inout] Array to store east-west gain on device memory
num_freqs – [in] Number of frequencies
num_components – [in] Number of COMPONENTs
num_visis – [in] Total number of visibilities (
num_freqs*num_baselines*num_times)num_baselines – [in] Number of baselines in the array
num_times – [in] Number of times steps
-
void free_FEE_primary_beam_from_GPU(RTS_MWA_FEE_beam_t *primary_beam)¶
Frees device memory from
primary_beamExplicitly, cudaFrees:
primary_beam->d_Mprimary_beam->d_Nprimary_beam->d_Q1primary_beam->d_Q2
- Parameters
primary_beam – [in] A
RTS_MWA_FEE_beam_twhich has already been used on the device to calculate MWA FEE beam values
-
void test_RTS_CUDA_FEE_beam(int num_components, user_precision_t *azs, user_precision_t *zas, double latitude, RTS_MWA_FEE_beam_t *FEE_beam_zenith, RTS_MWA_FEE_beam_t *FEE_beam, int rotation, int scaling, user_precision_complex_t *FEE_beam_gains)¶
This function is basically a host wrapper to
FEE_primary_beam_cuda.calc_CUDA_FEE_beam, by copying the resultantFEE_beam->d_FEE_beam_gain_matricesinto host memory. It also calculates the normlisation factors. If you want to run the MWA FEE beam code on the GPU and copy outputs onto the CPU, this is the function you want.Both
FEE_beam_zenithandFEE_beamshould have been initialised usingFEE_primary_beam.RTS_MWAFEEInit, with the former having all delays set to zero.If
scaling == 1, normalises the beam to zenith. For this,FEE_primary_beam_cuda.get_HDFBeam_normalisationshould have already be run to setup the correct attributes inprimary_beam.If
rotation == 1, rotate the beam gains from a instrument sky-lockedtheta,phipolarisation system into one aligned with Stokes parameters (for creatingXX, XY, YX, YYbeams that can be combined with Stokes I,Q,U,V to generate instrumental visibilities). For this,sin_para_angs,cos_para_angsmust be allocated.- Parameters
num_components – [in] Number of azimuth and zenith angles
azs – [in] Array of azimuth values (radians)
zas – [in] Array of zenith angle values (radians)
latitude – [in] Latitude of the instrument (radians)
FEE_beam_zenith – [inout] An initialised
RTS_MWA_FEE_beam_tcontaining MWA FEE spherical harmonic coeffs for a zenith pointingFEE_beam – [inout] An initialised
RTS_MWA_FEE_beam_tcontaining MWA FEE spherical harmonic coeffs for desired pointingrotation – [in] 0=False, 1=True, rotate results by parallactic angle
scaling – [in] 0=False, 1=True, Normlise results to zenith
FEE_beam_gains – [in] Complex array to store outputs in (ordered by
XX,XY,YX,YY, and then by az/za)
-
void multifreq_get_MWAFEE_normalisation(beam_settings_t *beam_settings)¶
Gets the normlisation factors for all beams in
beam_settings->FEE_beamsby calculating zenith responses forbeam_settings->FEE_beam_zeniths.The FEE beam model is stored in theta/phi (instrument locked) polarisations. To therefore calculate the zenith normalisation values, actually need to calculate the beam at zenith with multiple azimuth values, and then from those directions, select the correct east-west/north south dipole and theta/phi polarisation output.
This function calculates the beam nomalisation for multiple frequencies, and as such calls
FEE_primary_beam_cuda::get_HDFBeam_normalisationmultiple times.Both
beam_settings->FEE_beam_zenithsandbeam_settings->FEE_beamsshould have been initialised by usingFEE_primary_beam::multifreq_RTS_MWAFEEInit- Parameters
*beam_settings – [in] Populated
beam_settings_twhich has hadFEE_primary_beam::multifreq_RTS_MWAFEEInitrun on it
-
void multifreq_calc_CUDA_FEE_beam(beam_settings_t *beam_settings, user_precision_t *azs, user_precision_t *zas, int num_time_steps, user_precision_t *sin_para_angs, user_precision_t *cos_para_angs, int num_components, int rotation, int scaling)¶
Calculate the MWA FEE beam response for multiple frequencies and sky direction. All outputs are left on the device to be used in later calculations, rather than copied across to the host.
Calls
FEE_primary_beam_cuda::calc_CUDA_FEE_beamfor allRTS_MWA_FEE_beam_tinbeam_settings->FEE_beams- Parameters
*beam_settings – [in]
beam_settings_twherebeam_settings->FEE_beamshas been intialised withFEE_primary_beam_cuda::multifreq_get_MWAFEE_normalisationazs – [in] Array of azimuth values (radians)
zas – [in] Array of zenith angle values (radians)
num_time_steps – [in] Number of time steps present in az, za
sin_para_angs – [in] Sine of the parallactic angle for all az,za
cos_para_angs – [in] Cosine of the parallactic angle for all az,za
num_components – [in] Number of components the MWA Beam was calculated for
rotation – [in] Boolean, whether to rotate by parallatic angle or not
scaling – [in] Boolean, whether to normalise to zenith or not
-
__global__ void kern_map_FEE_beam_gains_multi_freq(cuUserComplex *d_FEE_beam_gain_matrices, cuUserComplex *d_primay_beam_J00, cuUserComplex *d_primay_beam_J01, cuUserComplex *d_primay_beam_J10, cuUserComplex *d_primay_beam_J11, int num_freqs, int num_components, int num_times, int iFreq)¶
Maps the gains found in
d_FEE_beam_gain_matricesinto thed_primay_beam_J*arrays.Does the device code for the function
map_FEE_beam_gains_multi_freq. Needed when running multiple frequencies of the MWA FEE model- Parameters
*d_FEE_beam_gain_matrices – [in] Complex beam gains for frequency index
iFreq*d_primay_beam_J00 – [inout] Complex
gxbeam Jones values*d_primay_beam_J01 – [inout] Complex
Dxbeam Jones values*d_primay_beam_J10 – [inout] Complex
Dybeam Jones values*d_primay_beam_J11 – [inout] Complex
gybeam Jones valuenum_freqs – [in] Number of frequencies the MWA Beam was calculated at
num_components – [in] Number of components the MWA Beam was calculated for
num_times – [in] Number of times the MWA Beam was calculated for
iFreq – [in] The frequency index the gains in
d_FEE_beam_gain_matricescorrespond to
-
void map_FEE_beam_gains_multi_freq(beam_settings_t *beam_settings, cuUserComplex *d_primay_beam_J00, cuUserComplex *d_primay_beam_J01, cuUserComplex *d_primay_beam_J10, cuUserComplex *d_primay_beam_J11, int num_freqs, int num_components, int num_times)¶
Maps the gains found in
beam_settings->FEE_beams[iFreq]->d_FEE_beam_gain_matricesinto thed_primay_beam_J*arrays.Launches
kern_map_FEE_beam_gains_multi_freqfor each of the populatedRTS_MWA_FEE_beam_tinbeam_settings->FEE_beams, to separate the polarisations into thed_primay_beam_J*arrays.- Parameters
*beam_settings – [in]
beam_settings_twherebeam_settings->FEE_beamshas been populated usingFEE_primary_beam_cuda::multifreq_calc_CUDA_FEE_beam*d_primay_beam_J00 – [inout] Complex
gxbeam Jones values*d_primay_beam_J01 – [inout] Complex
Dxbeam Jones values*d_primay_beam_J10 – [inout] Complex
Dybeam Jones values*d_primay_beam_J11 – [inout] Complex
gybeam Jones valuenum_freqs – [in] Number of frequencies the MWA Beam was calculated at
num_components – [in] Number of components the MWA Beam was calculated for
num_times – [in] Number of times the MWA Beam was calculated for
-
void run_and_map_multifreq_calc_CUDA_FEE_beam(beam_settings_t *beam_settings, user_precision_t *azs, user_precision_t *zas, user_precision_t *sin_para_angs, user_precision_t *cos_para_angs, int num_components, int num_freqs, int num_times, int rotation, int scaling, cuUserComplex *d_primay_beam_J00, cuUserComplex *d_primay_beam_J01, cuUserComplex *d_primay_beam_J10, cuUserComplex *d_primay_beam_J11)¶
This runs both
FEE_primary_beam_cuda::multifreq_calc_CUDA_FEE_beamandFEE_primary_beam_cuda::map_FEE_beam_gains_multi_freqto calculate multiple sky directions and frequencies directly into thed_primay_beam_J*arrays.- Parameters
*beam_settings – [in]
beam_settings_twherebeam_settings->FEE_beamshas been intialised withFEE_primary_beam_cuda::multifreq_get_MWAFEE_normalisationazs – [in] Array of azimuth values (radians)
zas – [in] Array of zenith angle values (radians)
sin_para_angs – [in] Sine of the parallactic angle for all az,za
cos_para_angs – [in] Cosine of the parallactic angle for all az,za
rotation – [in]
scaling – [in]
*d_primay_beam_J00 – [inout] Complex
gxbeam Jones values*d_primay_beam_J01 – [inout] Complex
Dxbeam Jones values*d_primay_beam_J10 – [inout] Complex
Dybeam Jones values*d_primay_beam_J11 – [inout] Complex
gybeam Jones valuesnum_freqs – [in] Number of frequencies the MWA Beam was calculated at
num_components – [in] Number of components the MWA Beam was calculated for
num_times – [in] Number of time steps present in az, za