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

46

from builtins import zip 

import matplotlib 

matplotlib.use("Agg") 

import numpy as np 

import unittest 

import lsst.sims.maf.plots as plots 

import lsst.utils.tests 

 

 

class TestNeoDistancePlotter(unittest.TestCase): 

 

def setUp(self): 

rng = np.random.RandomState(61723009) 

names = ['eclipLat', 'eclipLon', 'MaxGeoDist', 

'NEOHelioX', 'NEOHelioY', 'filter'] 

types = [float]*5 

types.append('|S1') 

npts = 100 

self.metricValues = np.zeros(npts, list(zip(names, types))) 

self.metricValues['MaxGeoDist'] = rng.rand(npts)*2. 

self.metricValues['eclipLat'] = rng.rand(npts) 

self.metricValues['NEOHelioX'] = rng.rand(npts)*3-1.5 

self.metricValues['NEOHelioY'] = rng.rand(npts)*3-1.5+1 

self.metricValues['filter'] = 'g' 

 

def testPlotter(self): 

""" 

Just test that it can make a figure without throwing an error. 

""" 

plotter = plots.NeoDistancePlotter() 

# Need to wrap in a list because it will usually go through the 

# UniSlicer, and will thus be an array inside a 1-element masked array 

fig = plotter([self.metricValues], None, {}) 

 

 

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

pass 

 

 

def setup_module(module): 

lsst.utils.tests.init() 

 

 

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

lsst.utils.tests.init() 

unittest.main()