fundamental_coords
¶
Tests for the functions in WODEN/src/fundamental_coords.cu
.
test_lmn_coords.c¶
This runs fundamental_coords::test_kern_calc_lmn
, which tests
fundamental_coords::kern_calc_lmn
, which calculates l,m,n coords.
This runs two control tests, both that generate analytically predictable outcomes. Both set the phase centre to RA\(_{\textrm{phase}}\), Dec\(_{\textrm{phase}}\) = \(0^\circ, 0^\circ\). One test holds Dec = \(0^\circ\), and varies RA, the other holds RA = \(0^\circ\), and varies Dec. Under these settings the following should be true:
RA |
l |
m |
n |
---|---|---|---|
\(\frac{3\pi}{2}\) |
\(-1\) |
\(0\) |
\(0\) |
\(\frac{5\pi}{3}\) |
\(-\frac{\sqrt{3}}{2}\) |
\(0\) |
\(0.5\) |
\(\frac{7\pi}{4}\) |
\(-\frac{\sqrt{2}}{2}\) |
\(0\) |
\(\frac{\sqrt{2}}{2}\) |
\(\frac{11\pi}{6}\) |
\(-0.5\) |
\(0\) |
\(\frac{\sqrt{3}}{2}\) |
\(0\) |
\(0\) |
\(0\) |
\(1\) |
\(\frac{\pi}{6}\) |
\(0.5\) |
\(0\) |
\(\frac{\sqrt{3}}{2}\) |
\(\frac{\pi}{4}\) |
\(\frac{\sqrt{2}}{2}\) |
\(0\) |
\(\frac{\sqrt{2}}{2}\) |
\(\frac{\pi}{3}\) |
\(\frac{\sqrt{3}}{2}\) |
\(0\) |
\(0.5\) |
\(\frac{\pi}{2}\) |
\(1.0\) |
\(0\) |
\(0\) |
Dec |
l |
m |
n |
---|---|---|---|
\(-\frac{\pi}{2}\) |
\(0\) |
\(-1\) |
\(0\) |
\(-\frac{\pi}{3}\) |
\(0\) |
\(-\frac{\sqrt{3}}{4}\) |
\(0.5\) |
\(-\frac{\pi}{4}\) |
\(0\) |
\(-\frac{\sqrt{2}}{2}\) |
\(\frac{\sqrt{2}}{2}\) |
\(-\frac{\pi}{6}\) |
\(0\) |
\(-0.5\) |
\(\frac{\sqrt{3}}{2}\) |
\(0\) |
\(0\) |
\(0\) |
\(1\) |
\(\frac{\pi}{6}\) |
\(0\) |
\(0.5\) |
\(\frac{\sqrt{3}}{2}\) |
\(\frac{\pi}{4}\) |
\(0\) |
\(\frac{\sqrt{2}}{2}\) |
\(\frac{\sqrt{2}}{2}\) |
\(\frac{\pi}{3}\) |
\(0\) |
\(\frac{\sqrt{3}}{2}\) |
\(0.5\) |
\(\frac{\pi}{2}\) |
\(0\) |
\(1.0\) |
\(0\) |
The tests ensure that the inputs yield the outputs as expected, and in the process check that the execution of the kernel yields the correct number of outputs. Note that this function is entirely 64-bit whether in FLOAT or DOUBLE compile mode. The absolute tolerance for outputs vs expectation tabled above is 1e-15 (this function is a good ‘un).
test_uvw_coords.c¶
This runs both fundamental_coords::test_kern_calc_uvw
as well as
fundamental_coords::test_kern_calc_uvw_shapelet
, which in turn test
fundamental_coords::kern_calc_uvw
,
fundamental_coords::kern_calc_uvw_shapelet
respectively.
Both kernels calculate u,v,w coords in slightly different circumstances.
kern_calc_uvw
calculates u,v,w coords towards a specified RA,Dec phase centre,
for a given set of baseline lengths \(X_{\mathrm{diff}}, Y_{\mathrm{diff}}, Z_{\mathrm{diff}}\),
for a number of LSTs and frequencies (meaning u,v,w change with time and frequency).
kern_calc_uvw_shapelet
calculates a number of u,v coordinate systems,
each centred on a different SHAPELET component, and does not scale by wavelength;
everything remains in metres. This is to save on memory, at the cost of
having to divide by wavelength inside kernels at later times.
Both kernels are tested for scaling as changing by time, and
fundamental_coords::kern_calc_uvw
is tested to change with wavelength. To generate
analytically predictable outcomes, the phase centre is again set to
RA\(_{\textrm{phase}}\), Dec\(_{\textrm{phase}}\) = \(0^\circ, 0^\circ\).
Under these conditions, the following is true:
where \(H_{\textrm{phase}}\) is the hour angle of the phase centre. These tests
check that this holds true over multiple time and frequency steps. In the case
of kern_calc_uvw_shapelet
, this is checked for each SHAPELET component,
making sure that the outputs are ordered as expected. Both the FLOAT and DOUBLE
versions are tested within a tolerance of 1e-16 (this test compares the CUDA
code to the C
code calculation of the above equations, so they agree
very nicely).