Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
rodolfocarobene committed Jun 5, 2023
2 parents 0e62cb8 + 5d5b713 commit 0a7c097
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 23 deletions.
11 changes: 5 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ Pint-Pandas = "^0.3"
dash = "^2.6.0"
lmfit = "^1.0.3"
skops = "^0.6.0"
scikit-learn = "^1.2.1"
# docs dependencies (for readthedocs, https://github.com/readthedocs/readthedocs.org/issues/4912#issuecomment-664002569)
Sphinx = { version = "^5.0.0", optional = true }
furo = { version = "^2023.3.27", optional = true }
sphinxcontrib-bibtex = { version = "^2.4.1", optional = true }
recommonmark = { version = "^0.7.1", optional = true }
sphinx_markdown_tables = { version = "^0.0.17", optional = true }
scikit-learn = { version = "^1.2.1", optional = true}
keras-tuner = { version = "^1.3.0,<1.3.1", optional = true, markers = "sys_platform == 'linux' or sys_platform == 'darwin'"}
matplotlib = { version = "^3.7.0", optional = true }
seaborn = { version = "^0.12.2", optional = true }
Expand Down Expand Up @@ -74,7 +74,7 @@ devtools = "^0.10.0"

[tool.poetry.extras]

classify = ["scikit-learn", "tensorflow", "keras-tuner", "matplotlib", "seaborn", "skl2onnx", "onnxruntime", "onnx"]
classify = ["tensorflow", "keras-tuner", "matplotlib", "seaborn", "skl2onnx", "onnxruntime", "onnx"]
docs = [
"sphinx",
"furo",
Expand Down
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

0 comments on commit 0a7c097

Please sign in to comment.