-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce new API for handling visibilities: `~xrayvision.visibility.VisibilitiesABC` and `~xrayvision.visibility.VisMetaABC`, along with implemented versions of the classes `~xrayvision.visibility.Visibilities` and `~xrayvision.visibility.VisMeta`. Co-authored-by: DanRyanIrish <[email protected]> Co-authored-by: Shane Maloney <[email protected]>
- Loading branch information
1 parent
b79f0bf
commit 8580373
Showing
4 changed files
with
464 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Introduce new API for handling visibilities: `~xrayvision.visibility.VisibilitiesABC` and `~xrayvision.visibility.VisMetaABC`, along with implemented versions of the classes `~xrayvision.visibility.Visibilities` and `~xrayvision.visibility.VisMeta`. |
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,9 +1,72 @@ | ||
from pathlib import Path | ||
|
||
import astropy.units as apu | ||
import pytest | ||
from astropy.tests.helper import assert_quantity_allclose | ||
|
||
import xrayvision.visibility as vm | ||
|
||
|
||
@pytest.fixture | ||
def test_data_dir(): | ||
path = Path(__file__).parent.parent / "data" | ||
return path | ||
|
||
|
||
@pytest.fixture | ||
def visibilities(): | ||
visibilities = [1 + 2 * 1j, 3 + 3 * 1j] * apu.ct | ||
u = [0.023, -0.08] * 1 / apu.arcsec | ||
v = [-0.0013, 0.013] * 1 / apu.arcsec | ||
phase_center = [0, 0] * apu.arcsec | ||
unc = [0.01, 0.15] * apu.ct | ||
meta = {"vis_labels": ["3a", "10b"]} | ||
return vm.Visibilities(visibilities, u, v, phase_center, uncertainty=unc, meta=meta) | ||
|
||
|
||
def test_vis_u(visibilities): | ||
vis_base = visibilities | ||
output_u = vis_base.u | ||
expected_u = [0.023, -0.08] * 1 / apu.arcsec | ||
|
||
assert_quantity_allclose(output_u, expected_u) | ||
|
||
|
||
def test_vis_v(visibilities): | ||
vis_base = visibilities | ||
output_v = vis_base.v | ||
expected_v = [-0.0013, 0.013] * 1 / apu.arcsec | ||
|
||
assert_quantity_allclose(output_v, expected_v) | ||
|
||
|
||
def test_vis_amplitude(visibilities): | ||
vis_base = visibilities | ||
output_amplitude = vis_base.amplitude | ||
expected_amplitude = [2.236068, 4.2426407] * apu.ct | ||
|
||
assert_quantity_allclose(output_amplitude, expected_amplitude) | ||
|
||
|
||
def test_vis_phase(visibilities): | ||
vis_base = visibilities | ||
output_phase = vis_base.phase | ||
expected_phase = [63.434949, 45] * apu.deg | ||
|
||
assert_quantity_allclose(output_phase, expected_phase) | ||
|
||
|
||
def test_vis_amplitude_uncertainty(visibilities): | ||
vis_base = visibilities | ||
output_amplitude_uncertainty = vis_base.amplitude_uncertainty | ||
expected_amplitude_uncertainty = [0.004472136, 0.10606602] * apu.ct | ||
|
||
assert_quantity_allclose(output_amplitude_uncertainty, expected_amplitude_uncertainty) | ||
|
||
|
||
def test_vis_phase_uncertainty(visibilities): | ||
vis_base = visibilities | ||
output_phase_uncertainty = vis_base.phase_uncertainty | ||
expected_phase_uncertainty = [0.22918312, 1.4323945] * apu.deg | ||
|
||
assert_quantity_allclose(output_phase_uncertainty, expected_phase_uncertainty) |
Oops, something went wrong.