예제 #1
0
파일: receive.py 프로젝트: yxw027/piradar
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
예제 #2
0
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
예제 #3
0
    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()
예제 #4
0
    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()