diff --git a/python/.directory b/python/.directory index 1b24db0..f07d267 100644 --- a/python/.directory +++ b/python/.directory @@ -1,6 +1,4 @@ [Dolphin] -SortOrder=1 -SortRole=date -Timestamp=2016,11,28,10,51,9 +Timestamp=2017,3,21,10,40,35 Version=3 ViewMode=1 diff --git a/python/max_freq.py b/python/max_freq.py index ac1467a..ce67e0d 100644 --- a/python/max_freq.py +++ b/python/max_freq.py @@ -43,7 +43,7 @@ class max_freq(gr.sync_block): self.timer=time.time() self.message_port_register_in(pmt.intern('ctrl')) self.set_msg_handler(pmt.intern('ctrl'), self.handle_ctrl_msg) - self.searchMode=False + self.searchMode=True self.index_fixed=[False]*self.num_decoders def freq_to_index(self,freq): startfreq=self.center_freq-self.samp_rate/2 @@ -51,6 +51,12 @@ class max_freq(gr.sync_block): #(freq-startfreq)*self.fft_len/self.samp_rate=index index=(freq-startfreq)*self.fft_len/self.samp_rate return index + def index_to_freq(self,index): + startfreq=self.center_freq-self.samp_rate/2 + index=(freq-startfreq)*self.fft_len/self.samp_rate + freq=index*self.samp_rate/self.fft_len+startfreq + return freq + def handle_ctrl_msg(self,msg): m = pmt.pmt_to_python.pmt_to_dict(msg) if m.has_key("cmd") and m["cmd"]=="set_audio_freq": @@ -93,11 +99,13 @@ class max_freq(gr.sync_block): carrier_width=2 carrier=self.fft_len/2 numbers=np.delete(input_items[0][0],range(carrier-carrier_width,carrier+carrier_width+1))#read input and disregard center (hackrf LO) - threshold=40# uni + #threshold=40# uni #threshold=60#home + threshold=np.mean(numbers)#2017-03-21 fft-multi-decoder #minimum number of consecutive maximums (in fft domain) to consider signal as station: #min_consec_max_threshold=1#uni - min_consec_max_threshold=3#home + #min_consec_max_threshold=3#home + min_consec_max_threshold=6#2017-03-21 fft-multi-decoder fuzzyness=2#uni #fuzzyness=10#home @@ -133,15 +141,37 @@ class max_freq(gr.sync_block): if count>=min_consec_max_threshold: threshold_reached=True last_index=i + + same_station_threshold=int(100000*self.fft_len/self.samp_rate)#0.1mhz + #group similar indices: + lastindex=0 + group=None + station_indices_grouped=[] + for idx in station_indices: + if group==None: #start new group + group=[idx] + elif (idx-lastindex)