def sanity_aitoff(self): """ Checking Aitoff projection. """ for i in xrange(100): l = numpy.random.random() * 360.0 b = numpy.random.random() * 180.0 - 90.0 x, y = aitoff(l, b) l2, b2 = inverseAitoff(x, y) self.assertTrue(self.mrd(l2, l) < 1e-6) self.assertTrue(self.mrd(b2, b) < 1e-6)
def test_inverseAitoff(self): err = 0 for i in xrange(1000): l = numpy.random.random() * 360.0 - 180.0 b = numpy.random.random() * 180.0 - 90.0 x, y = aitoffLegacy.aitoff(l, b) l2, b2 = aitoffLegacy.inverseAitoff(x, y) if abs(l-l2) > 1e-6 or abs(b-b2) > 1e-6: print "Problem: " print " ", l, b, x, y, l2, b2 err += 1 self.assertEqual(err, 0)