From a78c8822274f687712a42f741dbc6ca5ed492400 Mon Sep 17 00:00:00 2001 From: LukasK13 Date: Mon, 11 May 2020 13:52:14 +0200 Subject: [PATCH] Tests updated --- tests/psf/test_Airy.py | 23 +++++++++++++++++++++-- tests/psf/test_Zemax.py | 8 ++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/tests/psf/test_Airy.py b/tests/psf/test_Airy.py index 09f35e7..f5b9361 100644 --- a/tests/psf/test_Airy.py +++ b/tests/psf/test_Airy.py @@ -5,10 +5,29 @@ import astropy.units as u class TestAiry(TestCase): def setUp(self): - self.airy = Airy(13, 4 * u.um, 0.5 * u.m, 10, 6.5 * u.nm) + self.airy = Airy(13, 4 * u.um, 0.5 * u.m, 10, 6.5 * u.um) def test_calc_reduced_observation_angle(self): + # No jitter, unobstructed self.assertAlmostEqual(self.airy.calcReducedObservationAngle("peak").value, 0.0) self.assertAlmostEqual(self.airy.calcReducedObservationAngle("fwhm").value, 1.028) self.assertAlmostEqual(self.airy.calcReducedObservationAngle("min").value, 2.44) - self.assertAlmostEqual(self.airy.calcReducedObservationAngle("80").value, 1.7938842051009245) + self.assertAlmostEqual(self.airy.calcReducedObservationAngle(80.).value, 1.7938842051009245) + + # Jitter, unobstructed + self.assertAlmostEqual(self.airy.calcReducedObservationAngle("peak", 1 * u.arcsec).value, 0.0) + self.assertAlmostEqual(self.airy.calcReducedObservationAngle("fwhm", 1 * u.arcsec).value, 1.75) + self.assertAlmostEqual(self.airy.calcReducedObservationAngle("min", 1 * u.arcsec).value, 3.375) + self.assertAlmostEqual(self.airy.calcReducedObservationAngle(80., 1 * u.arcsec).value, 3.1) + + # No jitter, obstructed + self.assertAlmostEqual(self.airy.calcReducedObservationAngle("peak", obstruction=0.04).value, 0.0) + self.assertAlmostEqual(self.airy.calcReducedObservationAngle("fwhm", obstruction=0.04).value, 1.006752080603888) + self.assertAlmostEqual(self.airy.calcReducedObservationAngle("min", obstruction=0.04).value, 2.33301171875) + self.assertAlmostEqual(self.airy.calcReducedObservationAngle(80., obstruction=0.04).value, 3.1045076425044726) + + # Jitter, obstructed + self.assertAlmostEqual(self.airy.calcReducedObservationAngle("peak", 1 * u.arcsec, 0.04).value, 0.0) + self.assertAlmostEqual(self.airy.calcReducedObservationAngle("fwhm", 1 * u.arcsec, 0.04).value, 1.725) + self.assertAlmostEqual(self.airy.calcReducedObservationAngle("min", 1 * u.arcsec, 0.04).value, 2.875) + self.assertAlmostEqual(self.airy.calcReducedObservationAngle(80., 1 * u.arcsec, 0.04).value, 3.1) diff --git a/tests/psf/test_Zemax.py b/tests/psf/test_Zemax.py index d9d90e2..e199953 100644 --- a/tests/psf/test_Zemax.py +++ b/tests/psf/test_Zemax.py @@ -5,7 +5,11 @@ import astropy.units as u class TestZemax(TestCase): def setUp(self): - self.zemax = Zemax("data/psf.txt", 13, 4 * u.um, 0.5 * u.m, 13, 6.5 * u.um) + self.zemax = Zemax("data/psf_2um.txt", 13, 4 * u.um, 0.5 * u.m, 13, 6.5 * u.um) def test_calcReducedObservationAngle(self): - self.assertAlmostEqual(self.zemax.calcReducedObservationAngle(0.6595336151196701).value, 0.08106259728314079) + # No jitter + self.assertAlmostEqual(self.zemax.calcReducedObservationAngle(80).value, 0.849307235849535) + + # Jitter + self.assertAlmostEqual(self.zemax.calcReducedObservationAngle(80, 1 * u.arcsec).value, 1.3057369866992834)