Skip to content

Commit

Permalink
scos-actions 8.0.1. Move instance variables into __init__.
Browse files Browse the repository at this point in the history
  • Loading branch information
dboulware committed Mar 6, 2024
1 parent fe2ccbc commit dc5bca8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ classifiers = [
dependencies = [
"environs>=9.5.0",
"tekrsa-api-wrap>=1.3.2",
"scos_actions @ git+https://github.com/NTIA/scos-actions@RemoveRayInitialization",
"scos_actions @ git+https://github.com/NTIA/scos-actions@8.0.1",
]

[project.optional-dependencies]
Expand Down
29 changes: 18 additions & 11 deletions src/scos_tekrsa/hardware/tekrsa_sigan.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,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")
Expand Down Expand Up @@ -51,12 +52,22 @@ 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.connect()

except BaseException as error:
logger.error(
f"Unable to initialize sigan: {error}.\nAttempting to power cycle and reconnect..."
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()
Expand Down Expand Up @@ -84,16 +95,12 @@ def connect(self):
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

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()
Expand Down

0 comments on commit dc5bca8

Please sign in to comment.