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

Khwu/vis geo#433 #443

Merged
merged 5 commits into from
Aug 25, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add heatmap, fix bugs for Decimal/float
  • Loading branch information
Kai-Hsin Wu authored and Kai-Hsin Wu committed Aug 25, 2023
commit a7825512516fde4910aaf61c57e5fdc448734637
24 changes: 21 additions & 3 deletions src/bloqade/visualization/report_visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# import itertools
import numpy as np
from decimal import Decimal

# from typing import List

Expand Down Expand Up @@ -58,7 +59,7 @@ def format_report_data(report):
cnt_sources.append(src)
ryd_sources.append(rsrc)

return cnt_sources, ryd_sources, report.metas, report.name
return cnt_sources, ryd_sources, report.metas, report.geos, report.name


def mock_data():
Expand Down Expand Up @@ -92,7 +93,13 @@ def mock_data():
metas.append(dict(a=4, b=9, c=10))
geos.append(
tks.base.Geometry(
sites=[(0.0, 0.0), (0.0, 0.5), (0.5, 0.3), (0.6, 0.7)], filling=[1, 1, 1, 0]
sites=[
(0.0e-6, 0.0e-6),
(0.0e-6, 0.5e-6),
(0.5e-6, 0.3e-6),
(0.6e-6, 0.7e-6),
],
filling=[1, 1, 1, 0],
)
)

Expand All @@ -119,7 +126,12 @@ def mock_data():
metas.append(dict(a=10, b=9.44, c=10.3))
geos.append(
tks.base.Geometry(
sites=[(0.0, 0.1), (0.66, 0.5), (0.3, 0.3), (0.5, 0.7)],
sites=[
(0.0e-6, 0.1e-6),
(0.66e-6, 0.5e-6),
(0.3e-6, 0.3e-6),
(0.5e-6, 0.7e-6),
],
filling=[1, 0, 1, 0],
)
)
Expand All @@ -137,6 +149,8 @@ def plot_register_ryd_dense(geo, ryds):
y_max = -np.inf
for idx, location_info in enumerate(zip(geo.sites, geo.filling, ryds)):
(x, y), filling, density = location_info
x = float(Decimal(str(x)) * Decimal("1e6")) # convert to um
y = float(Decimal(str(y)) * Decimal("1e6")) # convert to um
x_min = min(x, x_min)
y_min = min(y, y_min)
x_max = max(x, x_max)
Expand Down Expand Up @@ -220,6 +234,7 @@ def plot_register_ryd_dense(geo, ryds):
location=(0, 0),
)

p.xaxis.axis_label = "(um)"
p.add_layout(color_bar, "right")
p.add_tools(hover)

Expand All @@ -236,6 +251,8 @@ def plot_register(geo):
y_max = -np.inf
for idx, location_info in enumerate(zip(geo.sites, geo.filling)):
(x, y), filling = location_info
x = float(Decimal(str(x)) * Decimal("1e6")) # convert to um
y = float(Decimal(str(y)) * Decimal("1e6")) # convert to um
x_min = min(x, x_min)
y_min = min(y, y_min)
x_max = max(x, x_max)
Expand Down Expand Up @@ -364,6 +381,7 @@ def report_visual(cnt_sources, ryd_sources, metas, geos, name):
pryd.add_tools(hov_tool)

# pgeo = plot_register(geo)
# print(geo, trydsrc.data["ryds"])
pgeo = plot_register_ryd_dense(geo, trydsrc.data["ryds"])

figs.append(row(div, p, pryd, pgeo, name=taskname))
Expand Down
Loading