Skip to content

Commit

Permalink
Merge pull request #44 from mihtjel/Development
Browse files Browse the repository at this point in the history
0.1.3 release
  • Loading branch information
mihtjel committed Oct 16, 2019
2 parents 3367b20 + dc8ef86 commit fc443a4
Show file tree
Hide file tree
Showing 6 changed files with 494 additions and 164 deletions.
72 changes: 40 additions & 32 deletions NanoVNASaver/Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,12 @@ def runAnalysis(self):
if sixty_db_location > 0:
sixty_db_cutoff_frequency = self.app.data21[sixty_db_location].freq
self.sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency))
elif ten_db_location != -1 and twenty_db_location != -1:
ten = self.app.data21[ten_db_location].freq
twenty = self.app.data21[twenty_db_location].freq
sixty_db_frequency = ten * 10 ** (5 * (math.log10(twenty) - math.log10(ten)))
self.sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_frequency) + " (derived)")
else:
# # We derive 60 dB instead
# factor = 10 * (-54 / decade_attenuation)
# sixty_db_cutoff_frequency = round(six_db_cutoff_frequency + six_db_cutoff_frequency * factor)
# self.sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency) + " (derived)")
self.sixty_db_label.setText("Not calculated")

if ten_db_location > 0 and twenty_db_location > 0 and ten_db_location != twenty_db_location:
Expand Down Expand Up @@ -358,14 +359,16 @@ def runAnalysis(self):
break

if sixty_db_location > 0:
sixty_db_cutoff_frequency = self.app.data21[sixty_db_location].freq
self.sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency))
else:
# # We derive 60 dB instead
# factor = 10 * (-54 / decade_attenuation)
# sixty_db_cutoff_frequency = round(six_db_cutoff_frequency + six_db_cutoff_frequency * factor)
# self.sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency) + " (derived)")
self.sixty_db_label.setText("Not calculated")
if sixty_db_location > 0:
sixty_db_cutoff_frequency = self.app.data21[sixty_db_location].freq
self.sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency))
elif ten_db_location != -1 and twenty_db_location != -1:
ten = self.app.data21[ten_db_location].freq
twenty = self.app.data21[twenty_db_location].freq
sixty_db_frequency = ten * 10 ** (5 * (math.log10(twenty) - math.log10(ten)))
self.sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_frequency) + " (derived)")
else:
self.sixty_db_label.setText("Not calculated")

if ten_db_location > 0 and twenty_db_location > 0 and ten_db_location != twenty_db_location:
octave_attenuation, decade_attenuation = self.calculateRolloff(ten_db_location, twenty_db_location)
Expand Down Expand Up @@ -610,14 +613,16 @@ def runAnalysis(self):
break

if sixty_db_location > 0:
sixty_db_cutoff_frequency = self.app.data21[sixty_db_location].freq
self.lower_sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency))
else:
# # We derive 60 dB instead
# factor = 10 * (-54 / decade_attenuation)
# sixty_db_cutoff_frequency = round(six_db_cutoff_frequency + six_db_cutoff_frequency * factor)
# self.sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency) + " (derived)")
self.lower_sixty_db_label.setText("Not calculated")
if sixty_db_location > 0:
sixty_db_cutoff_frequency = self.app.data21[sixty_db_location].freq
self.lower_sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency))
elif ten_db_location != -1 and twenty_db_location != -1:
ten = self.app.data21[ten_db_location].freq
twenty = self.app.data21[twenty_db_location].freq
sixty_db_frequency = ten * 10 ** (5 * (math.log10(twenty) - math.log10(ten)))
self.lower_sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_frequency) + " (derived)")
else:
self.lower_sixty_db_label.setText("Not calculated")

if ten_db_location > 0 and twenty_db_location > 0 and ten_db_location != twenty_db_location:
octave_attenuation, decade_attenuation = self.calculateRolloff(ten_db_location, twenty_db_location)
Expand Down Expand Up @@ -674,11 +679,12 @@ def runAnalysis(self):
if sixty_db_location > 0:
sixty_db_cutoff_frequency = self.app.data21[sixty_db_location].freq
self.upper_sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency))
elif ten_db_location != -1 and twenty_db_location != -1:
ten = self.app.data21[ten_db_location].freq
twenty = self.app.data21[twenty_db_location].freq
sixty_db_frequency = ten * 10 ** (5 * (math.log10(twenty) - math.log10(ten)))
self.upper_sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_frequency) + " (derived)")
else:
# # We derive 60 dB instead
# factor = 10 * (-54 / decade_attenuation)
# sixty_db_cutoff_frequency = round(six_db_cutoff_frequency + six_db_cutoff_frequency * factor)
# self.sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency) + " (derived)")
self.upper_sixty_db_label.setText("Not calculated")

if ten_db_location > 0 and twenty_db_location > 0 and ten_db_location != twenty_db_location:
Expand Down Expand Up @@ -885,11 +891,12 @@ def runAnalysis(self):
if sixty_db_location > 0:
sixty_db_cutoff_frequency = self.app.data21[sixty_db_location].freq
self.lower_sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency))
elif ten_db_location != -1 and twenty_db_location != -1:
ten = self.app.data21[ten_db_location].freq
twenty = self.app.data21[twenty_db_location].freq
sixty_db_frequency = ten * 10 ** (5 * (math.log10(twenty) - math.log10(ten)))
self.lower_sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_frequency) + " (derived)")
else:
# # We derive 60 dB instead
# factor = 10 * (-54 / decade_attenuation)
# sixty_db_cutoff_frequency = round(six_db_cutoff_frequency + six_db_cutoff_frequency * factor)
# self.sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency) + " (derived)")
self.lower_sixty_db_label.setText("Not calculated")

