Skip to content
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

Tagging noise operations clutters the circuit output #2905

Open
mpharrigan opened this issue Apr 14, 2020 · 9 comments
Open

Tagging noise operations clutters the circuit output #2905

mpharrigan opened this issue Apr 14, 2020 · 9 comments
Labels
area/circuits area/noise area/visualization kind/bug-report Something doesn't seem to work. kind/health For CI/testing/release process/refactoring/technical debt items triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on

Comments

@mpharrigan
Copy link
Collaborator

The extra [] are from the tag, I think

xref #2719

0: ───X───D(0.005)[]───H────────D(0.005)[]───

1: ───X───D(0.005)[]───H────────D(0.005)[]───

2: ───────D(0.005)[]───H────────D(0.005)[]───

3: ───────D(0.005)[]───X^-0.5───D(0.005)[]───
@dabacon
Copy link
Collaborator

dabacon commented May 8, 2020

This is when you add the noise to the circuit? I think that should remove the tags.

@mpharrigan
Copy link
Collaborator Author

Interestingly, this is more broken than I first thought. In the terminal it displays as

(0, 0): ───I───D(0.001)[<virtual>]───I───D(0.001)[<virtual>]───I───D(0.001)[<virtual>]───

(0, 1): ───I───D(0.001)[<virtual>]───I───D(0.001)[<virtual>]───I───D(0.001)[<virtual>]───

(0, 2): ───I───D(0.001)[<virtual>]───I───D(0.001)[<virtual>]───I───D(0.001)[<virtual>]───

but the <virtual> tags are interpreted as badly formed html tags in e.g. Jupyter notebook and are not displayed. In the SVGCircuit implementation, the virtual tag hides the closing ]

@dabacon
Copy link
Collaborator

dabacon commented May 28, 2020

For physical versus virtual Z gates, clearly seeing the tag is important. But for noice, I'm not sure this is correct, and as I say in #2984 I don't think we should reuse virtual in this form for noise. It is re-using a tag for no real reason.

@mpharrigan
Copy link
Collaborator Author

Based on the above, the "virtual" specifier probably gets eaten in jupyter notebook for virtual Z gates then

mpharrigan added a commit to mpharrigan/Cirq that referenced this issue Jun 5, 2020
@mpharrigan
Copy link
Collaborator Author

The behavior has changed. It now does D(0.001)[cirq.VirtualTag()]

@mpharrigan
Copy link
Collaborator Author

I'm contributing a hack in https://github.com/quantumlib/Cirq/pull/3076/files#diff-d949b9f3211c62c5defeb9f7d1439416R16 which should be reverted after this is fixed

CirqBot pushed a commit that referenced this issue Jun 9, 2020
 - Specify the font. This should not be a change for viewing in Jupyter notebook but fixes opening the svg data in e.g. inkscape where the default font is different and the boxes aren't the right size
 - Don't display virtual tags (for noise) xref #2905
