def test_center_slice_error_model_generate_seeded(): code = FiveQubitCode() lim = (0, 0, 1) pos = 0.5 error_model = CenterSliceErrorModel(lim, pos) probability = 0.1 error1 = error_model.generate(code, probability, np.random.default_rng(5)) error2 = error_model.generate(code, probability, np.random.default_rng(5)) assert np.array_equal( error1, error2), 'Identically seeded errors are not the same.'
def test_center_slice_error_model_generate(): code = FiveQubitCode() lim = (0, 0, 1) pos = 0.5 error_model = CenterSliceErrorModel(lim, pos) probability = 0.1 error = error_model.generate(code, probability) assert len(error) == code.n_k_d[ 0] * 2, 'Error length is not twice number of physical qubits.' assert issubclass(error.dtype.type, np.integer), 'Error is not integer array.' assert set(np.unique(error)).issubset({0, 1}), 'Error is not binary.'