Skip to content

Commit

Permalink
fix: fix cannot remove cv data
Browse files Browse the repository at this point in the history
  • Loading branch information
Lan Le committed Nov 16, 2023
1 parent 3c0a821 commit 92e59c8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions chem_spectra/lib/composer/ni.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,14 @@ def __gen_cyclic_voltammetry_data_peaks(self):
x_max_peak, y_max_peak = self.__get_xy_of_peak(max_peak)
x_min_peak, y_min_peak = self.__get_xy_of_peak(min_peak)

if (x_max_peak == '' and x_min_peak == ''):
x_pecker = ''
if 'pecker' in peak and peak['pecker'] is not None:
pecker = peak['pecker']
x_pecker = pecker['x']
y_pecker = pecker['y']
x_pecker = f"{float(x_pecker)}"

if (x_max_peak == '' and x_min_peak == '' and x_pecker == ''):
# ignore if missing both max and min peak
continue

Expand All @@ -171,16 +178,11 @@ def __gen_cyclic_voltammetry_data_peaks(self):
else:
delta = abs(x_max_peak - x_min_peak)

x_pecker = ''

# calculate ratio
if (y_min_peak == '' or y_max_peak == ''):
ratio = ''
else:
if 'pecker' in peak and peak['pecker'] is not None:
pecker = peak['pecker']
x_pecker = pecker['x']
y_pecker = pecker['y']
x_pecker = f"{float(x_pecker)}"
first_expr = abs(y_min_peak) / abs(y_max_peak)
second_expr = 0.485 * abs(y_pecker) / abs(y_max_peak)
ratio = first_expr + second_expr + 0.086
Expand Down

0 comments on commit 92e59c8

Please sign in to comment.