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 

3from lsst.sims.featureScheduler.utils import season_calc, create_season_offset 

4import lsst.utils.tests 

5import healpy as hp 

6 

7 

8class TestFeatures(unittest.TestCase): 

9 

10 def testSeason(self): 

11 """ 

12 Test that the season utils work as intended 

13 """ 

14 night = 365.25 * 3.5 

15 plain = season_calc(night) 

16 assert(plain == 3) 

17 

18 mod2 = season_calc(night, modulo=2) 

19 assert(mod2 == 1) 

20 

21 mod3 = season_calc(night, modulo=3) 

22 assert(mod3 == 0) 

23 

24 mod3 = season_calc(night, modulo=3, max_season=2) 

25 assert(mod3 == -1) 

26 

27 mod3 = season_calc(night, modulo=3, max_season=2, offset=-365.25*2) 

28 assert(mod3 == 1) 

29 

30 mod3 = season_calc(night, modulo=3, max_season=2, offset=-365.25*10) 

31 assert(mod3 == -1) 

32 

33 mod3 = season_calc(night, modulo=3, offset=-365.25*10) 

34 assert(mod3 == -1) 

35 

36 

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

38 pass 

39 

40 

41def setup_module(module): 

42 lsst.utils.tests.init() 

43 

44 

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

46 lsst.utils.tests.init() 

47 unittest.main()