fundamental_coords¶
Tests for the functions in WODEN/src/fundamental_coords_cpu.c and
WODEN/src/fundamental_coords_gpu.cpp. These functions calculate lmn
and uvw coordinates, on the cpu and gpu respectively. The same tests are
run on both the cpu and gpu code, to ensure consistency.
test_lmn_coords*.c¶
This either runs fundamental_coords_cpu.c::calc_lmn_cpu or
fundamental_coords_gpu.cpp::calc_lmn_for_components_gpu, which calculate l,m,n coords.
We run 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 either fundamental_coords_gpu.cpp::calc_uvw_gpu and
fundamental_coords_gpu.cpp::calc_uv_shapelet_gpu, or
fundamental_coords_cpu.c::calc_uvw_cpu and
fundamental_coords_cpu.c::calc_uv_shapelet_cpu.
Both functions calculate u,v,w coords in slightly different circumstances.
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).
calc_uv_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 functions are tested for scaling as changing by time, and
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 calc_uvw_shapelet, this is checked for each SHAPELET component,
making sure that the outputs are ordered as expected.