@@ -45,7 +45,6 @@ PY_BLOCKS_PER_TRANSFER = 16
4545# hackrf sweep settings
4646AVAILABLE_SAMPLING_RATES = (2 _000_000, 4 _000_000, 6 _000_000, 8 _000_000, 10 _000_000, 12 _000_000, 14 _000_000, 16 _000_000, 18 _000_000, 20 _000_000)
4747AVAILABLE_BASEBAND_FILTER_BANDWIDTHS = (1 _750_000, 2 _500_000, 3 _500_000, 5 _000_000, 5 _500_000, 6 _000_000, 7 _000_000, 8 _000_000, 9 _000_000, 10 _000_000, 12 _000_000, 14 _000_000, 15 _000_000, 20 _000_000, 24 _000_000, 28 _000_000)
48- BASEBAND_FILTER_BANDWIDTH_RATIO = 0.75
4948INTERLEAVED_OFFSET_RATIO = 0.375
5049LINEAR_OFFSET_RATIO = 0.5
5150
@@ -229,7 +228,7 @@ cdef sweep_callback(buffer: np.ndarray[:], buffer_length: int, valid_length: int
229228
230229
231230def pyhackrf_sweep (frequencies: list = [0 , 6000 ], lna_gain: int = 16 , vga_gain: int = 20 , bin_width: int = 100 _000,
232- serial_number: str = None , amp_enable: bool = False , antenna_enable: bool = False , sample_rate: int = 20 _000_000, bandwidth : int = 15 _000_000,
231+ serial_number: str = None , amp_enable: bool = False , antenna_enable: bool = False , sample_rate: int = 20 _000_000, baseband_filter : int = 15 _000_000,
233232 num_sweeps: int = None , binary_output: bool = False , one_shot: bool = False , use_queue: bool = False , filename: str = None , sweep_style: pyhackrf.py_sweep_style = pyhackrf.py_sweep_style.INTERLEAVED,
234233 print_to_console: bool = True , device: pyhackrf.PyHackrfDevice = None ):
235234
@@ -250,11 +249,13 @@ def pyhackrf_sweep(frequencies: list = [0, 6000], lna_gain: int = 16, vga_gain:
250249 SAMPLE_RATE = int (sample_rate)
251250 else :
252251 SAMPLE_RATE = 20 _000_000
253-
254- if bandwidth in AVAILABLE_BASEBAND_FILTER_BANDWIDTHS:
255- BASEBAND_FILTER_BANDWIDTH = int (bandwidth)
252+
253+ SAMPLE_RATE = int (sample_rate)
254+
255+ if baseband_filter in AVAILABLE_BASEBAND_FILTER_BANDWIDTHS:
256+ BASEBAND_FILTER_BANDWIDTH = int (baseband_filter)
256257 else :
257- BASEBAND_FILTER_BANDWIDTH = int (SAMPLE_RATE * BASEBAND_FILTER_BANDWIDTH_RATIO )
258+ BASEBAND_FILTER_BANDWIDTH = pyhackrf.pyhackrf_compute_baseband_filter_bw( int (baseband_filter) )
258259
259260 frequency_step_1 = sample_rate // 4
260261 frequency_step_2 = sample_rate // 2
0 commit comments