Skip to content

Commit

Permalink
use cal adjust in sea data product action, don't get cal datetime if …
Browse files Browse the repository at this point in the history
…not cal_adjust, remove debug messages
  • Loading branch information
jhazentia committed Feb 20, 2024
1 parent 7f79201 commit 322d096
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
7 changes: 4 additions & 3 deletions scos_actions/actions/acquire_sea_data_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
DURATION_MS = "duration_ms"
NUM_SKIP = "nskip"
PFP_FRAME_PERIOD_MS = "pfp_frame_period_ms"
CAL_ADJUST = "calibration_adjust"

# Constants
DATA_TYPE = np.half
Expand Down Expand Up @@ -161,6 +162,7 @@ def __init__(
- 10.0 * np.log10(sample_rate_Hz * fft_size) # PSD scaling
+ 20.0 * np.log10(window_ecf) # Window energy correction
)
self.cal_adjust = True

def run(self, iq: ray.ObjectRef) -> np.ndarray:
"""
Expand Down Expand Up @@ -629,8 +631,7 @@ def capture_iq(self, params: dict) -> dict:
cal_adjust = True
for key, value in params.items():
logger.debug(f"param {key}={value}")
if "calibration_adjust" in params:
cal_adjust = params["calibration_adjust"]
self.cal_adjust = utils.get_parameter(CAL_ADJUST, params)
logger.debug(f"cal_adjust={cal_adjust}")
measurement_result = self.sensor.signal_analyzer.acquire_time_domain_samples(
num_samples, nskip, cal_adjust=cal_adjust
Expand Down Expand Up @@ -1134,7 +1135,7 @@ def create_capture_segment(
preamp_enable=self.sensor.signal_analyzer.preamp_enable,
),
)
if "sensor_cal" in measurement_result:
if self.cal_adjust:
capture_segment.sensor_calibration=ntia_sensor.Calibration(
datetime=measurement_result["sensor_cal"]["datetime"],
gain=round(measurement_result["sensor_cal"]["gain"], 3),
Expand Down
2 changes: 1 addition & 1 deletion scos_actions/actions/acquire_single_freq_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def execute(self, schedule_entry: dict, task_id: int) -> dict:
# Save measurement results
measurement_result["data"] = m4s_result
measurement_result.update(self.parameters)
if self.sensor.signal_analyzer.sensor_calibration_data:
if self.cal_adjust:
measurement_result[
"calibration_datetime"
] = self.sensor.signal_analyzer.sensor_calibration_data["datetime"]
Expand Down
3 changes: 0 additions & 3 deletions scos_actions/actions/acquire_stepped_freq_tdomain_iq.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def __call__(self, sensor: Sensor, schedule_entry: dict, task_id: int):
sample_rate = self.sensor.signal_analyzer.sample_rate
num_samples = int(sample_rate * duration_ms * 1e-3)
measurement_result = super().acquire_data(num_samples, nskip, cal_adjust)
logger.debug("Acquired measurement_result")
measurement_result.update(measurement_params)
end_time = utils.get_datetime_str_now()
measurement_result["end_time"] = end_time
Expand Down Expand Up @@ -136,9 +135,7 @@ def __call__(self, sensor: Sensor, schedule_entry: dict, task_id: int):
)
measurement_result["capture_segment"] = capture_segment

logger.debug("Creating metadata for measurement result")
self.create_metadata(measurement_result, recording_id)
logger.debug("sending measurement result to handler")
measurement_action_completed.send(
sender=self.__class__,
task_id=task_id,
Expand Down

0 comments on commit 322d096

Please sign in to comment.