Follow up work on `Circuit._repr_svg_`
See original GitHub issueIs your feature request related to a use case or problem? Please describe.
@mpharrigan did an amazing job working on adding the SVG representation for a Cirq.Circuit
. He left some TODOs in his Issue (#2313). In this issue, I plan to address them and open them for further discussion.
Describe the solution you’d like Listing the tasks from #2313,
Bugs
- [BUG] Take care of the SVG circuits when the
cirq.Moment()
is empty (Currently, it fails). - [BUG] Refactor the rendering code such that circuits do not require integer coordinates for spacing routines.
- [BUG] Implement a dynamic horizontal spacing framework for the rows in the SVGs of the circuits.
Design (A detailed RFC will be opened for this)
- [DESIGN] Come up with a way to visualize custom gates (
MatrixGate
). - [DESIGN] Revamp the SVG output and make it more informative, illustrative, and colorful.
Testing
- [TESTING] Add thorough tests.
Ideally, once this issue is fixed, we can think of moving the SVG representation under cirq.Circuit
itself.
This would require moving the code out from contrib
.
Integration
- [IMPLEMENTATION] Generalize the code used in
cirq-core/cirq/circuits/_block_diagram_drawer.py
andcirq-core/cirq/contrib/svg/svg.py
to draw the blocks. - [INTEGRATION] Dissolve the
SVGCircuit
class and integrateSVGCircuit._repr_svg_
incirq.Circuit
(or evencirq.AbstractCircuit
).
Additional context (e.g. screenshots)
Current Implementation
What is the urgency from your perspective for this issue? Is it blocking important work? P2 - we should do it in the next couple of quarters
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
@freyam Left a comment on #4630 regarding options for visualizing the
MatrixGate
– let’s continue the discussion there. Thanks for working on this!Hi, I’m interested and would like to work on this as well!