Skip to content

Commit

Permalink
WIP: change order of peaks and integral
Browse files Browse the repository at this point in the history
  • Loading branch information
Lan Le committed Apr 30, 2024
1 parent fe6beb3 commit 8b1abbf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions chem_spectra/lib/composer/ni.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ def tf_img(self):

plt.ylim(
y_boundary_min,
y_boundary_max,
y_boundary_max * 1.5,
)

# PLOT label
Expand Down Expand Up @@ -507,7 +507,8 @@ def __draw_integrals(self, plt, refShift, refArea, y_max, h, itg_value_position_
plt.plot([xL, xL], [itg_value_position_y + h * 0.01, itg_value_position_y - h * 0.01], color='#228B22') # noqa: E501
plt.plot([xU, xU], [itg_value_position_y + h * 0.01, itg_value_position_y - h * 0.01], color='#228B22') # noqa: E501
plt.text((xL + xU) / 2, itg_value_position_y - h * 0.01, '{:0.2f}'.format(area), color='#228B22', ha='right', rotation_mode='anchor', size=7, rotation=90.) # noqa: E501
cys = (ks[iL:iU] - ref) * 1.5 + (y_max + h * 0.15)
# cys = (ks[iL:iU] - ref) * 1.5 + (y_max + h * 0.15)
cys = (ks[iL:iU] - ref) * 1.5 + h * 0.15
plt.plot(cxs, cys, color='#228B22')
try:
cys_max = np.max(cys)
Expand Down Expand Up @@ -548,9 +549,9 @@ def __draw_peaks(self, plt, x_peaks, y_peaks, h, w):
mygroup_x, mygroup_y = groups_x[i], groups_y[i]
len_group_x = len(mygroup_x)
if len_group_x > 1:
max_current_group = max_values[i] + h * 0.2
max_current_group = max_values[i] + h * 0.25
if (i > 0):
prev_max_group = max_values[i-1] + h * 0.2
prev_max_group = max_values[i-1] + h * 0.25
my_gap = abs(max_current_group - prev_max_group)
if my_gap < h*0.1:
max_current_group = max_current_group + h * 0.45
Expand Down Expand Up @@ -580,7 +581,7 @@ def __draw_peaks(self, plt, x_peaks, y_peaks, h, w):
rotation=90, size=6)
else:
x_pos = mygroup_x[0]
y_pos = mygroup_y[0] + h * 0.08
y_pos = mygroup_y[0] + h * 0.18
x_float = '{:.2f}'.format(x_pos)
peak_label = '{x}'.format(x=x_float)
ax.annotate(peak_label,
Expand Down

0 comments on commit 8b1abbf

Please sign in to comment.