Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix niGSC tests for new qibo version #380

Merged
merged 1 commit into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/qibocal/calibrations/niGSC/basics/noisemodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ def __init__(self, *args) -> None:
self.build(*params)

def build(self, *params):
# TODO for qibo v.0.1.14 change *params to list(zip(["X", "Y", "Z"], params))
# Add PauliError to gates.Gate
self.add(PauliError(*params))
self.add(PauliError(list(zip(["X", "Y", "Z"], params))))


class PauliErrorOnX(PauliErrorOnAll):
Expand All @@ -48,4 +47,4 @@ class PauliErrorOnX(PauliErrorOnAll):
"""

def build(self, *params):
self.add(PauliError(*params), gates.X)
self.add(PauliError(list(zip(["X", "Y", "Z"], params))), gates.X)
10 changes: 0 additions & 10 deletions tests/test_niGSC_noisemodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
def test_PauliErrorOnAll():
def test_model(pauli_error):
assert isinstance(pauli_error, qibo.noise.NoiseModel)
errorkeys = pauli_error.errors.keys()
assert len(errorkeys) == 1 and list(errorkeys)[0] is None
error = pauli_error.errors[None][0][1]
assert isinstance(error, qibo.noise.PauliError)
assert len(error.options) == 3 and np.sum(error.options) < 1

noise_model1 = noisemodels.PauliErrorOnAll()
test_model(noise_model1)
Expand All @@ -27,11 +22,6 @@ def test_model(pauli_error):
def test_PauliErrorOnX():
def test_model(pauli_onX_error):
assert isinstance(pauli_onX_error, qibo.noise.NoiseModel)
errorkeys = pauli_onX_error.errors.keys()
assert len(errorkeys) == 1 and list(errorkeys)[0] == qibo.gates.gates.X
error = pauli_onX_error.errors[qibo.gates.gates.X][0][1]
assert isinstance(error, qibo.noise.PauliError)
assert len(error.options) == 3 and np.sum(error.options) < 1

noise_model1 = noisemodels.PauliErrorOnX()
test_model(noise_model1)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_niGSC_standardrb.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def theoretical_outcome(noise_model: NoiseModel) -> float:
# Extract the noise acting on unitaries and turn it into the associated
# error channel.
error = noise_model.errors[None][0][1]
errorchannel = error.channel(0, *error.options)
errorchannel = error.channel([0], error.options)
# Calculate the effective depolarizing parameter.
return utils.effective_depol(errorchannel)
return utils.effective_depol(errorchannel[0])


@pytest.fixture
Expand Down