mirror of
https://github.com/hb9fxq/gr-digitalhf
synced 2024-12-22 07:09:59 +00:00
move np.bool(...) to msg_proxy
This commit is contained in:
parent
d25b06a9d7
commit
09527e2383
|
@ -49,7 +49,7 @@ class msg_proxy(gr.basic_block):
|
|||
iq_samples = pmt.to_python(pmt.cdr(msg_in))
|
||||
success,doppler = self._obj.get_doppler(iq_samples)
|
||||
msg_out = pmt.make_dict()
|
||||
msg_out = pmt.dict_add(msg_out, pmt.intern('success'), pmt.to_pmt(success))
|
||||
msg_out = pmt.dict_add(msg_out, pmt.intern('success'), pmt.to_pmt(np.bool(success)))
|
||||
msg_out = pmt.dict_add(msg_out, pmt.intern('doppler'), pmt.to_pmt(doppler))
|
||||
## print(msg_out)
|
||||
self.message_port_pub(self._port_doppler, msg_out)
|
||||
|
@ -64,7 +64,7 @@ class msg_proxy(gr.basic_block):
|
|||
msg_out = pmt.dict_add(msg_out, pmt.intern('symb'), pmt.to_pmt(symb['symb']))
|
||||
msg_out = pmt.dict_add(msg_out, pmt.intern('scramble'), pmt.to_pmt(symb['scramble']))
|
||||
msg_out = pmt.dict_add(msg_out, pmt.intern('constellation_idx'), pmt.to_pmt(constellation_idx))
|
||||
msg_out = pmt.dict_add(msg_out, pmt.intern('do_continue'), pmt.to_pmt(do_continue))
|
||||
msg_out = pmt.dict_add(msg_out, pmt.intern('save_soft_dec'), pmt.to_pmt(save_soft_dec))
|
||||
msg_out = pmt.dict_add(msg_out, pmt.intern('do_continue'), pmt.to_pmt(np.bool(do_continue)))
|
||||
msg_out = pmt.dict_add(msg_out, pmt.intern('save_soft_dec'), pmt.to_pmt(np.bool(save_soft_dec)))
|
||||
## print(msg_out)
|
||||
self.message_port_pub(self._port_frame_info, msg_out)
|
||||
|
|
|
@ -139,7 +139,7 @@ class PhysicalLayer(object):
|
|||
self._frame_counter += 1
|
||||
print('test:', symbols[self._mode['unknown']:], np.mean(np.real(symbols[self._mode['unknown']:])))
|
||||
if self._frame_counter < self._num_frames_per_block-2:
|
||||
success = np.bool(np.mean(np.real(symbols[self._mode['unknown']:])) > 0.7)
|
||||
success = np.mean(np.real(symbols[self._mode['unknown']:])) > 0.7
|
||||
return [self.get_next_data_frame(success),self._mode['ci'],success,success]
|
||||
|
||||
def get_next_data_frame(self, success):
|
||||
|
@ -177,9 +177,7 @@ class PhysicalLayer(object):
|
|||
tpks = np.abs(cc[imax+3*16*sps:imax+5*16*sps])
|
||||
print('imax=', imax, 'apks=',apks,
|
||||
np.mean(apks), np.mean(tpks))
|
||||
success = np.bool(np.mean(apks) > 5*np.mean(tpks) and
|
||||
apks[0]/apks[1] > 0.5 and
|
||||
apks[0]/apks[1] < 2.0)
|
||||
success = np.mean(apks) > 5*np.mean(tpks) and apks[0]/apks[1] > 0.5 and apks[0]/apks[1] < 2.0
|
||||
if success:
|
||||
idx = np.arange(32*sps)
|
||||
pks = [np.correlate(iq_samples[imax+i*32*sps+idx],
|
||||
|
|
|
@ -183,7 +183,7 @@ class PhysicalLayer(object):
|
|||
pks = [np.correlate(iq_samples[imax+i*23*sps+idx],
|
||||
zp[i*23*sps+idx])[0]
|
||||
for i in range(8)]
|
||||
success = np.bool(np.mean(np.abs(pks)) > 2*np.mean(np.abs(cc[imax+11*sps+range(-sps,sps)])))
|
||||
success = np.mean(np.abs(pks)) > 2*np.mean(np.abs(cc[imax+11*sps+range(-sps,sps)]))
|
||||
print('test:',imax, np.mean(np.abs(pks)), np.mean(np.abs(cc[imax+11*sps+range(-sps,sps)])))
|
||||
if success:
|
||||
print('doppler apks', np.abs(pks))
|
||||
|
@ -198,10 +198,10 @@ class PhysicalLayer(object):
|
|||
pass
|
||||
|
||||
def get_preamble_quality(self, symbols):
|
||||
return np.bool(np.abs(np.mean(symbols[-40:])) > 0.5)
|
||||
return np.abs(np.mean(symbols[-40:])) > 0.5
|
||||
|
||||
def get_data_frame_quality(self, symbols):
|
||||
return np.bool(np.abs(np.mean(symbols[-31:])) > 0.5)
|
||||
return np.abs(np.mean(symbols[-31:])) > 0.5
|
||||
|
||||
def decode_reinserted_preamble(self, symbols):
|
||||
## decode D0,D1,D2
|
||||
|
|
|
@ -46,7 +46,7 @@ class PhysicalLayer(object):
|
|||
idx = range(30,80)
|
||||
z = symbols[idx]*np.conj(self._preamble['symb'][idx])
|
||||
## print('quality_preamble',np.sum(np.real(z)<0), symbols[idx])
|
||||
success = np.bool(np.sum(np.real(z)<0) < 30)
|
||||
success = np.sum(np.real(z)<0) < 30
|
||||
frame_description = [self._data,self._mode,success,True]
|
||||
|
||||
self._frame_counter += 1
|
||||
|
@ -69,7 +69,7 @@ class PhysicalLayer(object):
|
|||
pks = cc[(imax,imax+31*sps),]
|
||||
tpks = cc[imax+15*sps:imax+16*sps]
|
||||
## print('doppler: ', np.abs(pks), np.abs(tpks))
|
||||
success = np.bool(np.mean(np.abs(pks)) > 5*np.mean(np.abs(tpks)))
|
||||
success = np.mean(np.abs(pks)) > 5*np.mean(np.abs(tpks))
|
||||
doppler = np.diff(np.unwrap(np.angle(pks)))[0]/31/self._sps if success else 0
|
||||
return success,doppler
|
||||
|
||||
|
|
Loading…
Reference in a new issue