MichaelBroughton added a commit that referenced this issue Jun 12, 2020
* [SVG] Noise hack and font fix (#3076)


 - Specify the font. This should not be a change for viewing in Jupyter notebook but fixes opening the svg data in e.g. inkscape where the default font is different and the boxes aren't the right size
 - Don't display virtual tags (for noise) xref #2905

* Support multi-qubit measurement in plot_state_histogram (#3054)

* Add generated code for batch.proto (#3086)

Review: @dstrain115

* Fix flakes in random_circuit_test (#3084)

* Added api docs gen (copy from TFQ).

* updated site_path prefix.

* removed pre-built.

* rename.

* move to dev_tools.

* removed __future__ and formatting.

* yet more formatting.

Co-authored-by: Matthew Harrigan <[email protected]>
Co-authored-by: Animesh Sinha <[email protected]>
Co-authored-by: Matthew Neeley <[email protected]>
Co-authored-by: Dave Bacon <[email protected]>
MichaelBroughton added a commit that referenced this issue Jun 12, 2020
* [SVG] Noise hack and font fix (#3076)


 - Specify the font. This should not be a change for viewing in Jupyter notebook but fixes opening the svg data in e.g. inkscape where the default font is different and the boxes aren't the right size
 - Don't display virtual tags (for noise) xref #2905

* Support multi-qubit measurement in plot_state_histogram (#3054)

* Add generated code for batch.proto (#3086)

Review: @dstrain115

* Fix flakes in random_circuit_test (#3084)

* Fix Quirk import extra gates bug

* Move image files to docs/images/

* Move unneeded site assets

* Move Sphinx templates, Makefile, conf, and init

* Added api docs gen (copy from TFQ). (#3089)

* [SVG] Noise hack and font fix (#3076)


 - Specify the font. This should not be a change for viewing in Jupyter notebook but fixes opening the svg data in e.g. inkscape where the default font is different and the boxes aren't the right size
 - Don't display virtual tags (for noise) xref #2905

* Support multi-qubit measurement in plot_state_histogram (#3054)

* Add generated code for batch.proto (#3086)

Review: @dstrain115

* Fix flakes in random_circuit_test (#3084)

* Added api docs gen (copy from TFQ).

* updated site_path prefix.

* removed pre-built.

* rename.

* move to dev_tools.

* removed __future__ and formatting.

* yet more formatting.

Co-authored-by: Matthew Harrigan <[email protected]>
Co-authored-by: Animesh Sinha <[email protected]>
Co-authored-by: Matthew Neeley <[email protected]>
Co-authored-by: Dave Bacon <[email protected]>

* Move doc tools to /dev_tools/docs/

* Move examples index into tutorials/

* Move basics tutorial into tutorials/

* Encode URL bracket so not mistaken for template.

* Update references to moves docs and image files.

* Update references to docs_coverage_test.py

* Format py with check/format-incremental --apply

* Move Sphinx RST files

* Add _index.yaml for site

* Add initial _book.yaml for leftnav

* Manually format docs/_sphinx/conf.py for CI

* Update references to moved api.rst file

* Move docs/_sphinx to dev_tools/docs/sphinx

* Update README.rst path for snippets_test.py

* Move run_doctest to dev_tools/docs/

* Move build-docs.sh to dev_tools/docs/sphinx/

* Update references to build-docs.sh

* Remove build_docs CI test

Co-authored-by: Matthew Harrigan <[email protected]>
Co-authored-by: Animesh Sinha <[email protected]>
Co-authored-by: Matthew Neeley <[email protected]>
Co-authored-by: Dave Bacon <[email protected]>
Co-authored-by: Matteo Pompili <[email protected]>
Co-authored-by: MichaelBroughton <[email protected]>
balopat pushed a commit to balopat/Cirq that referenced this issue Aug 18, 2020
* [SVG] Noise hack and font fix (quantumlib#3076)

 - Specify the font. This should not be a change for viewing in Jupyter notebook but fixes opening the svg data in e.g. inkscape where the default font is different and the boxes aren't the right size
 - Don't display virtual tags (for noise) xref quantumlib#2905

* Support multi-qubit measurement in plot_state_histogram (quantumlib#3054)

* Add generated code for batch.proto (quantumlib#3086)

Review: @dstrain115

* Fix flakes in random_circuit_test (quantumlib#3084)

* Added api docs gen (copy from TFQ).

* updated site_path prefix.

* removed pre-built.

* rename.

* move to dev_tools.

* removed __future__ and formatting.

* yet more formatting.

Co-authored-by: Matthew Harrigan <[email protected]>
Co-authored-by: Animesh Sinha <[email protected]>
Co-authored-by: Matthew Neeley <[email protected]>
Co-authored-by: Dave Bacon <[email protected]>
balopat pushed a commit to balopat/Cirq that referenced this issue Aug 18, 2020
* [SVG] Noise hack and font fix (quantumlib#3076)

 - Specify the font. This should not be a change for viewing in Jupyter notebook but fixes opening the svg data in e.g. inkscape where the default font is different and the boxes aren't the right size
 - Don't display virtual tags (for noise) xref quantumlib#2905

* Support multi-qubit measurement in plot_state_histogram (quantumlib#3054)

* Add generated code for batch.proto (quantumlib#3086)

Review: @dstrain115

* Fix flakes in random_circuit_test (quantumlib#3084)

* Fix Quirk import extra gates bug

* Move image files to docs/images/

* Move unneeded site assets

* Move Sphinx templates, Makefile, conf, and init

* Added api docs gen (copy from TFQ). (quantumlib#3089)

* [SVG] Noise hack and font fix (quantumlib#3076)

 - Specify the font. This should not be a change for viewing in Jupyter notebook but fixes opening the svg data in e.g. inkscape where the default font is different and the boxes aren't the right size
 - Don't display virtual tags (for noise) xref quantumlib#2905

* Support multi-qubit measurement in plot_state_histogram (quantumlib#3054)

* Add generated code for batch.proto (quantumlib#3086)

Review: @dstrain115

* Fix flakes in random_circuit_test (quantumlib#3084)

* Added api docs gen (copy from TFQ).

* updated site_path prefix.

* removed pre-built.

* rename.

* move to dev_tools.

* removed __future__ and formatting.

* yet more formatting.

Co-authored-by: Matthew Harrigan <[email protected]>
Co-authored-by: Animesh Sinha <[email protected]>
Co-authored-by: Matthew Neeley <[email protected]>
Co-authored-by: Dave Bacon <[email protected]>

* Move doc tools to /dev_tools/docs/

* Move examples index into tutorials/

* Move basics tutorial into tutorials/

* Encode URL bracket so not mistaken for template.

* Update references to moves docs and image files.

* Update references to docs_coverage_test.py

* Format py with check/format-incremental --apply

* Move Sphinx RST files

* Add _index.yaml for site

* Add initial _book.yaml for leftnav

* Manually format docs/_sphinx/conf.py for CI

* Update references to moved api.rst file

* Move docs/_sphinx to dev_tools/docs/sphinx

* Update README.rst path for snippets_test.py

* Move run_doctest to dev_tools/docs/

* Move build-docs.sh to dev_tools/docs/sphinx/

* Update references to build-docs.sh

* Remove build_docs CI test

Co-authored-by: Matthew Harrigan <[email protected]>
Co-authored-by: Animesh Sinha <[email protected]>
Co-authored-by: Matthew Neeley <[email protected]>
Co-authored-by: Dave Bacon <[email protected]>
Co-authored-by: Matteo Pompili <[email protected]>
Co-authored-by: MichaelBroughton <[email protected]>
tonybruguier pushed a commit to tonybruguier/Cirq that referenced this issue Aug 23, 2020
 - Specify the font. This should not be a change for viewing in Jupyter notebook but fixes opening the svg data in e.g. inkscape where the default font is different and the boxes aren't the right size
 - Don't display virtual tags (for noise) xref quantumlib#2905
@balopat
Copy link
Contributor

balopat commented Sep 1, 2020

[[ Note to self: don't include issue reference in a commit message. It will keep spamming the issue from every fork that rebases the commit :) ]]

@balopat balopat added area/circuits area/noise area/visualization kind/bug-report Something doesn't seem to work. triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on kind/health For CI/testing/release process/refactoring/technical debt items labels Sep 21, 2020
@MichaelBroughton
Copy link
Collaborator

Is this still relevant @mpharrigan ?

@mpharrigan
Copy link
Collaborator Author

The notebook isn't broken, but it's still pretty cluttery

c2 = cirq.Circuit(cirq.ConstantQubitNoiseModel(cirq.depolarize(0.005)).noisy_moments(c.moments, [q]))
c2
Out[15]: 0: ───X───D(0.005)[cirq.VirtualTag()]───X───D(0.005)[cirq.VirtualTag()]───X───D(0.005)[cirq.VirtualTag()]───X───D(0.005)[cirq.VirtualTag()]───X───D(0.005)[cirq.VirtualTag()]───

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/circuits area/noise area/visualization kind/bug-report Something doesn't seem to work. kind/health For CI/testing/release process/refactoring/technical debt items triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on
Projects
Status: No status
Development

No branches or pull requests

5 participants