Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
dboulware committed Jan 10, 2024
1 parent 6707e77 commit 8c405f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions scos_actions/actions/acquire_sea_data_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@

# Create power detectors
TD_DETECTOR = create_statistical_detector("TdMeanMaxDetector", ["max", "mean"])
FFT_M3_DETECTOR = create_statistical_detector("FftM3Detector", ["max", "mean", "median"])
FFT_M3_DETECTOR = create_statistical_detector(
"FftM3Detector", ["max", "mean", "median"]
)
PFP_M3_DETECTOR = create_statistical_detector("PfpM3Detector", ["min", "max", "mean"])


Expand Down Expand Up @@ -158,7 +160,7 @@ def __init__(
# Compute the amplitude shift for PSD scaling. The FFT result
# is in pseudo-power log units and must be scaled to a PSD.
self.fft_scale_factor = (
- 10.0 * np.log10(impedance_ohms) # Pseudo-power to power
-10.0 * np.log10(impedance_ohms) # Pseudo-power to power
+ 27.0 # Watts to dBm (+30) and baseband to RF (-3)
- 10.0 * np.log10(sample_rate_Hz * fft_size) # PSD scaling
+ 20.0 * np.log10(window_ecf) # Window energy correction
Expand All @@ -178,7 +180,9 @@ def run(self, iq: ray.ObjectRef) -> np.ndarray:
)
# Power in Watts
fft_amplitudes = calculate_pseudo_power(fft_amplitudes)
fft_result = apply_statistical_detector(fft_amplitudes, self.detector) # (max, mean, median)
fft_result = apply_statistical_detector(
fft_amplitudes, self.detector
) # (max, mean, median)
percentile_result = np.percentile(fft_amplitudes, self.percentiles, axis=0)
fft_result = np.vstack((fft_result, percentile_result))
fft_result = np.fft.fftshift(fft_result, axes=(1,)) # Shift frequencies
Expand Down Expand Up @@ -1001,7 +1005,8 @@ def create_global_data_product_metadata(self) -> None:
name="Power Spectral Density",
series=[d.value for d in FFT_M3_DETECTOR]
+ [
f"{int(p)}th_percentile" if p.is_integer() else f"{p}th_percentile" for p in FFT_PERCENTILES
f"{int(p)}th_percentile" if p.is_integer() else f"{p}th_percentile"
for p in FFT_PERCENTILES
], # ["max", "mean", "median", "25th_percentile", "75th_percentile", ... "99.99th_percentile"]
length=int(FFT_SIZE * (5 / 7)),
x_units="Hz",
Expand Down
2 changes: 1 addition & 1 deletion scos_actions/actions/calibrate_y_factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

from scos_actions import utils
from scos_actions.actions.interfaces.action import Action
from scos_actions.calibration import sensor_calibration, default_sensor_calibration
from scos_actions.calibration import default_sensor_calibration, sensor_calibration
from scos_actions.hardware.mocks.mock_gps import MockGPS
from scos_actions.hardware.sigan_iface import SIGAN_SETTINGS_KEYS
from scos_actions.settings import SENSOR_CALIBRATION_FILE
Expand Down

0 comments on commit 8c405f7

Please sign in to comment.