Skip to content

Commit

Permalink
add labels for registers
Browse files Browse the repository at this point in the history
  • Loading branch information
Kai-Hsin Wu authored and Kai-Hsin Wu committed Aug 3, 2023
1 parent 8b1d317 commit 1b088e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/bloqade/ir/location/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def enumerate(self) -> Generator[LocationInfo, None, None]:
"""enumerate all locations in the register."""
raise NotImplementedError

def figure(self, **assignments):
def figure(self, fig_kwargs=None, **assignments):
"""obtain a figure object from the atom arrangement."""
xs_filled, ys_filled, labels_filled = [], [], []
xs_vacant, ys_vacant, labels_vacant = [], [], []
Expand Down Expand Up @@ -103,7 +103,11 @@ def figure(self, **assignments):
]

## remove box_zoom since we don't want to change the scale
if fig_kwargs is None:
fig_kwargs = {}

p = figure(
**fig_kwargs,
width=400,
height=400,
tools="wheel_zoom,reset, undo, redo, pan",
Expand Down
8 changes: 4 additions & 4 deletions src/bloqade/submission/ir/task_specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,14 @@ def discretize(self, task_capabilities: QuEraCapabilities):
filling=self.filling,
)

def figure(self):
def figure(self, **fig_kwargs):
## use ir.Atom_oarrangement's plotting:
## covert unit to m -> um
sites_um = list(
map(lambda cord: (float(cord[0]) * 1e6, float(cord[1]) * 1e6), self.sites)
)
reg = ListOfLocations().add_positions(sites_um, self.filling)
fig_reg = reg.figure() # ignore the B-rad widget
fig_reg = reg.figure(fig_kwargs=fig_kwargs) # ignore the B-rad widget
return fig_reg

def show(self):
Expand Down Expand Up @@ -386,7 +386,7 @@ def figure(self):
# grab global figures
rabi_amplitude = (
self.effective_hamiltonian.rydberg.rabi_frequency_amplitude.figure(
rabi_amp_src, tools="hover,wheel_zoom,reset, undo, redo, pan"
rabi_amp_src, tools="wheel_zoom,reset, undo, redo, pan"
)
)

Expand All @@ -402,7 +402,7 @@ def figure(self):
)

# lattice:
register = self.lattice.figure()
register = self.lattice.figure(x_axis_label="x (um)", y_axis_label="y (um)")

col_plt = gridplot(
[[rabi_amplitude], [global_detuning], [rabi_phase]],
Expand Down

0 comments on commit 1b088e3

Please sign in to comment.