-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from tyler-a-cox/tilted_array
Proper tilting of input antenna positions when z-component is non-zero
- Loading branch information
Showing
5 changed files
with
119 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[run] | ||
include = fftvis/* | ||
omit = fftvis/logutils.py | ||
branch = True | ||
|
||
[report] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,48 @@ | ||
import pytest | ||
import numpy as np | ||
from fftvis import utils | ||
|
||
def test_get_plane_to_xy_rotation_matrix(): | ||
""" | ||
""" | ||
# Rotate the array to the xy-plane | ||
x = np.linspace(0, 100, 100) | ||
y = np.linspace(0, 100, 100) | ||
z = 0.125 * x + 0.5 * y | ||
antvecs = np.array([x, y, z]).T | ||
|
||
def test_get_pos_reds(): | ||
""" """ | ||
pass | ||
rotation_matrix = utils.get_plane_to_xy_rotation_matrix(antvecs) | ||
rm_antvecs = np.dot(rotation_matrix.T, antvecs.T) | ||
|
||
# Check that all elements of the z-axis are close to zero | ||
np.testing.assert_allclose(rm_antvecs[-1], 0, atol=1e-12) | ||
|
||
# Check that the lengths of the vectors are preserved | ||
np.testing.assert_allclose( | ||
np.linalg.norm(antvecs, axis=1), | ||
np.linalg.norm(rm_antvecs, axis=0), | ||
atol=1e-12 | ||
) | ||
|
||
def test_get_plane_to_xy_rotation_matrix_errors(): | ||
""" | ||
""" | ||
# Rotate the array to the xy-plane | ||
x = np.linspace(0, 100, 100) | ||
y = np.linspace(0, 100, 100) | ||
z = 0.125 * x + 0.5 * y | ||
antvecs = np.array([x, y, z]).T | ||
|
||
# Check that method is robust to errors | ||
rng = np.random.default_rng(42) | ||
random_antvecs = antvecs.copy() | ||
random_antvecs[:, -1] += rng.standard_normal(100) | ||
|
||
# Rotate the array to the xy-plane | ||
rotation_matrix = utils.get_plane_to_xy_rotation_matrix( | ||
random_antvecs | ||
) | ||
rm_antvecs = np.dot(rotation_matrix.T, antvecs.T) | ||
|
||
# Check that all elements of the z-axis within 5-sigma of zero | ||
np.testing.assert_array_less(np.abs(rm_antvecs[-1]), 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters