Skip to content

Conversation

@95-martin-orion
Copy link
Collaborator

This PR adds Z phase angles for sqrt-ISWAP gates and tools for accessing them. Follow-up to #5364.

Z phase angles are captured in a different calibration process than the other error metrics, and thus require a slightly different pipeline to access them. Key points to note about this data:

  • This only includes zeta and gamma, as theta and phi already appear in the QCS metrics and chi is not currently captured by any calibration process we use.
  • Qubit (6, 1) was in a bad state when the Weber data was taken, and thus has no Z phase angles in the sample data. The pipeline will treat this as zeta=gamma=0 for gates touching this qubit.

@CirqBot CirqBot added the size: XL lines changed >1000 label May 19, 2022
@95-martin-orion
Copy link
Collaborator Author

CC @vcatherine

if TYPE_CHECKING:
import cirq

_ZPhaseData = Dict[str, Dict[str, Dict[Tuple[ops.Qid, ...], float]]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Optional: Do you think it is better to call this _ZPhaseDataType?

Also, it might be good to document what the keys of this dict of dict of dict is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

When I made this, I didn't realize we already had PhasedFSimCalibrationResult which uses a different structure but fulfills the same purpose. Do you think converting to that would help? (Converting may also be useful for #5397)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure. That class has some extra stuff like an associated EngineJob and Calibration which may not be relevant. I like the idea of using a typed class rather than a complicated nest of dictionaries though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tried making this a class, but it didn't help much (mostly ended up being a wrapper around the same nest of dicts). Opted instead to move the type to util, add a docstring, and share it between the files in this PR.


# 5. Extract entangling angle errors.
fsim_errors = {}
gate_zphase_code_pairs: Dict[Type['cirq.Gate'], str] = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be a CONSTANT and put at the top?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done for this and similar constants in the function. (Also made gate_times_ns an argument to partially address the dangling TODO)

'weber': 1635923188204, # 2021-11-03 07:06:28.204 UTC
}

ZPHASE_DATA = {'rainbow': 'rainbow_zphase.json', 'weber': 'weber_zphase.json'}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am a little concerned about the naming scheme here. Do you think we should put in an extra qualifier, such as 'rainbow_sample_zphase.json' or 'rainbow_average_zphase.json' in case we need to distinguish it from data from a specific day?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Found and added dates for these.

}

ZPHASE_DATA = {'rainbow': 'rainbow_zphase.json', 'weber': 'weber_zphase.json'}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to add these files to a package somewhere so they get packaged up correctly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These are under cirq/devices/calibrations, which is already packaged in setup.py.

Copy link
Collaborator

@dstrain115 dstrain115 left a comment

Choose a reason for hiding this comment

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

A few nits, but otherwise seems fine to me.

# TODO: acquire this based on the target device.
# Default map of gates to their durations.
DEFAULT_GATE_NS: Dict[Type['cirq.Gate'], float] = {
ops.ZPowGate: 25.0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this correct? ZPow should generally be zero unless it is a physical Z.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this is for physical Z. Virtual Z is handled deeper in the noise models.

@95-martin-orion 95-martin-orion added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 8, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 8, 2022
@CirqBot CirqBot merged commit b98bd87 into quantumlib:master Jun 8, 2022
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jun 8, 2022
@95-martin-orion 95-martin-orion deleted the median-entanglers branch June 9, 2022 16:47
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
This PR adds Z phase angles for sqrt-ISWAP gates and tools for accessing them. Follow-up to quantumlib#5364.

Z phase angles are captured in a different calibration process than the other error metrics, and thus require a slightly different pipeline to access them. Key points to note about this data:
- This only includes zeta and gamma, as theta and phi already appear in the QCS metrics and chi is not currently captured by any calibration process we use.
- Qubit (6, 1) was in a bad state when the Weber data was taken, and thus has no Z phase angles in the sample data. The pipeline will treat this as zeta=gamma=0 for gates touching this qubit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XL lines changed >1000

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants