Skip to content

Commit

Permalink
my development version 0.5.5, fix NanoVNA-Saver#608
Browse files Browse the repository at this point in the history
Signed-off-by: Martin <[email protected]>
  • Loading branch information
Ho-Ro committed Apr 24, 2023
1 parent c0e177b commit 41a3074
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
2 changes: 1 addition & 1 deletion NanoVNASaver/About.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

VERSION = "0.5.5"
VERSION = "0.5.5-horo"
VERSION_URL = (
"https://raw.githubusercontent.com/"
"NanoVNA-Saver/nanovna-saver/master/NanoVNASaver/About.py")
Expand Down
2 changes: 1 addition & 1 deletion NanoVNASaver/Analysis/EFHWAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def do_resonance_analysis(self):
threshold=500))
extended_data = {}
logger.info("TO DO: find near data")
for lowest in self.crossing:
for lowest in self.crossings:
my_data = self._get_data(lowest)
if lowest in extended_data:
extended_data[lowest].update(my_data)
Expand Down
37 changes: 14 additions & 23 deletions NanoVNASaver/Analysis/ResonanceAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ResonanceAnalysis(Analysis):

def __init__(self, app):
super().__init__(app)
self.crossing: List[int] = []
self.crossings: list[int] = []
self.filename = ""
self._widget = QtWidgets.QWidget()
self.layout = QtWidgets.QFormLayout()
Expand Down Expand Up @@ -94,10 +94,10 @@ def runAnalysis(self):
for _ in range(results_header, self.layout.rowCount()):
self.layout.removeRow(self.layout.rowCount() - 1)

self.crossing = at.zero_crossings([d.phase for d in self.app.data.s11])
self.crossings = at.zero_crossings([d.phase for d in self.app.data.s11])
logger.debug("Found %d sections ",
len(self.crossing))
if not self.crossing:
len(self.crossings))
if not self.crossings:
self.layout.addRow(QtWidgets.QLabel(
"No resonance found"))
return
Expand All @@ -106,29 +106,20 @@ def runAnalysis(self):

def do_resonance_analysis(self):
extended_data = []
for m in self.crossing:
start, lowest, end = m
my_data = self._get_data(lowest)
s11_low = self.app.data.s11[lowest]
extended_data.append(my_data)
if start != end:
logger.debug(
"Section from %d to %d, lowest at %d",
start, end, lowest)
self.layout.addRow(
"Resonance",
QtWidgets.QLabel(
f"{format_frequency(s11_low.freq)}"
f" ({format_complex_imp(s11_low.impedance())})"))
else:
self.layout.addRow("Resonance", QtWidgets.QLabel(
format_frequency(self.app.data.s11[lowest].freq)))
self.layout.addWidget(QHLine())
for crossing in self.crossings:
extended_data.append(self._get_data(crossing))
self.layout.addRow(
"Resonance",
QtWidgets.QLabel(
format_frequency(self.app.data.s11[crossing].freq)
),
)
self.layout.addWidget(QHLine())
# Remove the final separator line
self.layout.removeRow(self.layout.rowCount() - 1)
if self.filename and extended_data:
with open(
self.filename, 'w', encoding='utf-8', newline=''
self.filename, "w", encoding="utf-8", newline=""
) as csvfile:
fieldnames = extended_data[0].keys()
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
Expand Down

0 comments on commit 41a3074

Please sign in to comment.