def testimmutablecopyof(self): a = np.array([[429., 5.], [2., 14.]]) npt.assert_almost_equal(a, np.array([[429., 5.], [2., 14.]])) a[1, 1] = 42. npt.assert_almost_equal(a, np.array([[429., 5.], [2., 42.]])) b = npu.immutablecopyof(a) npt.assert_almost_equal(b, np.array([[429., 5.], [2., 42.]])) with self.assertRaises(ValueError): b[1, 1] = 132. npt.assert_almost_equal(b, np.array([[429., 5.], [2., 42.]])) a[1, 1] = 132. npt.assert_almost_equal(b, np.array([[429., 5.], [2., 42.]]))
def weights(self): return npu.immutablecopyof(self._weights)
def unnormalised_weights(self): return npu.immutablecopyof(self._unnormalised_weights)
def resampled_particles(self): return npu.immutablecopyof(self._resampled_particles)
def prior_particles(self): return npu.immutablecopyof(self._prior_particles)