From 037e4110e83199dda5491535d13d31da6b92bf9c Mon Sep 17 00:00:00 2001
From: LorenzoMonti <lorenzomonti42@gmail.com>
Date: Fri, 28 Jan 2022 12:02:42 +0100
Subject: [PATCH] Fix exponent notation for frequency values

---
 config/config_MS2830A.json    |  4 ++--
 src/Anritsu_MS2830A.py        | 12 ++++++------
 src/tabs/configuration_tab.py |  9 +++++----
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/config/config_MS2830A.json b/config/config_MS2830A.json
index 471f60d..c5a2a58 100644
--- a/config/config_MS2830A.json
+++ b/config/config_MS2830A.json
@@ -1,6 +1,6 @@
 {
-    "start_freq": 1000000000,
-    "stop_freq": 2000000000,
+    "start_freq": 1000000000.0,
+    "stop_freq": 2000000000.0,
     "sweep_trace_points": 5001,
     "resolution_bandwith": 10000000,
     "video_bandwith": 10,
diff --git a/src/Anritsu_MS2830A.py b/src/Anritsu_MS2830A.py
index 19004ab..8e953f3 100644
--- a/src/Anritsu_MS2830A.py
+++ b/src/Anritsu_MS2830A.py
@@ -72,7 +72,7 @@ class Anritsu_MS2830A():
         """
         sets the resolution bandwidth
         """
-        self._visainstrument.write('RB %e'%(BW))
+        self._visainstrument.write('RB %f'%(BW))
 
     def do_get_resolutionBW(self):
         """
@@ -84,7 +84,7 @@ class Anritsu_MS2830A():
         """
         sets the video bandwidth
         """
-        self._visainstrument.write('VB %e'%(BW))
+        self._visainstrument.write('VB %f'%(BW))
 
     def do_get_videoBW(self):
         """
@@ -141,7 +141,7 @@ class Anritsu_MS2830A():
         """
         sets the center frequency
         """
-        self._visainstrument.write('CNF %i' % (centerfreq))
+        self._visainstrument.write('CNF %f' % (centerfreq))
 
     def do_get_centerfreq(self):
         """
@@ -153,7 +153,7 @@ class Anritsu_MS2830A():
         """
         sets the frequency span
         """
-        self._visainstrument.write('freq:span %e'%(freqspan))
+        self._visainstrument.write('freq:span %f'%(freqspan))
     
     def do_get_freqspan(self):
         """
@@ -167,7 +167,7 @@ class Anritsu_MS2830A():
         sets the start frequency
         
         """
-        self._visainstrument.write('STF %i'%(freq))
+        self._visainstrument.write('STF %f'%(freq))
 
     def do_get_startfreq(self):
         """
@@ -181,7 +181,7 @@ class Anritsu_MS2830A():
         sets the stop frequency
         
         """
-        self._visainstrument.write('SOF %i'%(freq))
+        self._visainstrument.write('SOF %f'%(freq))
 
     def do_get_stopfreq(self):
         """
diff --git a/src/tabs/configuration_tab.py b/src/tabs/configuration_tab.py
index a139e33..5b8eb97 100644
--- a/src/tabs/configuration_tab.py
+++ b/src/tabs/configuration_tab.py
@@ -2,6 +2,7 @@ from logging import disable
 from tkinter import Tk
 from tkinter.constants import DISABLED
 from tkinter.font import NORMAL
+from tokenize import Double
 import Anritsu_MS2830A as SPA
 import Utils
 import logging
@@ -125,11 +126,11 @@ def configuration(self, TNotebook1, config_interface, config_file):
     # function for button "Write configuration"
     def write_conf():
         config_file = {
-            "start_freq": int(self.Entry1.get()),
-            "stop_freq": int(self.Entry2.get()),
+            "start_freq": float(self.Entry1.get()),
+            "stop_freq": float(self.Entry2.get()),
             "sweep_trace_points": int(self.Entry3.get()),
-            "resolution_bandwith": int(self.Entry4.get()),
-            "video_bandwith": int(self.Entry5.get()),
+            "resolution_bandwith": float(self.Entry4.get()),
+            "video_bandwith": float(self.Entry5.get()),
             "amplitude_log_scale": int(self.Entry6.get()),
             "reference_level": int(self.Entry7.get()),
             "zoom_spot_marker": [int(self.Entry8.get()), self.Entry9.get()]
-- 
GitLab