Skip to content

Conversation

@Strilanc
Copy link
Collaborator

@Strilanc Strilanc commented Feb 23, 2021

Example:

import cirq
import stim_cirq
a, b = cirq.LineQubit.range(2)
c = cirq.Circuit(
    cirq.H(a),
    cirq.CNOT(a, b),
    cirq.measure(a),
    cirq.measure(b),
)
sampler = stim_cirq.StimSampler()
result = sampler.run(c, repetitions=10)
print(result)

@Strilanc Strilanc merged commit da9a868 into main Feb 23, 2021
@Strilanc Strilanc deleted the cirqglue branch February 23, 2021 21:28
Strilanc added a commit that referenced this pull request Jan 30, 2022
- Add `stim.Circuit.get_detector_coordinates`
- Add `stim.Circuit.get_final_qubit_coordinates`
- Add `stim.DetectorErrorModel.get_detecetor_coordinates`
- Rename `MatchedError` to `ExplainedError`
- Rename `match_errors` command line mode to `explain_errors
- Move `vec_pad_add_mul` to `stim::` namespace
- Make asking for coordinates of impossible detector ids an error
- Add `stim::DetectorErrorModel::final_detector_and_coord_shift`
- Re-order measurement errors to be "more complicated" than unitary errors when reducing to single errors

Example usage:

```
>>> import stim
>>> circuit = stim.Circuit('''
...     # Create Bell pair.
...     H 0
...     CNOT 0 1
...
...     # Noise.
...     DEPOLARIZE1(0.01) 0
...
...     # Bell basis measurement.
...     CNOT 0 1
...     H 0
...     M 0 1
...
...     # Both measurements should be False under noiseless execution.
...     DETECTOR rec[-1]
...     DETECTOR rec[-2]
... ''')
>>> explained_errors = circuit.explain_detector_error_model_errors(
...     dem_filter=stim.DetectorErrorModel('error(1) D0 D1'),
...     reduce_to_one_representative_error=True,
... )
>>> print(explained_errors[0].circuit_error_locations[0])
CircuitErrorLocation {
    flipped_pauli_product: Y0
    Circuit location stack trace:
        (after 0 TICKs)
        at instruction #3 (DEPOLARIZE1) in the circuit
        at target #1 of the instruction
        resolving to DEPOLARIZE1(0.01) 0
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants