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

Text based Circuit Rendering Module #244

Merged
merged 46 commits into from
Sep 24, 2024
Merged

Conversation

gadhvirushiraj
Copy link
Contributor

@gadhvirushiraj gadhvirushiraj commented Aug 8, 2024

TextRenderer + BaseRenderer + Tests + Documentation

GSOC'24 Project - QuTiP: Enhanced Quantum Circuit Diagrams | Phase#2 PR

Major Task Outline

TextRenderer

  • Single Qubit Gate Rendering
  • Multi-Qubit Gate Rendering
  • Custom Gate Rendering
  • Measurement Rendering
  • Customization Options

Tests

  • MatRenderer Test Cases
  • TextRenderer Test Cases

BaseRenderer

Documentation

tests/test_textrenderer.py Outdated Show resolved Hide resolved
@BoxiLi
Copy link
Member

BoxiLi commented Aug 18, 2024

There is one thing that I forgot last time, the public API should be added to the apidoc https://github.com/qutip/qutip-qip/tree/master/doc/source/apidoc, when you add doc.

Copy link
Member

@BoxiLi BoxiLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a first quick review. A more detailed one will follow.

You can also add the test for matplotlib here, should be fine. There should also be one test for the circuit.draw() interface, making sure that the API is working properly.

The tex renderer should also be renamed to match the convention.

src/qutip_qip/circuit/mat_renderer.py Show resolved Hide resolved
src/qutip_qip/circuit/text_renderer.py Show resolved Hide resolved
src/qutip_qip/circuit/text_renderer.py Outdated Show resolved Hide resolved
src/qutip_qip/circuit/text_renderer.py Outdated Show resolved Hide resolved
src/qutip_qip/circuit/text_renderer.py Outdated Show resolved Hide resolved
src/qutip_qip/circuit/text_renderer.py Outdated Show resolved Hide resolved
src/qutip_qip/circuit/text_renderer.py Show resolved Hide resolved
src/qutip_qip/circuit/base_renderer.py Show resolved Hide resolved
src/qutip_qip/circuit/text_renderer.py Outdated Show resolved Hide resolved
src/qutip_qip/circuit/text_renderer.py Outdated Show resolved Hide resolved
src/qutip_qip/circuit/text_renderer.py Outdated Show resolved Hide resolved
src/qutip_qip/circuit/text_renderer.py Outdated Show resolved Hide resolved
src/qutip_qip/circuit/text_renderer.py Show resolved Hide resolved
src/qutip_qip/circuit/base_renderer.py Show resolved Hide resolved
src/qutip_qip/circuit/text_renderer.py Outdated Show resolved Hide resolved
src/qutip_qip/circuit/text_renderer.py Outdated Show resolved Hide resolved
@gadhvirushiraj
Copy link
Contributor Author

@BoxiLi
I've updated the circuit.py file. The QubitCircuit object now uses matplotlib as the default representation (if matplotlib is available); otherwise, it falls back to text-based rendering. I've also removed the unnecessary LaTeX hooks for Jupyter Notebooks. Currently, I've added a bool option to the draw function for saving in the respective format, didn't find a better approach for integrating the save functionality.

Copy link
Member

@BoxiLi BoxiLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the interface of circuit.draw looks good.

src/qutip_qip/circuit/circuit.py Outdated Show resolved Hide resolved
@BoxiLi BoxiLi added this to the qutip-qip-0.4.0 milestone Aug 28, 2024
doc/source/qip-basics.rst Outdated Show resolved Hide resolved
@BoxiLi
Copy link
Member

BoxiLi commented Sep 24, 2024

Sorry for the delay and thank you very much for the fix @gadhvirushiraj ! It looks all good. Merge.

Lets see how the tutorials run!

@BoxiLi BoxiLi merged commit 5c80481 into qutip:master Sep 24, 2024
12 of 13 checks passed
@gadhvirushiraj gadhvirushiraj deleted the dev-rushi4 branch September 24, 2024 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants