def testSetCoeff(self): # Test setting coefficients directly from chebyFits outputs. chebyValues = ChebyValues() chebyValues.setCoefficients(self.chebyFits) for k in self.coeffKeys: self.assertTrue(k in chebyValues.coeffs) self.assertTrue(isinstance(chebyValues.coeffs[k], np.ndarray)) self.assertEqual(len(np.unique(chebyValues.coeffs['objId'])), len(self.orbits)) # This will only be true for carefully selected length/orbit type, where subdivision did not occur. # For the test MBAs, a len=1day will work. For the test NEOs, a len=0.25 day will work (with 2.5mas skyTol). #self.assertEqual(len(chebyValues.coeffs['tStart']), (self.interval / self.setLength) * len(self.orbits)) self.assertEqual(len(chebyValues.coeffs['ra'][0]), self.nCoeffs) self.assertTrue('meanRA' in chebyValues.coeffs) self.assertTrue('meanDec' in chebyValues.coeffs)
def testReadCoeffs(self): # Test reading the coefficients from disk. chebyValues = ChebyValues() chebyValues.readCoefficients(self.coeffFile) chebyValues2 = ChebyValues() chebyValues2.setCoefficients(self.chebyFits) for k in chebyValues.coeffs: if k == 'objId': # Can't test strings with np.test.assert_almost_equal. np.testing.assert_equal(chebyValues.coeffs[k], chebyValues2.coeffs[k]) else: # All of these will only be accurate to 2 less decimal places than they are # print out with in chebyFits. Since vmag, delta and elongation only use 7 # decimal places, this means we can test to 5 decimal places for those. np.testing.assert_allclose(chebyValues.coeffs[k], chebyValues2.coeffs[k], rtol=0, atol=1e-5)
def testSetCoeff(self): # Test setting coefficients directly from chebyFits outputs. chebyValues = ChebyValues() chebyValues.setCoefficients(self.chebyFits) for k in self.coeffKeys: self.assertTrue(k in chebyValues.coeffs) self.assertTrue(isinstance(chebyValues.coeffs[k], np.ndarray)) self.assertEqual(len(np.unique(chebyValues.coeffs['objId'])), len(self.orbits)) # This will only be true for carefully selected length/orbit type, where subdivision did not occur. # For the test MBAs, a len=1day will work. # For the test NEOs, a len=0.25 day will work (with 2.5mas skyTol). # self.assertEqual(len(chebyValues.coeffs['tStart']), # (self.interval / self.setLength) * len(self.orbits)) self.assertEqual(len(chebyValues.coeffs['ra'][0]), self.nCoeffs) self.assertTrue('meanRA' in chebyValues.coeffs) self.assertTrue('meanDec' in chebyValues.coeffs)