Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Update twoQ_clifford_error function #368

Conversation

nkanazawa1989
Copy link
Contributor

Summary

fix #367

Details and comments

  • internally convert gate count dictionary into list of gate counts by assuming the conventional (u1, u2, u3, cx) gate set and qubit ordering.
  • unittest is updated.

@nkanazawa1989
Copy link
Contributor Author

nkanazawa1989 commented Mar 25, 2020

I added both

  • calculate_1q_epc (input EPG from error model -> output EPC)
  • calculate_2q_epc (input EPG from error model -> output 2Q EPC out of entire sequence)

which have interfaces conform to

  • calculate_1q_epg (input EPC -> output EPG)
  • calculate_2q_epg (input EPC -> output 2Q EPG)

As @ShellyGarion mentioned in #367, *_epc funcs can be used for validation, while *_epg funcs can be used for evaluating calibration.

@nkanazawa1989
Copy link
Contributor Author

added deprecation warning to the old twoQ_clifford_error, but this function is also updated to take new gate count input in dictionary format.

chriseclectic
chriseclectic previously approved these changes Mar 25, 2020
Copy link
Collaborator

@chriseclectic chriseclectic left a comment

Choose a reason for hiding this comment

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

LGTM. Couple of non-blocking comments if you would like to change, and a question

warn('The function `count_gates` will be deprecated. '
'Gate count is integrated into `gates_per_clifford` function.',
DeprecationWarning)
warn('The function `count_gates` will be deprecated. \
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's better to break the string over multiple lines like this was previously.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed signature of QiskitError is *message and we can feed multiple lines, but that of warnings is message, category=None, stacklevel=1, source=None. for warnings we need to feed one long message with \.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't actually the case, @chriseclectic is correct the \ here is not necessary and I'm actually surprised that one of the linters didn't complain about it. You can break the string over multiple lines as long as it's inside parenthesis. It will automatically concatenate any strings until the first , which indicates the next argument. This is pretty easy to test in the Python REPL too if you want to test it.

Copy link
Contributor Author

@nkanazawa1989 nkanazawa1989 Mar 27, 2020

Choose a reason for hiding this comment

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

@mtreinish Thanks for following up. I ran local tox -epy36 test and it caused an error due to this (as far as I remember that was a type error). I tried to reproduce this but the test passed after git clean -fdX. Maybe something odd was happening in my local env. If you want I'll make another PR to remove \.

@nkanazawa1989
Copy link
Contributor Author

@chriseclectic thanks for reviewing. updated and replied to your questions.

@chriseclectic chriseclectic merged commit a2e1f4d into qiskit-community:master Mar 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to update twoQ_clifford_error function
3 participants