121
121
122
122
# Create power detectors
123
123
TD_DETECTOR = create_statistical_detector ("TdMeanMaxDetector" , ["max" , "mean" ])
124
- FFT_M3_DETECTOR = create_statistical_detector ("FftM3Detector" , ["max" , "mean" , "median" ])
124
+ FFT_M3_DETECTOR = create_statistical_detector (
125
+ "FftM3Detector" , ["max" , "mean" , "median" ]
126
+ )
125
127
PFP_M3_DETECTOR = create_statistical_detector ("PfpM3Detector" , ["min" , "max" , "mean" ])
126
128
127
129
@@ -158,7 +160,7 @@ def __init__(
158
160
# Compute the amplitude shift for PSD scaling. The FFT result
159
161
# is in pseudo-power log units and must be scaled to a PSD.
160
162
self .fft_scale_factor = (
161
- - 10.0 * np .log10 (impedance_ohms ) # Pseudo-power to power
163
+ - 10.0 * np .log10 (impedance_ohms ) # Pseudo-power to power
162
164
+ 27.0 # Watts to dBm (+30) and baseband to RF (-3)
163
165
- 10.0 * np .log10 (sample_rate_Hz * fft_size ) # PSD scaling
164
166
+ 20.0 * np .log10 (window_ecf ) # Window energy correction
@@ -178,7 +180,9 @@ def run(self, iq: ray.ObjectRef) -> np.ndarray:
178
180
)
179
181
# Power in Watts
180
182
fft_amplitudes = calculate_pseudo_power (fft_amplitudes )
181
- fft_result = apply_statistical_detector (fft_amplitudes , self .detector ) # (max, mean, median)
183
+ fft_result = apply_statistical_detector (
184
+ fft_amplitudes , self .detector
185
+ ) # (max, mean, median)
182
186
percentile_result = np .percentile (fft_amplitudes , self .percentiles , axis = 0 )
183
187
fft_result = np .vstack ((fft_result , percentile_result ))
184
188
fft_result = np .fft .fftshift (fft_result , axes = (1 ,)) # Shift frequencies
@@ -1001,7 +1005,8 @@ def create_global_data_product_metadata(self) -> None:
1001
1005
name = "Power Spectral Density" ,
1002
1006
series = [d .value for d in FFT_M3_DETECTOR ]
1003
1007
+ [
1004
- f"{ int (p )} th_percentile" if p .is_integer () else f"{ p } th_percentile" for p in FFT_PERCENTILES
1008
+ f"{ int (p )} th_percentile" if p .is_integer () else f"{ p } th_percentile"
1009
+ for p in FFT_PERCENTILES
1005
1010
], # ["max", "mean", "median", "25th_percentile", "75th_percentile", ... "99.99th_percentile"]
1006
1011
length = int (FFT_SIZE * (5 / 7 )),
1007
1012
x_units = "Hz" ,
0 commit comments