-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[cirq_web 3D circuit] X**0.5 and Y**0.5 look the same as X and Y #4761
Comments
The problem is that the symbols on the boxes are generated entirely based on Cirq/cirq-web/cirq_web/circuits/circuit.py Lines 86 to 91 in 4ebfb1c
As a comparison, the text representation of a circuit also consider the exponent: Cirq/cirq-core/cirq/circuits/circuit.py Lines 2468 to 2474 in 4ebfb1c
May I be assigned with this issue? I guess |
This pull request fixes the bug reported in #4761. The exponents of gates are not reflected in the labels of 3D circuits. This PR adds it using `CircuitDiagramInfo._wire_symbols_including_formatted_exponent`, which has been used in the generation of the text circuit diagrams. Another problem raises after the exponents are added. The color of the `X` gate is chosen as black, and the label's color is also black. As a result, the label cannot be recognized. To solve this problem, I set the label's color according to the brightness of the gate color. If it is dark (e.g., in the case of black), white is picked for the label. The color parameter for `MeshBasicMaterial` has also to be changed to avoid shadowing the label. After the modification, the test case used in the #4761 ``` import cirq_web a, b, c, d = cirq.GridQubit.rect(2, 2) cirq_web.Circuit3D(cirq.Circuit(cirq.X(a)**0.5, cirq.Y(b)**0.5, cirq.X(c), cirq.Y(d))).generate_html_file( file_name="hello.html") ``` generates this circuit:  close #4761
This pull request fixes the bug reported in quantumlib#4761. The exponents of gates are not reflected in the labels of 3D circuits. This PR adds it using `CircuitDiagramInfo._wire_symbols_including_formatted_exponent`, which has been used in the generation of the text circuit diagrams. Another problem raises after the exponents are added. The color of the `X` gate is chosen as black, and the label's color is also black. As a result, the label cannot be recognized. To solve this problem, I set the label's color according to the brightness of the gate color. If it is dark (e.g., in the case of black), white is picked for the label. The color parameter for `MeshBasicMaterial` has also to be changed to avoid shadowing the label. After the modification, the test case used in the quantumlib#4761 ``` import cirq_web a, b, c, d = cirq.GridQubit.rect(2, 2) cirq_web.Circuit3D(cirq.Circuit(cirq.X(a)**0.5, cirq.Y(b)**0.5, cirq.X(c), cirq.Y(d))).generate_html_file( file_name="hello.html") ``` generates this circuit:  close quantumlib#4761
This pull request fixes the bug reported in quantumlib#4761. The exponents of gates are not reflected in the labels of 3D circuits. This PR adds it using `CircuitDiagramInfo._wire_symbols_including_formatted_exponent`, which has been used in the generation of the text circuit diagrams. Another problem raises after the exponents are added. The color of the `X` gate is chosen as black, and the label's color is also black. As a result, the label cannot be recognized. To solve this problem, I set the label's color according to the brightness of the gate color. If it is dark (e.g., in the case of black), white is picked for the label. The color parameter for `MeshBasicMaterial` has also to be changed to avoid shadowing the label. After the modification, the test case used in the quantumlib#4761 ``` import cirq_web a, b, c, d = cirq.GridQubit.rect(2, 2) cirq_web.Circuit3D(cirq.Circuit(cirq.X(a)**0.5, cirq.Y(b)**0.5, cirq.X(c), cirq.Y(d))).generate_html_file( file_name="hello.html") ``` generates this circuit:  close quantumlib#4761
Description of the issue
The default look for
X**0.5
andY**0.5
look the same asX
andY
in the 3D circuit.How to reproduce the issue
Cirq version
You can get the cirq version by printing
cirq.__version__
. From the command line:0.13.1
The text was updated successfully, but these errors were encountered: