From b97c3cd381eed1eb43f7036d713ceb2d88a2ab77 Mon Sep 17 00:00:00 2001 From: Ryan Varley Date: Tue, 16 May 2017 22:51:38 +0100 Subject: [PATCH] Deleted exposure generator tests. These were broken end-to-end / component tests that need a re-work anyway (see #24) --- wayne/tests/test_observation.py | 59 --------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 wayne/tests/test_observation.py diff --git a/wayne/tests/test_observation.py b/wayne/tests/test_observation.py deleted file mode 100644 index d7179e7..0000000 --- a/wayne/tests/test_observation.py +++ /dev/null @@ -1,59 +0,0 @@ -import unittest - -import numpy as np -import numpy.testing -from exodata.example import genExamplePlanet -from astropy.analytic_functions import blackbody_lambda -import astropy.units as u - -from .. import observation -from .. import exposure -from .. import detector -from .. import grism - - -class TestExposureGenerator(unittest.TestCase): - def setUp(self): - self.planet = genExamplePlanet() - self.det = detector.WFC3_IR() - self.g141 = grism.G141() - - self.wl = np.linspace(0.7, 1.8, 100) * u.micron - self.star_flux = blackbody_lambda(self.wl, 3000) * u.sr - self.planet_depth = np.ones(len(self.wl)) - - self.expgen = observation.ExposureGenerator(self.det, self.g141, 2, 'RAPID', 256, self.planet) - - def test_staring_frame(self): # just testing it generates - exp = self.expgen.staring_frame(450, 450, self.wl, self.star_flux, self.planet_depth, 3) - self.assertIsInstance(exp, exposure.Exposure) - - def test_scanning_frame(self): # just testing it generates - exp = self.expgen.scanning_frame(450, 450, self.wl, self.star_flux, - self.planet_depth, 1 * u.pixel / u.s, 0.2 * u.s, 3) - self.assertIsInstance(exp, exposure.Exposure) - - def test__gen_scanning_sample_times_works(self): - expgen = observation.ExposureGenerator(self.det, self.g141, 3, 'SPARS10', 1024, self.planet) - sample_starts, sample_mid_points, sample_durations, s_read_index = expgen._gen_scanning_sample_times(1 * u.s) - - # read times 2.932, 12.933, 22.934 - # this code has been manually reviewed to produce the desired result - starts = np.array([0., 1., 2., 2.932, 3.932, 4.932, 5.932, 6.932, 7.932, 8.932, - 9.932, 10.932, 11.932, 12.932, 12.933, 13.933, 14.933, 15.933, 16.933, 17.933, 18.933, - 19.933, 20.933, 21.933, 22.933]) - - _ends = np.roll(starts, -1) - durations = _ends - starts - durations[-1] = 22.934 - starts[-1] - - mid_points = starts + (durations/2) - - read_index = [2, 13, 24] - - numpy.testing.assert_array_almost_equal(starts, sample_starts.to(u.s).value, 3) - numpy.testing.assert_array_almost_equal(durations, sample_durations.to(u.s).value, 3) - numpy.testing.assert_array_almost_equal(mid_points, sample_mid_points.to(u.s).value, 3) - - numpy.testing.assert_array_equal(read_index, s_read_index) - \ No newline at end of file