Coverage for tests/test_CoreSched.py : 45%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import numpy as np
2import unittest
3from lsst.sims.featureScheduler.schedulers import Core_scheduler
4import lsst.sims.featureScheduler.basis_functions as basis_functions
5import lsst.sims.featureScheduler.surveys as surveys
6import lsst.utils.tests
7from lsst.sims.featureScheduler.utils import standard_goals
8from lsst.sims.featureScheduler.modelObservatory import Model_observatory
11class TestCoreSched(unittest.TestCase):
13 def testsched(self):
14 target_map = standard_goals()['r']
16 bfs = []
17 bfs.append(basis_functions.M5_diff_basis_function())
18 bfs.append(basis_functions.Target_map_basis_function(target_map=target_map))
19 weights = np.array([1., 1])
20 survey = surveys.Greedy_survey(bfs, weights)
21 scheduler = Core_scheduler([survey])
23 observatory = Model_observatory()
25 # Check that we can update conditions
26 scheduler.update_conditions(observatory.return_conditions())
28 # Check that we can get an observation out
29 obs = scheduler.request_observation()
30 assert(obs is not None)
32 # Check that we can flush the Queue
33 scheduler.flush_queue()
34 assert(len(scheduler.queue) == 0)
36 # Check that we can add an observation
37 scheduler.add_observation(obs)
40class TestMemory(lsst.utils.tests.MemoryTestCase):
41 pass
44def setup_module(module):
45 lsst.utils.tests.init()
48if __name__ == "__main__": 48 ↛ 49line 48 didn't jump to line 49, because the condition on line 48 was never true
49 lsst.utils.tests.init()
50 unittest.main()