Skip to content
This repository has been archived by the owner on Jul 13, 2022. It is now read-only.

Commit

Permalink
Backend calibrations instantiation (qiskit-community#541)
Browse files Browse the repository at this point in the history
* * Added methodology in BackendCalibrations so that we can instantiate without a backend.

* * Added tests.

* * Lint

* Update qiskit_experiments/calibration_management/backend_calibrations.py

Co-authored-by: Naoki Kanazawa <[email protected]>

* Update qiskit_experiments/calibration_management/backend_calibrations.py

Co-authored-by: Naoki Kanazawa <[email protected]>

* * getattr

* * Protected method.

* * Merged BackendCalibrations into Calibrations.

* * Renamed the control_config to control_channel_map

* * Docstring for coupling map

* Update qiskit_experiments/calibration_management/calibrations.py

Co-authored-by: Naoki Kanazawa <[email protected]>

* * List of basis gate library.

* * Inst map updating.

* * Default cal values.

* * Operated qubits.

* * Fix doc.

* * Removed default_inst_map.

* * Type hint.

* * most_recent computation.

* * Removed unnecessary check.

* Update qiskit_experiments/calibration_management/calibrations.py

Co-authored-by: Will Shanks <[email protected]>

* * Docs.

* * Docs.

* * Backend name and version.

* * Docs.

* * Removed comment.

* * update_inst_map

* * Black.

* * renamed lo_freq to drive_freq and meas_freq

* * Renamed variables for consistency.

* Update qiskit_experiments/calibration_management/calibrations.py

Co-authored-by: Naoki Kanazawa <[email protected]>

* * Docs.

* * Robust name and version getting.

* * Lint and tests.

* * Reinstated default_inst_map

* * Test fix.

* * Updated tutorial.

* * Test fix.

* * Fix test.

* * Fix stragling BackendCalibrations in docs.

Co-authored-by: Naoki Kanazawa <[email protected]>
Co-authored-by: Will Shanks <[email protected]>
  • Loading branch information
3 people authored Dec 8, 2021
1 parent 102cfc2 commit b09f1bf
Show file tree
Hide file tree
Showing 24 changed files with 846 additions and 875 deletions.
166 changes: 83 additions & 83 deletions docs/tutorials/calibrating_armonk.ipynb

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions qiskit_experiments/calibration_management/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
.. autosummary::
:toctree: ../stubs/
BackendCalibrations
Calibrations
Managing Calibration Data
Expand Down Expand Up @@ -144,6 +143,5 @@
"""

from .calibrations import Calibrations
from .backend_calibrations import BackendCalibrations
from .base_calibration_experiment import BaseCalibrationExperiment
from .basis_gate_library import FixedFrequencyTransmon
431 changes: 0 additions & 431 deletions qiskit_experiments/calibration_management/backend_calibrations.py

This file was deleted.

10 changes: 5 additions & 5 deletions qiskit_experiments/calibration_management/basis_gate_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

from abc import ABC, abstractmethod
from collections.abc import Mapping
from typing import Any, Dict, List, Optional, Set, Tuple
from typing import Any, Dict, List, Optional, Set
from warnings import warn

from qiskit.circuit import Parameter
import qiskit.pulse as pulse
from qiskit.pulse import ScheduleBlock

from qiskit_experiments.calibration_management.calibration_key_types import ParameterValueType
from qiskit_experiments.calibration_management.calibration_key_types import DefaultCalValue
from qiskit_experiments.exceptions import CalibrationError


Expand Down Expand Up @@ -116,7 +116,7 @@ def basis_gates(self) -> List[str]:
return list(self._schedules)

@abstractmethod
def default_values(self) -> List[Tuple[ParameterValueType, Parameter, Tuple, ScheduleBlock]]:
def default_values(self) -> List[DefaultCalValue]:
"""Return the default values for the parameters.
Returns
Expand Down Expand Up @@ -261,7 +261,7 @@ def _single_qubit_schedule(

return sched

def default_values(self) -> List[Tuple[ParameterValueType, Parameter, Tuple, ScheduleBlock]]:
def default_values(self) -> List[DefaultCalValue]:
"""Return the default values for the parameters.
Returns
Expand All @@ -286,6 +286,6 @@ def default_values(self) -> List[Tuple[ParameterValueType, Parameter, Tuple, Sch
if "y" in name and param.name == "amp":
value *= 1.0j

defaults.append((value, param.name, tuple(), name))
defaults.append(DefaultCalValue(value, param.name, tuple(), name))

return defaults
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

"""Types used by the calibration module."""

from typing import Union
from typing import NamedTuple, Tuple, Union
from collections import namedtuple

from qiskit.circuit import ParameterExpression
Expand All @@ -21,3 +21,12 @@
ParameterKey = namedtuple("ParameterKey", ["parameter", "qubits", "schedule"])
ScheduleKey = namedtuple("ScheduleKey", ["schedule", "qubits"])
ParameterValueType = Union[ParameterExpression, float, int, complex]


class DefaultCalValue(NamedTuple):
"""Defines the structure of a default value."""

value: Union[float, int, complex]
parameter: str
qubits: Tuple
schedule_name: str
Loading

0 comments on commit b09f1bf

Please sign in to comment.