if ten_db_location > 0 and twenty_db_location > 0 and ten_db_location != twenty_db_location:
Expand Down Expand Up @@ -947,11 +954,12 @@ def runAnalysis(self):
if sixty_db_location > 0:
sixty_db_cutoff_frequency = self.app.data21[sixty_db_location].freq
self.upper_sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency))
elif ten_db_location != -1 and twenty_db_location != -1:
ten = self.app.data21[ten_db_location].freq
twenty = self.app.data21[twenty_db_location].freq
sixty_db_frequency = ten * 10 ** (5 * (math.log10(twenty) - math.log10(ten)))
self.upper_sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_frequency) + " (derived)")
else:
# # We derive 60 dB instead
# factor = 10 * (-54 / decade_attenuation)
# sixty_db_cutoff_frequency = round(six_db_cutoff_frequency + six_db_cutoff_frequency * factor)
# self.sixty_db_label.setText(NanoVNASaver.formatFrequency(sixty_db_cutoff_frequency) + " (derived)")
self.upper_sixty_db_label.setText("Not calculated")

if ten_db_location > 0 and twenty_db_location > 0 and ten_db_location != twenty_db_location:
Expand Down
32 changes: 19 additions & 13 deletions NanoVNASaver/Calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ def __init__(self, app):
self.short_l2_input = QtWidgets.QLineEdit("0")
self.short_l3_input = QtWidgets.QLineEdit("0")
self.short_length = QtWidgets.QLineEdit("0")
cal_short_form.addRow("L0 (F(e-12))", self.short_l0_input)
cal_short_form.addRow("L1 (F(e-24))", self.short_l1_input)
cal_short_form.addRow("L2 (F(e-33))", self.short_l2_input)
cal_short_form.addRow("L3 (F(e-42))", self.short_l3_input)
cal_short_form.addRow("L0 (H(e-12))", self.short_l0_input)
cal_short_form.addRow("L1 (H(e-24))", self.short_l1_input)
cal_short_form.addRow("L2 (H(e-33))", self.short_l2_input)
cal_short_form.addRow("L3 (H(e-42))", self.short_l3_input)
cal_short_form.addRow("Offset Delay (ps)", self.short_length)

self.cal_open_box = QtWidgets.QGroupBox("Open")
Expand All @@ -152,10 +152,10 @@ def __init__(self, app):
self.open_c2_input = QtWidgets.QLineEdit("0")
self.open_c3_input = QtWidgets.QLineEdit("0")
self.open_length = QtWidgets.QLineEdit("0")
cal_open_form.addRow("C0 (H(e-15))", self.open_c0_input)
cal_open_form.addRow("C1 (H(e-27))", self.open_c1_input)
cal_open_form.addRow("C2 (H(e-36))", self.open_c2_input)
cal_open_form.addRow("C3 (H(e-45))", self.open_c3_input)
cal_open_form.addRow("C0 (F(e-15))", self.open_c0_input)
cal_open_form.addRow("C1 (F(e-27))", self.open_c1_input)
cal_open_form.addRow("C2 (F(e-36))", self.open_c2_input)
cal_open_form.addRow("C3 (F(e-45))", self.open_c3_input)
cal_open_form.addRow("Offset Delay (ps)", self.open_length)

self.cal_load_box = QtWidgets.QGroupBox("Load")
Expand Down Expand Up @@ -510,15 +510,15 @@ def automaticCalibration(self):
"Calibration assistant",
"This calibration assistant will help you create a calibration in the " +
"NanoVNASaver application. It will sweep the standards for you, and "+
"guide you through the process.\n\n" +
"guide you through the process.<br><br>" +
"Before starting, ensure you have Open, Short and Load standards " +
"available, and the cables you wish to have calibrated with the device " +
"connected.\n\n" +
"connected.<br><br>" +
"If you want a 2-port calibration, also have a \"through\" connector " +
"to hand.\n\n" +
"The best results are achieved by having the NanoVNA calibrated " +
"to hand.<br><br>" +
"<b>The best results are achieved by having the NanoVNA calibrated " +
"on-device for the full span of interest and saved to save slot 0 " +
"before starting.\n\n" +
"before starting.</b><br><br>" +
"Once you are ready to proceed, press Ok",
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
response = introduction.exec()
Expand All @@ -533,6 +533,12 @@ def automaticCalibration(self):
self.btn_automatic.setDisabled(False)
return

if self.app.sweepSettingsWindow.continuous_sweep_radiobutton.isChecked():
QtWidgets.QMessageBox(QtWidgets.QMessageBox.Information, "Continuous sweep enabled",
"Please disable continuous sweeping before attempting calibration.").exec()
self.btn_automatic.setDisabled(False)
return

short_step = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Information,
"Calibrate short",
"Please connect the \"short\" standard to port 0 of the NanoVNA.\n\n" +
Expand Down
Loading

0 comments on commit fc443a4

Please sign in to comment.