def range_example(fntx, fnrx, fs, verbose=True): tx = np.fromfile(fntx, np.complex64) rx = np.fromfile(fnrx, np.complex64) if verbose: print(f'TX samples {tx.size} RX samples {rx.size}') distest_m = estimate_range(tx, rx, fs, not verbose) return distest_m
def range_example(fntx,fnrx,fs,verbose=True): tx = np.fromfile(fntx, np.complex64) rx = np.fromfile(fnrx, np.complex64) if verbose: print(f'TX samples {tx.size} RX samples {rx.size}') distest_m = estimate_range(tx,rx,fs, not verbose) return distest_m
p.add_argument('-v', '--verbose', action='store_true') p = p.parse_args() quiet = p.quiet tx = waveform_to_file(station_id, p.codelen, filt=p.filter, outpath=p.outpath, verbose=p.verbose) if p.freqmhz: # on-air transmission from piradar.raspi import transmit_raspi transmit_raspi(tx, p.fs, p.freqmhz) else: # simulation only #%% transmit spectrum if not quiet: spec(tx, p.fs) #%% simulate noisy, reflected signal rx = sim_iono(tx, p.fs, dist_m, p.codelen, Nstd, Ajam, station_id, p.filter, p.outpath, p.verbose) #%% receive cross-correlate distest_m = estimate_range(tx, rx, p.fs, quiet) print('estimated one-way distance {:.1f} km'.format(distest_m / 1e3)) #%% plot Nraw = 100 # arbitrary, just for plotting if not quiet: raw(tx, rx, p.fs, Nraw) show()
p.add_argument('--filter',help='smooth transmit waveform to limit needless bandwidth',action='store_true') p.add_argument('-f','--freqmhz', help='transmit center frequency [MHz]',type=float) p.add_argument('--fs',help='sample frequency [Hz]',type=int,default=100000) p.add_argument('-o','--outpath',help='write to path instead of stdout') p.add_argument('-q','--quiet',help='do not plot anything',action='store_true') p.add_argument('-v','--verbose',action='store_true') p = p.parse_args() quiet = p.quiet tx = waveform_to_file(station_id,p.codelen, filt=p.filter, outpath=p.outpath,verbose=p.verbose) if p.freqmhz: # on-air transmission from piradar.raspi import transmit_raspi transmit_raspi(tx, p.fs, p.freqmhz) else: # simulation only #%% transmit spectrum if not quiet: spec(tx, p.fs) #%% simulate noisy, reflected signal rx = sim_iono(tx,p.fs,dist_m,p.codelen,Nstd,Ajam,station_id,p.filter,p.outpath,p.verbose) #%% receive cross-correlate distest_m = estimate_range(tx,rx,p.fs,quiet) print('estimated one-way distance {:.1f} km'.format(distest_m/1e3)) #%% plot Nraw = 100 # arbitrary, just for plotting if not quiet: plotraw(tx, rx, p.fs, Nraw) show()