summaryrefslogtreecommitdiffstats
path: root/_signal_processing
diff options
context:
space:
mode:
authorCarl Laufer <carl@system76-pc.localdomain>2022-04-18 07:31:53 +0200
committerCarl Laufer <carl@system76-pc.localdomain>2022-04-18 07:31:53 +0200
commitec02dbaee763b53298a4e3982801b3a37eb4f513 (patch)
tree596cb872a9c92aa52d651d89180f5cd4e4364110 /_signal_processing
parentUpdate kraken_pr_start.sh (diff)
downloadkrakensdr_pr-ec02dbaee763b53298a4e3982801b3a37eb4f513.tar
krakensdr_pr-ec02dbaee763b53298a4e3982801b3a37eb4f513.tar.gz
krakensdr_pr-ec02dbaee763b53298a4e3982801b3a37eb4f513.tar.bz2
krakensdr_pr-ec02dbaee763b53298a4e3982801b3a37eb4f513.tar.lz
krakensdr_pr-ec02dbaee763b53298a4e3982801b3a37eb4f513.tar.xz
krakensdr_pr-ec02dbaee763b53298a4e3982801b3a37eb4f513.tar.zst
krakensdr_pr-ec02dbaee763b53298a4e3982801b3a37eb4f513.zip
Diffstat (limited to '_signal_processing')
-rwxr-xr-x_signal_processing/krakenSDR_signal_processor.py45
1 files changed, 11 insertions, 34 deletions
diff --git a/_signal_processing/krakenSDR_signal_processor.py b/_signal_processing/krakenSDR_signal_processor.py
index d009790..f3c7633 100755
--- a/_signal_processing/krakenSDR_signal_processor.py
+++ b/_signal_processing/krakenSDR_signal_processor.py
@@ -26,6 +26,7 @@ import logging
import threading
import queue
import math
+import multiprocessing
# Import optimization modules
import numba as nb
@@ -91,12 +92,6 @@ class SignalProcessor(threading.Thread):
# Squelch feature
self.data_ready = False
- self.en_squelch = False
- self.squelch_threshold = 0.1
- self.squelch_trigger_channel = 0
- self.raw_signal_amplitude = np.empty(0)
- self.filt_signal = np.empty(0)
- self.squelch_mask = np.empty(0)
# DOA processing options
self.en_DOA_Bartlett = False
@@ -146,7 +141,7 @@ class SignalProcessor(threading.Thread):
Main processing thread
"""
- pyfftw.config.NUM_THREADS = 4
+ pyfftw.config.NUM_THREADS = multiprocessing.cpu_count()
pyfftw.config.PLANNER_EFFORT = "FFTW_MEASURE" #"FFTW_PATIENT"
scipy.fft.set_backend(pyfftw.interfaces.scipy_fft)
pyfftw.interfaces.cache.enable()
@@ -159,11 +154,12 @@ class SignalProcessor(threading.Thread):
self.is_running = True
que_data_packet = []
- start_time = time.time()
#-----> ACQUIRE NEW DATA FRAME <-----
self.module_receiver.get_iq_online()
+ start_time = time.time()
+
# Check frame type for processing
en_proc = (self.module_receiver.iq_header.frame_type == self.module_receiver.iq_header.FRAME_TYPE_DATA)# or \
#(self.module_receiver.iq_header.frame_type == self.module_receiver.iq_header.FRAME_TYPE_CAL)# For debug purposes
@@ -204,25 +200,6 @@ class SignalProcessor(threading.Thread):
que_data_packet.append(['max_amplitude',max_amplitude])
- #-----> SQUELCH PROCESSING <-----
-
- if self.en_squelch:
- self.data_ready = False
-
- self.processed_signal, decimation_factor, self.fft_signal_width, self.max_index = \
- center_max_signal(self.processed_signal, self.spectrum[0,:], max_spectrum, self.module_receiver.daq_squelch_th_dB, self.module_receiver.iq_header.sampling_freq)
-
- #decimated_signal = []
- #if(decimation_factor > 1):
- # decimated_signal = signal.decimate(self.processed_signal, decimation_factor, n = decimation_factor * 2, ftype='fir')
- # self.processed_signal = decimated_signal #.copy()
-
-
- #Only update if we're above the threshold
- if max_amplitude > self.module_receiver.daq_squelch_th_dB:
- self.data_ready = True
-
-
#-----> SPECTRUM PROCESSING <-----
if self.en_spectrum and self.data_ready:
@@ -303,13 +280,13 @@ class SignalProcessor(threading.Thread):
que_data_packet.append(['latency', int(stop_time*10**3)-self.module_receiver.iq_header.time_stamp])
# If the que is full, and data is ready (from squelching), clear the buffer immediately so that useful data has the priority
- if self.data_que.full() and self.data_ready:
- try:
- #self.logger.info("BUFFER WAS NOT EMPTY, EMPTYING NOW")
- self.data_que.get(False) #empty que if not taken yet so fresh data is put in
- except queue.Empty:
- #self.logger.info("DIDNT EMPTY")
- pass
+ #if self.data_que.full() and self.data_ready:
+ # try:
+ # #self.logger.info("BUFFER WAS NOT EMPTY, EMPTYING NOW")
+ # self.data_que.get(False) #empty que if not taken yet so fresh data is put in
+ # except queue.Empty:
+ # #self.logger.info("DIDNT EMPTY")
+ # pass
# Put data into buffer, but if there is no data because its a cal/trig wait frame etc, then only write if the buffer is empty
# Otherwise just discard the data so that we don't overwrite good DATA frames.