Skip to content

cirq-web shows a blank window for circuits with no-target operations #5172

@Strilanc

Description

@Strilanc

It would be reasonable to ignore no-target operations, as they are usually some sort of unobservable annotation. But currently cirq-web crashes instead.

Run this python code and then open the generated page and look at the browser console:

import stim
import stimcirq
import cirq_web

stim_circuit = stim.Circuit("""
    QUBIT_COORDS(0, 0) 0
    M 0
    DETECTOR rec[-1]
""")
cirq_circuit = stimcirq.stim_circuit_to_cirq_circuit(stim_circuit)
cirq_web.Circuit3D(cirq_circuit).generate_html_file(
    file_name="stim_circuit_viewer.html",
    open_in_browser=True,
)

The python code succeeds, but the browser console says:

Uncaught TypeError: Cannot read properties of undefined (reading 'row')
    at stim_circuit_viewer.html:5:625129
    at Array.forEach (<anonymous>)
    at s.buildAndAddMeshesToGroup (stim_circuit_viewer.html:5:624903)
    at new s (stim_circuit_viewer.html:5:624781)
    at addSymbol (stim_circuit_viewer.html:5:625961)
    at new a (stim_circuit_viewer.html:5:625922)
    at t.createGridCircuit (stim_circuit_viewer.html:5:629078)
    at stim_circuit_viewer.html:9:56

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions