Coverage for tests/test_Features.py : 39%

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
8class TestFeatures(unittest.TestCase):
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.)
14 indx = np.array([1000])
16 delta = 30./60./24.
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.)
25 # Add 2nd observation
26 obs['mjd'] += delta
27 pin.add_observation(obs, indx=indx)
28 self.assertEqual(np.max(pin.feature), 1.)
30 obs['mjd'] += delta
31 pin.add_observation(obs, indx=indx)
32 self.assertEqual(np.max(pin.feature), 2.)
35class TestMemory(lsst.utils.tests.MemoryTestCase):
36 pass
39def setup_module(module):
40 lsst.utils.tests.init()
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()