Coverage for tests/testSedUtils.py : 40%

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
1from builtins import range
2import unittest
3import numpy as np
5import lsst.utils.tests
6from lsst.sims.photUtils import Sed, Bandpass, getImsimFluxNorm
9def setup_module(module):
10 lsst.utils.tests.init()
13class ImSimNormTestCase(unittest.TestCase):
15 def test_norm(self):
16 """
17 Test that the special test case getImsimFluxNorm
18 returns the same value as calling calcFluxNorm actually
19 passing in the imsim Bandpass
20 """
22 bp = Bandpass()
23 bp.imsimBandpass()
25 rng = np.random.RandomState(1123)
26 wavelen = np.arange(300.0, 2000.0, 0.17)
28 for ix in range(10):
29 flux = rng.random_sample(len(wavelen))*100.0
30 sed = Sed()
31 sed.setSED(wavelen=wavelen, flambda=flux)
32 magmatch = rng.random_sample()*5.0 + 10.0
34 control = sed.calcFluxNorm(magmatch, bp)
35 test = getImsimFluxNorm(sed, magmatch)
37 # something about how interpolation is done in Sed means
38 # that the values don't come out exactly equal. They come
39 # out equal to 8 seignificant digits, though.
40 self.assertEqual(control, test)
43class MemoryTestClass(lsst.utils.tests.MemoryTestCase):
44 pass
46if __name__ == "__main__": 46 ↛ 47line 46 didn't jump to line 47, because the condition on line 46 was never true
47 lsst.utils.tests.init()
48 unittest.main()