Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/refactoring #556

Merged
merged 11 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release_linux_modern.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linux Release
name: Modern Linux Release

on:
push:
Expand Down Expand Up @@ -33,5 +33,5 @@ jobs:
- name: Archive production artifacts
uses: actions/upload-artifact@v1
with:
name: NanoVNASaver.linux
name: NanoVNASaver.linux_modern
path: dist/nanovna-saver
8 changes: 4 additions & 4 deletions NanoVNASaver/Analysis/PeakSearchAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import logging

from PyQt5 import QtWidgets
import scipy
import numpy as np
from scipy.signal import find_peaks, peak_prominences

from NanoVNASaver.Analysis.Base import QHLine
from NanoVNASaver.Analysis.SimplePeakSearchAnalysis import (
Expand Down Expand Up @@ -60,17 +60,17 @@ def runAnalysis(self):
inverted = False
if self.button['peak_l'].isChecked():
inverted = True
peaks, _ = scipy.signal.find_peaks(
peaks, _ = find_peaks(
-np.array(data), width=3, distance=3, prominence=1)
else:
self.button['peak_h'].setChecked(True)
peaks, _ = scipy.signal.find_peaks(
peaks, _ = find_peaks(
data, width=3, distance=3, prominence=1)

# Having found the peaks, get the prominence data
for i, p in np.ndenumerate(peaks):
logger.debug("Peak %i at %d", i, p)
prominences = scipy.signal.peak_prominences(data, peaks)[0]
prominences = peak_prominences(data, peaks)[0]
logger.debug("%d prominences", len(prominences))

# Find the peaks with the most extreme values
Expand Down
6 changes: 3 additions & 3 deletions NanoVNASaver/AnalyticTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from typing import Callable, List, Tuple

import numpy as np
import scipy
from scipy.signal import find_peaks

from NanoVNASaver.RFTools import Datapoint

Expand Down Expand Up @@ -60,7 +60,7 @@ def maxima(data: List[float], threshold: float = 0.0) -> List[int]:
Returns:
List[int]: indices of maxima
"""
peaks = scipy.signal.find_peaks(
peaks = find_peaks(
data, width=2, distance=3, prominence=1)[0].tolist()
return [
i for i in peaks if data[i] > threshold
Expand All @@ -76,7 +76,7 @@ def minima(data: List[float], threshold: float = 0.0) -> List[int]:
Returns:
List[int]: indices of minima
"""
bottoms = scipy.signal.find_peaks(
bottoms = find_peaks(
-np.array(data), width=2, distance=3, prominence=1)[0].tolist()
return [
i for i in bottoms if data[i] < threshold
Expand Down
Loading