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

Stream line standard rb #391

Merged
merged 37 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
12a5972
streamline
Jun 7, 2023
249e1e0
Fix tests
vodovozovaliza Jun 8, 2023
054965a
Update src/qibocal/protocols/characterization/randomized_benchmarking…
wilkensJ Jun 8, 2023
329092e
Update src/qibocal/protocols/characterization/randomized_benchmarking…
wilkensJ Jun 8, 2023
313d70d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 8, 2023
c3df68d
Update src/qibocal/protocols/characterization/randomized_benchmarking…
wilkensJ Jun 8, 2023
7633224
Update src/qibocal/protocols/characterization/randomized_benchmarking…
wilkensJ Jun 8, 2023
1eeca6d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 8, 2023
14306d4
platform error when simulation prototype
Jacfomg Jun 8, 2023
58fc569
Merge branch 'standard_rb_streamline' of https://github.com/qiboteam/…
Jacfomg Jun 8, 2023
d5b3b9b
Minor fix
vodovozovaliza Jun 8, 2023
57586c1
fix tests
vodovozovaliza Jun 8, 2023
15f8612
Juans suggestions
Jun 8, 2023
b99f926
Merge branch 'standard_rb_streamline' of github.com:qiboteam/qibocal …
Jun 8, 2023
c516349
fix tests
vodovozovaliza Jun 8, 2023
10307b9
fix
Jacfomg Jun 8, 2023
9e158d5
Merge branch 'standard_rb_streamline' of https://github.com/qiboteam/…
Jacfomg Jun 8, 2023
5698826
Merge branch 'standard_rb_streamline' of github.com:qiboteam/qibocal …
Jun 8, 2023
a614b3c
Check platform for noise models
vodovozovaliza Jun 8, 2023
dbee570
Merge branch 'standard_rb_streamline' of https://github.com/qiboteam/…
vodovozovaliza Jun 8, 2023
9cefb47
minor change
vodovozovaliza Jun 8, 2023
1a0d7d4
Andrea's suggestions
vodovozovaliza Jun 9, 2023
3bb5ede
Minor change
vodovozovaliza Jun 9, 2023
d204e36
Fix tests
vodovozovaliza Jun 9, 2023
481a7e4
Fix lint warnings
vodovozovaliza Jun 9, 2023
6d2d573
Minor change
vodovozovaliza Jun 9, 2023
00d9807
Merge branch 'main' into standard_rb_streamline
vodovozovaliza Jun 12, 2023
87815fb
csv to json
vodovozovaliza Jun 12, 2023
f72a097
Fix tests
vodovozovaliza Jun 12, 2023
1173bb2
Delete actions_qq.yml
vodovozovaliza Jun 12, 2023
535049b
Revert "Delete actions_qq.yml"
vodovozovaliza Jun 12, 2023
04870bc
Delete actions_qq_auto.yml
vodovozovaliza Jun 12, 2023
8d324e7
Set global backend
vodovozovaliza Jun 12, 2023
75b6e98
Minor change
vodovozovaliza Jun 12, 2023
e4cd130
Remove `nqubits`
vodovozovaliza Jun 12, 2023
639ea3c
Remove optional nqubits from `setup_scan`
vodovozovaliza Jun 12, 2023
aeda2ff
Fix coverage
vodovozovaliza Jun 12, 2023
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
4 changes: 2 additions & 2 deletions runcards/actions_qq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ actions:
# freq_width: 10_000_000
# freq_step: 400_000

# - id: Standard RB
# - id: standard rb
# priority: 0
# operation: standard_rb
# qubits: [1]
# parameters:
# nqubits: 5
# qubits: [1]
# depths: [1,3,5,10,15,20,30]
# niter: 20
# nshots: 128
Expand Down
3 changes: 2 additions & 1 deletion src/qibocal/auto/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from dataclasses import dataclass, fields
from typing import Callable, Dict, Generic, NewType, TypeVar, Union

from qibolab.platform import Platform
from qibolab.qubits import Qubit

