Skip to content

Commit

Permalink
Correct comments for PSD result ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanielloNTIA committed Dec 27, 2023
1 parent 2b63adc commit 4f0c8dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scos_actions/actions/acquire_sea_data_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,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 +178,7 @@ 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) # (mean, median, max)
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 All @@ -187,7 +187,7 @@ def run(self, iq: ray.ObjectRef) -> np.ndarray:
] # Truncation to middle bins
fft_result = 10.0 * np.log10(fft_result) + self.fft_scale_factor

# Returned order is (mean, median, max, 25%, 75%, 90%, 95%, 99%, 99.9%, 99.99%)
# Returned order is (max, mean, median, 25%, 75%, 90%, 95%, 99%, 99.9%, 99.99%)
# Total of 10 arrays, each of length 125 (output shape (10, 125))
# Percentile computation linearly interpolates. See numpy documentation.
return fft_result
Expand Down

0 comments on commit 4f0c8dd

Please sign in to comment.