Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add signal analyzer and gps registration signals. #108

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 6 additions & 0 deletions scos_actions/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@

# Provides argument 'action'
register_action = Signal()

# Provides argument 'signal_analyzer'
register_signal_analyzer = Signal()
aromanielloNTIA marked this conversation as resolved.
Show resolved Hide resolved

# Provides argument 'gps'
register_gps = Signal()