Skip to content

Commit 2806e8a

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents c554b8e + a10ae2b commit 2806e8a

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

qarray/gui/gui.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from time import perf_counter
2+
import math
23
import io
34
import zipfile
45
import base64
@@ -266,7 +267,9 @@ def update(
266267
y_gate, y_amplitude, y_resolution,
267268
n_charges, plot_choice,
268269
auto_vg, print_charge_state,
269-
*dac_values
270+
*dac_values,
271+
minimal_area_fraction : float = 0.008,
272+
maxmim_number_of_charge_states : int = 100
270273
):
271274
"""
272275
Update the heatmap based on the input values and return the
@@ -364,15 +367,22 @@ def update(
364367
fig.update_xaxes(title_text=x_gate, ticktext=x_text, tickvals=x_tickvals)
365368
fig.update_yaxes(title_text=y_gate, ticktext=y_text, tickvals=y_tickvals)
366369

367-
charge_states = unique_last_axis(n).astype(int)
370+
n_int = n.astype(int)
371+
charge_states = unique_last_axis(n_int)
372+
total_size = math.prod(n.shape[:-1])
368373

369374
# Optionally annotate the figure with the distinct charge states
370375
if print_charge_state == 'True':
371-
if charge_states.shape[0] <= 100:
376+
if charge_states.shape[0] <= maxmim_number_of_charge_states:
372377
for charge_state in charge_states:
373-
ix, iy = np.where(np.all(n == charge_state, axis=-1))
378+
ix, iy = np.where(np.all(n_int == charge_state, axis=-1))
374379
avg_x = iy.mean()
375380
avg_y = ix.mean()
381+
382+
area_fraction = ix.size / total_size
383+
if area_fraction < minimal_area_fraction:
384+
continue
385+
376386
label = ','.join(map(str, charge_state))
377387
fig.add_annotation(
378388
x=avg_x,

0 commit comments

Comments
 (0)