Skip to content

Commit 3e943e6

Browse files
authored
Merge pull request #5 from fronzbot/dev
release-0.1.2
2 parents 2752e35 + f8dbafb commit 3e943e6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

adc_eval/spectrum.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ def harmonics(psp, fft_n, ref_pow, sample_freq, leak=20, n=5, window="hanning"):
6161
df = sample_freq / fft_n
6262
# calculate fundamental frequency
6363
fund_bin = np.argmax(psp)
64-
fund_freq = np.sum(
65-
[psp[i] * i * df for i in range(fund_bin - leak, fund_bin + leak + 1)]
66-
) / np.sum(psp[fund_bin - leak : fund_bin + leak + 1])
67-
if np.isinf:
68-
fund_freq = fund_bin * df
64+
fund_freq = fund_bin * df
65+
num = np.sum([psp[i] * i * df for i in range(fund_bin - leak, fund_bin + leak + 1)])
66+
den = np.sum(psp[fund_bin - leak : fund_bin + leak + 1])
67+
if den > 0:
68+
fund_freq = num / den
6969

7070
# calculate harmonics info
7171
h = []

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "python-adc-eval"
7-
version = "0.1.1"
7+
version = "0.1.2"
88
license = {text = "MIT"}
99
description = "ADC Evaluation Library"
1010
readme = "README.rst"

0 commit comments

Comments
 (0)