-
Notifications
You must be signed in to change notification settings - Fork 35
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
404 stim compatibility #405
404 stim compatibility #405
Conversation
StimCodeCircuit takes a stim circuit and converts it into a CodeCircuit class with the usual methods and attributes like circuit, d, n, string2nodes(), _make_syndrome_graph()
New methods to remove the redundancy between the former stim_circuit_with_detectors method and string2nodes: - stim_detectors: constructs detector information for CSS codes too be used by (i) the stim circuit, (ii) the new string2nodes method - string2nodes: converts measurement outcome strings into DecodingGraphNode-s (as before), but now using the abstract detector information from stim_detectors.
Updates to previously existing functions and adding string2nodes_with_detectors get_stim_circuits: - takes a qiskit circuit or a list thereof (formerly a dictionary) - uses abstract detector information to create the detectors of the stim circuit (before this function did not add any detectors, it has been done by a CSSCodeCircuit method) detector_error_model_to_rx_graph: - uses the iter_flatten_model function to handle stim RepeatBlocks (needed in the new StimCodeCircuit class) - uses more info for the annotations os DecodingGraphNode-s string2nodes_with_detectors: - uses the same abstract detector info as the get_stim_circuit to convert output strings into DecodingGraphNode-s noisify_circuit: - handles costum "idle_#" gates which can be used to add idling errors into the circuit, e.g., during measurements
Updating the test according to the new stim circuit construction, i.e., get detectors and logicals and use the get_stim_circuits function from utils
black...
Adding string2rawlogicals_with_detectors to be used by the CSS and Stim CodeCircuit classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string2rawlogicals_with_detectors should return a bool whether or not the logical is flipped not the logical nodes.
string2logical_meas converts an output string into raw logical outcomes using the stim-style logicals (list of dictionaries) and the clbit list of the QuantumCircuit.
Adding the method string2raw_logicals to be used by the qiskit-qec decoders.
Adding the method string2raw_logicals to be used by the qiskit-qec decoders.
linting
linting
typo, tab was missing...
linting, new part
Merging manually the PR from James (into my 404 branch). It contained linting and simplification of the get_stim_circuits() arguments, i.e., detectors/logicals can only be a list of dictionaries from now
linting, new parts
string in the beginning of the file made the lint test fail: ' lint: commands[1]> black --check --diff src/qiskit_qec intern test setup.py error: cannot format src/qiskit_qec/circuits/stim_code_circuit.py: Cannot parse: 17:0: """Generates code circuits classes for Stim circuits.""" '
linting...
* Update stim_code_circuit.py * Update stim_tools.py * Update stim_tools.py * more linting * remove decoder dependence on css_logical * final linting (hopefully)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! Thanks a lot for the PR! I've seen that we have the docs test failing, and I tried to fix it on my end to help. The problem is only because of a couple of changes in the docstrings. I left three comments to help find the problems with the CI. I hope we get it fixed with that :)
* Update stim_code_circuit.py * Update stim_tools.py * Update stim_tools.py * more linting * remove decoder dependence on css_logical * final linting (hopefully) * fix docs
Thank you @arnaucasau for the comments, and thanks @quantumjim for fixing most of the docs! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We finally have a green tick! Merge, merge, merge!!!!!1!!1!!11!!!!one!!!!
Adding a StimCodeCircuit class to convert stim circuits into qiskit circuits with the useful features expected from a qiskit-qec CodeCircuit.
This PR also includes a couple of updates to the previous 339-integrate-stim PR, like creating an abstract detector information in both the CSS and the Stim CodeCircuit classes which is then used by the stim circuits as well as the string2nodes methods
See detailed comments under the commits.