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

import numpy as np 

import unittest 

import lsst.sims.featureScheduler.features as features 

from lsst.sims.featureScheduler.utils import empty_observation 

import lsst.utils.tests 

 

 

class TestFeatures(unittest.TestCase): 

 

def testPair_in_night(self): 

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

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

 

indx = np.array([1000]) 

 

delta = 30./60./24. 

 

# Add 1st observation, feature should still be zero 

obs = empty_observation() 

obs['filter'] = 'r' 

obs['mjd'] = 59000. 

pin.add_observation(obs, indx=indx) 

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

 

# Add 2nd observation 

obs['mjd'] += delta 

pin.add_observation(obs, indx=indx) 

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

 

obs['mjd'] += delta 

pin.add_observation(obs, indx=indx) 

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

 

 

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

pass 

 

 

def setup_module(module): 

lsst.utils.tests.init() 

 

 

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

lsst.utils.tests.init() 

unittest.main()