Skip to content

Commit 49322d0

Browse files
committed
updated
1 parent 1e70fa9 commit 49322d0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

python_hackrf/pyhackrf_tools/pyhackrf_sweep.pyx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ cpdef int sweep_callback(c_pyhackrf.PyHackrfDevice device, cnp.ndarray[cnp.int8_
116116

117117
cdef uint64_t start_frequency = device_data['start_frequency']
118118

119-
cdef cnp.ndarray fftOut
120119
cdef cnp.ndarray raw_iq
121120
cdef cnp.ndarray pwr
122121

@@ -162,9 +161,9 @@ cpdef int sweep_callback(c_pyhackrf.PyHackrfDevice device, cnp.ndarray[cnp.int8_
162161
index += (pyhackrf.PY_BYTES_PER_BLOCK - data_length)
163162

164163
raw_iq = buffer[index:index + data_length:2] / 128 + 1j * buffer[index + 1:index + data_length:2] / 128
165-
raw_iq = (raw_iq - raw_iq.mean()) * window
166-
fftOut = fft(raw_iq)
167-
pwr = np.log10(np.abs(fftOut * norm_factor) ** 2) * 10.0
164+
# raw_iq = (raw_iq - raw_iq.mean()) * window
165+
raw_iq = (raw_iq - (raw_iq * window).sum() / window.sum()) * window
166+
pwr = np.log10(np.abs(fft(raw_iq) * norm_factor) ** 2) * 10.0
168167

169168
if sweep_style == pyhackrf.py_sweep_style.LINEAR:
170169
pwr = fftshift(pwr)

0 commit comments

Comments
 (0)