Hide keyboard shortcuts

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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

import numpy as np 

import unittest 

from lsst.sims.featureScheduler.schedulers import Core_scheduler 

import lsst.sims.featureScheduler.basis_functions as basis_functions 

import lsst.sims.featureScheduler.surveys as surveys 

import lsst.utils.tests 

from lsst.sims.featureScheduler.utils import standard_goals 

from lsst.sims.featureScheduler.modelObservatory import Model_observatory 

 

 

class TestCoreSched(unittest.TestCase): 

 

def testsched(self): 

target_map = standard_goals()['r'] 

 

bfs = [] 

bfs.append(basis_functions.M5_diff_basis_function()) 

bfs.append(basis_functions.Target_map_basis_function(target_map=target_map)) 

weights = np.array([1., 1]) 

survey = surveys.Greedy_survey(bfs, weights) 

scheduler = Core_scheduler([survey]) 

 

observatory = Model_observatory() 

 

# Check that we can update conditions 

scheduler.update_conditions(observatory.return_conditions()) 

 

# Check that we can get an observation out 

obs = scheduler.request_observation() 

assert(obs is not None) 

 

# Check that we can flush the Queue 

scheduler.flush_queue() 

assert(len(scheduler.queue) == 0) 

 

# Check that we can add an observation 

scheduler.add_observation(obs) 

 

 

class TestMemory(lsst.utils.tests.MemoryTestCase): 

pass 

 

 

def setup_module(module): 

lsst.utils.tests.init() 

 

 

48 ↛ 49line 48 didn't jump to line 49, because the condition on line 48 was never trueif __name__ == "__main__": 

lsst.utils.tests.init() 

unittest.main()