I've copied these lines from Stim's Getting Started notebook:

circuit = stim.Circuit.generated(
dem = circuit.detector_error_model()

but when I run it the final line gives an error:

TypeError                                 Traceback (most recent call last)
Cell In[99], line 8
      1 circuit = stim.Circuit.generated(
      2     "repetition_code:memory",
      3     rounds=30,
      4     distance=9,
      5     before_round_data_depolarization=0.03,
      6     before_measure_flip_probability=0.01)
      7 dem = circuit.detector_error_model()
----> 8 dem.diagram("matchgraph-svg")

TypeError: diagram(): incompatible function arguments. The following argument types are supported:
    1. (self: stim._stim_avx2.DetectorErrorModel, *, type: str) -> stim._stim_avx2._DiagramHelper

Invoked with: stim.DetectorErrorModel('''
    error(0.02) D0
    error(0.02) D0 D1
    error(0.01) D0 D8
    error(0.02) D1 D2
    error(0.01) D1 D9
    error(0.02) D2 D3
    error(0.01) D2 D10
    error(0.02) D3 D4
    error(0.01) D3 D11
    detector(9, 1) D20
    detector(11, 1) D21
    detector(13, 1) D22
    detector(15, 1) D23
'''), 'matchgraph-svg'

1 Answer 1


print(stim.__version__) and confirm you're on v1.11 or later. Probably you're on v1.10; the getting started notebook was bumped to v1.11 last week and one of the changes was the removal of type= as a required keyword argument for diagram methods.

The pip install line in the notebook does include the minimum version.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.