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

improve visualizations in lab_dev #425

Merged
merged 41 commits into from
Jul 29, 2024
Merged

improve visualizations in lab_dev #425

merged 41 commits into from
Jul 29, 2024

Conversation

timmysilv
Copy link
Collaborator

@timmysilv timmysilv commented Jun 26, 2024

Context:
There have been some issues with visualizations in MrMustard, and this should address a good amount of them

Description of the Change:

  • Remove mako-based implementations for _repr_html_, and replace them with ipywidgets-based implementations with _ipython_display_. I mainly did this because ipywidgets is easier to work with than raw HTML, and should be more portable (eg. jupyterlab vs VS Code). Also, the switch to _ipython_display_ allows for side-effects, and doesn't also print the default repr (unless I do it explicitly)
  • Simplified the funky HTML+CSS to a consistent and basic look. Easier to update, and not distracting at all.
  • fix the default return_fig=False option for State.visualize_*() methods by not converting to HTML manually
  • some little things to please codefactor

Benefits:

  • Works everywhere!
  • Easier to maintain
  • Uses highly trusted ipywidgets package
  • No more double-repr

Possible Drawbacks:

  • N/A

Related GitHub Issues:
Fixes #423

Copy link

codecov bot commented Jun 26, 2024

Codecov Report

Attention: Patch coverage is 96.62162% with 5 lines in your changes missing coverage. Please review.

Project coverage is 88.31%. Comparing base (c61ac1d) to head (c3bc331).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #425      +/-   ##
===========================================
+ Coverage    88.15%   88.31%   +0.16%     
===========================================
  Files           80       82       +2     
  Lines         6542     6669     +127     
===========================================
+ Hits          5767     5890     +123     
- Misses         775      779       +4     
Files Coverage Δ
mrmustard/lab_dev/circuit_components.py 95.77% <100.00%> (+0.15%) ⬆️
mrmustard/lab_dev/wires.py 99.12% <100.00%> (+0.84%) ⬆️
mrmustard/physics/representations.py 99.54% <100.00%> (+0.01%) ⬆️
mrmustard/widgets/css.py 100.00% <100.00%> (ø)
mrmustard/widgets/__init__.py 98.13% <98.13%> (ø)
mrmustard/lab_dev/states/base.py 95.98% <40.00%> (-0.86%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c61ac1d...c3bc331. Read the comment docs.

@timmysilv timmysilv marked this pull request as ready for review July 23, 2024 21:10
@timmysilv timmysilv requested review from ziofil and elib20 July 23, 2024 21:10
Copy link
Collaborator

@ziofil ziofil left a comment

Choose a reason for hiding this comment

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

very nice! thanks :)

Copy link
Collaborator

@ziofil ziofil left a comment

Choose a reason for hiding this comment

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

👍

@timmysilv timmysilv merged commit 51dae3d into develop Jul 29, 2024
7 checks passed
@timmysilv timmysilv deleted the fix-visualizations branch July 29, 2024 18:06
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.

State visualizations are not shown
3 participants