Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/NTIA/scos-tekrsa into SEA-1…
Browse files Browse the repository at this point in the history
…78_test_actions_loading
jhazentia committed Mar 15, 2024
2 parents ce5a5c8 + 0d146b4 commit 6bef0b5
Showing 2 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/scos_tekrsa/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.0.1"
__version__ = "5.0.2"
39 changes: 22 additions & 17 deletions src/scos_tekrsa/hardware/tekrsa_sigan.py
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ def __init__(
sigan_cal: Calibration = None,
switches: Optional[Dict[str, WebRelay]] = None,
):

try:
super().__init__(sensor_cal, sigan_cal, switches)
logger.debug("Initializing Tektronix RSA Signal Analyzer")
@@ -53,13 +54,23 @@ def __init__(
self.sensor_calibration_data = None
self.sigan_calibration_data = None
self._capture_time = None
self._reference_level = None
self._frequency = None
self._iq_bandwidth = None
self._sample_rate = None
self._attenuation = None
self._preamp_enable = None
self._api_version = None
self._firmware_version = None
self.max_iq_bandwidth = None
self.min_iq_bandwidth = None
self.overload = None
self.connect()

except Exception as error:
logger.error(
f"Unable to initialize sigan: {error}.\nAttempting to power cycle and reconnect..."
)
self.power_cycle_and_connect()
except BaseException as error:
logger.error(f"Unable to initialize sigan: {error}.")
self._is_available = False
self._model = "NONE: Failed to connect to TekRSA"

def get_constraints(self):
self.min_frequency = self.rsa.CONFIG_GetMinCenterFreq()
@@ -80,23 +91,17 @@ def connect(self):
self.rsa = MockRSA(randomize_values=random)
else:
try:
# Load API wrapper
logger.debug("Loading RSA API wrapper")
import rsa_api
except ImportError as import_error:
logger.exception("API Wrapper not loaded - disabling signal analyzer.")
self._is_available = False
raise import_error
try:
logger.debug("Initializing ")
self.rsa = rsa_api.RSA()
# Connect to device using API wrapper
self.rsa.DEVICE_SearchAndConnect()
except Exception as e:
self._is_available = False
self._model = "NONE: Failed to connect to TekRSA"
logger.exception("Unable to connect to TEKRSA")
raise e
raise import_error
logger.debug("Initializing ")
self.rsa = rsa_api.RSA()
# Connect to device using API wrapper
self.rsa.DEVICE_SearchAndConnect()

# Finish setup with either real or Mock RSA device
self._model = self.rsa.DEVICE_GetNomenclature()
self._firmware_version = self.rsa.DEVICE_GetFWVersion()

0 comments on commit 6bef0b5

Please sign in to comment.