Skip to content

Commit 1c6a9b0

Browse files
committed
Fixed special condition epb and cal
1 parent 97ded8c commit 1c6a9b0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

code/tab2.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,11 +625,12 @@ def update_graph(
625625

626626
# If calibrated peak
627627
suffix = " keV" if cal_switch else " "
628+
628629
if cal_switch:
629630
peak_value = round(np.polyval(np.poly1d(coefficients_1), peak_index), 2)
630631
prefixx = " "
631632
else:
632-
prefixx = "bin:"
633+
prefixx = "bin:"
633634

634635
# Adjust for log scale
635636
if log_switch:
@@ -643,6 +644,12 @@ def update_graph(
643644
else:
644645
annotation_text = f"{prefixx}{peak_value}{suffix}|cts:{bin_counts} ({resolution:.1f}%)"
645646

647+
# Show energy per bin
648+
if epb_switch and cal_switch:
649+
# Display the product of energy and counts
650+
formatted_value = f"{int(peak_value * bin_counts):,}"
651+
annotation_text = f"{formatted_value} keV*cts"
652+
646653
# Add annotation
647654
annotations.append(dict(
648655
x=peak_value,

0 commit comments

Comments
 (0)