OperationId = NewType("OperationId", str)
Expand Down Expand Up @@ -147,7 +148,7 @@ class DummyRes(Results):
"""Dummy results."""


def _dummy_acquisition(pars: DummyPars) -> DummyData:
def _dummy_acquisition(pars: DummyPars, platform: Platform) -> DummyData:
return DummyData()


Expand Down
3 changes: 2 additions & 1 deletion src/qibocal/auto/runcard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pydantic import Field
from pydantic.dataclasses import dataclass
from qibo.backends import Backend, construct_backend
from qibo.backends import Backend, construct_backend, set_backend
from qibolab.platform import Platform
from qibolab.qubits import QubitId

Expand Down Expand Up @@ -53,6 +53,7 @@ class Runcard:
@cached_property
def backend_obj(self) -> Backend:
"""Allocate backend."""
set_backend(self.backend, self.platform)
return construct_backend(self.backend, self.platform)
Comment on lines +56 to 57
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stavros11 this is a temporary solution.
I don't know if there is a better way to do it. Currently it was not working since for the RB when executing circuits we don't pass the backend and by doing circuit() we will fall back to the default backend.
Currently I feel like this approach is a bit redundant. Do you have any suggestions?


@property
Expand Down
4 changes: 1 addition & 3 deletions src/qibocal/auto/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ def run(self, folder: Path, platform: Platform, qubits: Qubits) -> Results:
self.qubits = list(qubits)

else:
self._data: Data = operation.acquisition(
parameters,
)
self._data: Data = operation.acquisition(parameters, platform=platform)
self._data.to_csv(path)
# TODO: data dump
# path.write_text(yaml.dump(pydantic_encoder(self.data(base_dir))))
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def fit_exp1B_func(
)
perr = tuple(np.sqrt(np.diag(pcov)))
except Exception as e:
log.warning(f"Ap^x+B fit: the fitting was not succesful. {e}")
log.warning("Ap^x+B fit: the fitting was not succesful. %s", e)
popt, perr = (0, 0, 0), (0, 0, 0)
return popt, perr

Expand Down Expand Up @@ -158,7 +158,7 @@ def fit_exp1_func(
popt, pcov = curve_fit(exp1_func, xdata, ydata, **kwargs)
perr = tuple(np.sqrt(np.diag(pcov)))
except Exception as e:
log.warning(f"Ap^x fit: the fitting was not succesful. {e}")
log.warning("Ap^x fit: the fitting was not succesful. %s", e)
popt, perr = (0, 0), (0, 0)

return popt, perr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
They inherit from the qibo noise NoiseModel module and are prebuild.
"""

from typing import Optional

import numpy as np
from qibo import gates
from qibo.noise import NoiseModel, PauliError
Expand All @@ -17,25 +19,25 @@ class PauliErrorOnAll(NoiseModel):
are drawn (in sum not bigger than 1).
"""

def __init__(self, *args) -> None:
def __init__(self, probabilities: Optional[list] = None) -> None:
super().__init__()
# Check if number of arguments is 0 or 1 and if it's equal to None
if len(args) == 0 or (len(args) == 1 and args[0] is None):
if not probabilities:
# Assign random values to params.
params = np.random.uniform(0, 0.25, size=3)
elif len(args) == 3:
params = args
self.params = np.random.uniform(0, 0.25, size=3).round(3)
elif len(probabilities) == 3:
self.params = probabilities
else:
# Raise ValueError if given paramters are wrong.
raise_error(
ValueError,
f"Wrong number of error parameters, 3 != {len(args)}.",
f"Wrong number of error parameters, 3 != {len(probabilities)}.",
)
self.build(*params)
self.build()

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


class PauliErrorOnX(PauliErrorOnAll):
Expand All @@ -46,5 +48,5 @@ class PauliErrorOnX(PauliErrorOnAll):
are drawn (in sum not bigger than 1).
"""

def build(self, *params):
self.add(PauliError(list(zip(["X", "Y", "Z"], params))), gates.X)
def build(self):
self.add(PauliError(list(zip(["X", "Y", "Z"], self.params))), gates.X)

This file was deleted.

This file was deleted.

Loading