harm-analysis 1.4.0__tar.gz → 1.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {harm_analysis-1.4.0 → harm_analysis-1.4.1}/PKG-INFO +1 -1
- {harm_analysis-1.4.0 → harm_analysis-1.4.1}/pyproject.toml +2 -1
- {harm_analysis-1.4.0 → harm_analysis-1.4.1}/src/harm_analysis/_harm_analysis.py +19 -2
- {harm_analysis-1.4.0 → harm_analysis-1.4.1}/LICENSE +0 -0
- {harm_analysis-1.4.0 → harm_analysis-1.4.1}/README.md +0 -0
- {harm_analysis-1.4.0 → harm_analysis-1.4.1}/src/harm_analysis/__init__.py +0 -0
- {harm_analysis-1.4.0 → harm_analysis-1.4.1}/src/harm_analysis/cli.py +0 -0
- {harm_analysis-1.4.0 → harm_analysis-1.4.1}/tests/__init__.py +0 -0
- {harm_analysis-1.4.0 → harm_analysis-1.4.1}/tests/conftest.py +0 -0
- {harm_analysis-1.4.0 → harm_analysis-1.4.1}/tests/test_cli.py +0 -0
- {harm_analysis-1.4.0 → harm_analysis-1.4.1}/tests/test_data_cli.txt +0 -0
- {harm_analysis-1.4.0 → harm_analysis-1.4.1}/tests/test_harm_analysis.py +0 -0
- {harm_analysis-1.4.0 → harm_analysis-1.4.1}/tests/test_spectrum_analysis.py +0 -0
|
@@ -29,7 +29,7 @@ keywords = [
|
|
|
29
29
|
"THD",
|
|
30
30
|
"SNR",
|
|
31
31
|
]
|
|
32
|
-
version = "1.4.
|
|
32
|
+
version = "1.4.1"
|
|
33
33
|
|
|
34
34
|
[project.urls]
|
|
35
35
|
Homepage = "https://github.com/ericsmacedo/harm-analysis"
|
|
@@ -55,6 +55,7 @@ dev = [
|
|
|
55
55
|
"pytest-cov>=5.0.0",
|
|
56
56
|
"ruff>=0.11.2",
|
|
57
57
|
"test2ref>=0.4.2",
|
|
58
|
+
"truststore>=0.10.4",
|
|
58
59
|
]
|
|
59
60
|
|
|
60
61
|
[build-system]
|
|
@@ -171,12 +171,22 @@ def _find_freq_bins(x: NDArray[np.float64], idx: int, bw_bins: int, enbw_bins: f
|
|
|
171
171
|
if local_max_idx == 0:
|
|
172
172
|
peak_start = 0
|
|
173
173
|
else:
|
|
174
|
-
|
|
174
|
+
d_start = np.diff(x[start_idx:local_max_idx])
|
|
175
|
+
starts = np.where(d_start < 0)[0]
|
|
176
|
+
if starts.size == 0:
|
|
177
|
+
peak_start = start_idx
|
|
178
|
+
else:
|
|
179
|
+
peak_start = starts[-1] + start_idx + 1
|
|
175
180
|
|
|
176
181
|
if local_max_idx == x_size - 1:
|
|
177
182
|
peak_end = x_size
|
|
178
183
|
else:
|
|
179
|
-
|
|
184
|
+
d_end = np.diff(x[local_max_idx:end_idx])
|
|
185
|
+
ends = np.where(d_end > 0)[0]
|
|
186
|
+
if ends.size == 0:
|
|
187
|
+
peak_end = end_idx
|
|
188
|
+
else:
|
|
189
|
+
peak_end = ends[0] + local_max_idx + 1
|
|
180
190
|
|
|
181
191
|
bins = np.arange(peak_start, peak_end)
|
|
182
192
|
|
|
@@ -737,6 +747,13 @@ def spec_analysis( # noqa: PLR0913
|
|
|
737
747
|
an `ax` must be provided, and the function returns a dictionary
|
|
738
748
|
with the results and the specified axes (`ax`). If plot is not set,
|
|
739
749
|
only the results are returned.
|
|
750
|
+
distance: number, optional
|
|
751
|
+
Required minimal horizontal distance (>= 1) in samples between neighbouring peaks.
|
|
752
|
+
Smaller peaks are removed first until the condition is fulfilled for all remaining peaks.
|
|
753
|
+
prominence: number or ndarray, optional
|
|
754
|
+
Required prominence of peaks in dB. Either a number, None, or an array matching x
|
|
755
|
+
height: number or ndarray or sequence, optional
|
|
756
|
+
Required height of peaks in dB. Either a number, None, an array matching x.
|
|
740
757
|
ax : plt.Axes or None, optional
|
|
741
758
|
Axes to be used for plotting. Required if plot is set to True.
|
|
742
759
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|