Coverage for tests/testNeoDistancePlotter.py : 45%

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 zip
2import matplotlib
3matplotlib.use("Agg")
4import numpy as np
5import unittest
6import lsst.sims.maf.plots as plots
7import lsst.utils.tests
10class TestNeoDistancePlotter(unittest.TestCase):
12 def setUp(self):
13 rng = np.random.RandomState(61723009)
14 names = ['eclipLat', 'eclipLon', 'MaxGeoDist',
15 'NEOHelioX', 'NEOHelioY', 'filter']
16 types = [float]*5
17 types.append('|S1')
18 npts = 100
19 self.metricValues = np.zeros(npts, list(zip(names, types)))
20 self.metricValues['MaxGeoDist'] = rng.rand(npts)*2.
21 self.metricValues['eclipLat'] = rng.rand(npts)
22 self.metricValues['NEOHelioX'] = rng.rand(npts)*3-1.5
23 self.metricValues['NEOHelioY'] = rng.rand(npts)*3-1.5+1
24 self.metricValues['filter'] = 'g'
26 def testPlotter(self):
27 """
28 Just test that it can make a figure without throwing an error.
29 """
30 plotter = plots.NeoDistancePlotter()
31 # Need to wrap in a list because it will usually go through the
32 # UniSlicer, and will thus be an array inside a 1-element masked array
33 fig = plotter([self.metricValues], None, {})
34 self.assertNotEqual(fig, None)
37class TestMemory(lsst.utils.tests.MemoryTestCase):
38 pass
41def setup_module(module):
42 lsst.utils.tests.init()
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()