Skip to content

Commit

Permalink
Remove sensor parameter from configure_preselector and get_sigmf_buil…
Browse files Browse the repository at this point in the history
…der.
  • Loading branch information
dboulware committed Jan 16, 2024
1 parent fb3e310 commit 5d32721
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion scos_actions/actions/acquire_sea_data_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def __call__(self, sensor: Sensor, schedule_entry: dict, task_id: int):

_ = psutil.cpu_percent(interval=None) # Initialize CPU usage monitor
self.test_required_components()
self.configure_preselector(self.sensor, self.rf_path)
self.configure_preselector(self.rf_path)

# Initialize metadata object
self.get_sigmf_builder(
Expand Down
4 changes: 2 additions & 2 deletions scos_actions/actions/calibrate_y_factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def calibrate(self, params: dict):

# Set noise diode on
logger.debug("Setting noise diode on")
self.configure_preselector(sensor=self.sensor, params={RF_PATH: nd_on_state})
self.configure_preselector(params={RF_PATH: nd_on_state})
time.sleep(0.25)

# Get noise diode on IQ
Expand All @@ -237,7 +237,7 @@ def calibrate(self, params: dict):

# Set noise diode off
logger.debug("Setting noise diode off")
self.configure_preselector(sensor=self.sensor, params={RF_PATH: nd_off_state})
self.configure_preselector(params={RF_PATH: nd_off_state})
time.sleep(0.25)

# Get noise diode off IQ
Expand Down
14 changes: 7 additions & 7 deletions scos_actions/actions/interfaces/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, parameters: dict):

def configure(self, params: dict):
self.configure_sigan(params)
self.configure_preselector(self.sensor, params)
self.configure_preselector(params)

@property
def sensor(self):
Expand All @@ -59,13 +59,13 @@ def configure_sigan(self, params: dict):
else:
logger.warning(f"Sigan does not have attribute {key}")

def configure_preselector(self, sensor: Sensor, params: dict):
preselector = sensor.preselector
def configure_preselector(self, params: dict):
preselector = self.sensor.preselector
if self.PRESELECTOR_PATH_KEY in params:
path = params[self.PRESELECTOR_PATH_KEY]
logger.debug(f"Setting preselector RF path: {path}")
preselector.set_state(path)
elif sensor.has_configurable_preselector:
elif self.sensor.has_configurable_preselector:
# Require the RF path to be specified if the sensor has a preselector.
raise ParameterException(
f"No {self.PRESELECTOR_PATH_KEY} value specified in the YAML config."
Expand All @@ -74,7 +74,7 @@ def configure_preselector(self, sensor: Sensor, params: dict):
# No preselector in use, so do not require an RF path
pass

def get_sigmf_builder(self, sensor: Sensor, schedule_entry: dict) -> None:
def get_sigmf_builder(self, schedule_entry: dict) -> None:
"""
Set the `sigmf_builder` instance variable to an initialized SigMFBuilder.
Expand All @@ -101,8 +101,8 @@ def get_sigmf_builder(self, sensor: Sensor, schedule_entry: dict) -> None:
)
sigmf_builder.set_action(action_obj)

if sensor.location is not None:
sigmf_builder.set_geolocation(sensor.location)
if self.sensor.location is not None:
sigmf_builder.set_geolocation(self.sensor.location)
if self.sensor.capabilities is not None and hasattr(
self.sensor.capabilities, "sensor"
):
Expand Down
2 changes: 1 addition & 1 deletion scos_actions/actions/interfaces/measurement_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, parameters: dict):

def __call__(self, sensor: Sensor, schedule_entry: dict, task_id: int):
self._sensor = sensor
self.get_sigmf_builder(sensor, schedule_entry)
self.get_sigmf_builder(schedule_entry)
self.test_required_components()
self.configure(self.parameters)
measurement_result = self.execute(schedule_entry, task_id)
Expand Down

0 comments on commit 5d32721

Please sign in to comment.