def test_remove_point(self): sed = Sed() point1 = PhotometricPoint(x=1.0, y=1.0) point2 = PhotometricPoint(x=2.0, y=-2.0) sed.add_point(point1) sed.add_point(point2) self.assert_(len(sed) == 2) sed.remove_point(0) self.assert_(len(sed) == 1) self.assertEqual(sed[0].x, 2.0)
def test_xyyerr_properties(self): sed = Sed(x = self._x, y = self._y, yerr = self._yerr, xunit = self._xunit, yunit = self._yunit, z = self._z) numpy.testing.assert_array_equal(sed.x, self._x) numpy.testing.assert_array_equal(sed.y, self._y) numpy.testing.assert_array_equal(sed.yerr, self._yerr) sed.remove_point(0) numpy.testing.assert_array_equal(sed.x, self._x[1:]) numpy.testing.assert_array_equal(sed.y, self._y[1:]) numpy.testing.assert_array_equal(sed.yerr, self._yerr[1:]) p=PhotometricPoint(240000.,4.5e-9) sed.add_point(p) numpy.testing.assert_array_equal(sed.x, numpy.array([4477.9, 5657.1, 6370.0, 240000.])) sed.yerr = 1e-10 numpy.testing.assert_array_equal(sed.yerr, numpy.array([1e-10]*len(sed)))