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

1import numpy as np 

2import unittest 

3import lsst.sims.featureScheduler.features as features 

4from lsst.sims.featureScheduler.utils import empty_observation 

5import lsst.utils.tests 

6 

7 

8class TestFeatures(unittest.TestCase): 

9 

10 def testPair_in_night(self): 

11 pin = features.Pair_in_night(gap_min=25., gap_max=45.) 

12 self.assertEqual(np.max(pin.feature), 0.) 

13 

14 indx = np.array([1000]) 

15 

16 delta = 30./60./24. 

17 

18 # Add 1st observation, feature should still be zero 

19 obs = empty_observation() 

20 obs['filter'] = 'r' 

21 obs['mjd'] = 59000. 

22 pin.add_observation(obs, indx=indx) 

23 self.assertEqual(np.max(pin.feature), 0.) 

24 

25 # Add 2nd observation 

26 obs['mjd'] += delta 

27 pin.add_observation(obs, indx=indx) 

28 self.assertEqual(np.max(pin.feature), 1.) 

29 

30 obs['mjd'] += delta 

31 pin.add_observation(obs, indx=indx) 

32 self.assertEqual(np.max(pin.feature), 2.) 

33 

34 

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

36 pass 

37 

38 

39def setup_module(module): 

40 lsst.utils.tests.init() 

41 

42 

43if __name__ == "__main__": 43 ↛ 44line 43 didn't jump to line 44, because the condition on line 43 was never true

44 lsst.utils.tests.init() 

45 unittest.main()