Example #1
0
 def test_gets_axes_right(self):
     Map = tools.set_up_map(self.Data, (0.0, 5.2), (45, 23), (0.4, 0.5))
     Map.calc_axes()
     self.Data.calc_freq()
     self.assertTrue(sp.allclose(Map.freq, self.Data.freq))
     self.assertTrue(sp.allclose(Map.long, tools.calc_bins(0.0, 45, 0.4, "middle")))
     self.assertTrue(sp.allclose(Map.lat, tools.calc_bins(5.2, 23, 0.5, "middle")))
Example #2
0
 def test_gets_axes_right(self):
     Map = tools.set_up_map(self.Data, (0.0, 5.2), (45, 23), (0.4, 0.5))
     Map.calc_axes()
     self.Data.calc_freq()
     self.assertTrue(sp.allclose(Map.freq, self.Data.freq))
     self.assertTrue(
         sp.allclose(Map.long, tools.calc_bins(0.0, 45, 0.4, 'middle')))
     self.assertTrue(
         sp.allclose(Map.lat, tools.calc_bins(5.2, 23, 0.5, 'middle')))
Example #3
0
 def test_circle(self):
     centre = 4.6
     shape = 19
     spacing = 1.3
     bins = tools.calc_bins(centre, shape, spacing, edge="left") + 0.1 * spacing
     inds = tools.calc_inds(bins, centre, shape, spacing)
     self.assertTrue(sp.allclose(inds, sp.arange(int(shape))))
     spacing = -0.35
     bins = tools.calc_bins(centre, shape, spacing, edge="left") + 0.1 * spacing
     inds = tools.calc_inds(bins, centre, shape, spacing)
     self.assertTrue(sp.allclose(inds, sp.arange(int(shape))))
Example #4
0
 def test_circle(self):
     centre = 4.6
     shape = 19
     spacing = 1.3
     bins = tools.calc_bins(centre, shape, spacing,
                            edge='left') + 0.1 * spacing
     inds = tools.calc_inds(bins, centre, shape, spacing)
     self.assertTrue(sp.allclose(inds, sp.arange(int(shape))))
     spacing = -0.35
     bins = tools.calc_bins(centre, shape, spacing,
                            edge='left') + 0.1 * spacing
     inds = tools.calc_inds(bins, centre, shape, spacing)
     self.assertTrue(sp.allclose(inds, sp.arange(int(shape))))
Example #5
0
 def test_calc_bins(self):
     centre = 5
     shape = 5
     spacing = 2
     bins = tools.calc_bins(centre, shape, spacing, edge="left")
     self.assertAlmostEqual(bins[0], 0)
     self.assertAlmostEqual(bins[-1], 8)
     self.assertAlmostEqual(bins[2], 4)
     bins = tools.calc_bins(centre, shape, spacing, edge="middle")
     self.assertAlmostEqual(bins[0], 1)
     self.assertAlmostEqual(bins[-1], 9)
     self.assertAlmostEqual(bins[2], 5)
     shape = 10
     spacing = 1
     bins = tools.calc_bins(centre, shape, spacing, edge="right")
     self.assertAlmostEqual(bins[0], 0.5)
     self.assertAlmostEqual(bins[-1], 9.5)
     self.assertAlmostEqual(bins[4], 4.5)
Example #6
0
 def test_calc_bins(self):
     centre = 5
     shape = 5
     spacing = 2
     bins = tools.calc_bins(centre, shape, spacing, edge='left')
     self.assertAlmostEqual(bins[0], 0)
     self.assertAlmostEqual(bins[-1], 8)
     self.assertAlmostEqual(bins[2], 4)
     bins = tools.calc_bins(centre, shape, spacing, edge='middle')
     self.assertAlmostEqual(bins[0], 1)
     self.assertAlmostEqual(bins[-1], 9)
     self.assertAlmostEqual(bins[2], 5)
     shape = 10
     spacing = 1
     bins = tools.calc_bins(centre, shape, spacing, edge='right')
     self.assertAlmostEqual(bins[0], 0.5)
     self.assertAlmostEqual(bins[-1], 9.5)
     self.assertAlmostEqual(bins[4], 4.5)