Exemple #1
0
			recv_chips = np.zeros(2*RECV_CHIPS_I.shape[0], dtype=np.float)
			recv_chips[::2]  = RECV_CHIPS_I[:,phi_idx]
			recv_chips[1::2] = RECV_CHIPS_Q[:,phi_idx]

			# slice bits to simulate hard decision decoder
			if decision in ('hard',):
				recv_chips = np.sign(recv_chips)

			recv_syms = pt.detect_syms_corrcoef(recv_chips)[1:-1]
	        
			ser_s = np.append(ser_s, np.sum(recv_syms != send_syms_s) / (1.0*len(recv_syms)))
	    
		if SER_S is None:
			SER_S = ser_s
		else:
			SER_S = np.vstack((SER_S, ser_s))

		print 'PRR = ', np.mean((1-ser_s)**pktlen)

	np.save('data/ser_s_%s_%s_%s.npy'%(content, decision, mode), SER_S)

if __name__ == '__main__':
	input_params = (('content', ('same', 'unif'), 'Data content'), ('decision', ('hard', 'soft'), 'Bit decision'))
	content, decision = tools.get_params(input_params)

	if not tools.overwrite_ok('data/ser_s_%s_%s_n.npy'%(content, decision)):
		sys.exit()

	gen_n_interf(mode='n')
	gen_n_interf(mode='1')
        for phi_idx in range(len(phi_range)):
            recv_chips = np.empty(2 * RECV_CHIPS_I.shape[0])
            recv_chips[::2] = RECV_CHIPS_I[:, phi_idx]
            recv_chips[1::2] = RECV_CHIPS_Q[:, phi_idx]

            # slice bits to simulate hard decision decoder
            if decision in ("hard",):
                recv_chips = np.sign(recv_chips)

            recv_syms = pt.detect_syms_corr(recv_chips)[1:-1]

            SER_S[tau_idx, phi_idx] = sum(recv_syms != send_syms_s) / (1.0 * len(recv_syms))
            SER_U[tau_idx, phi_idx] = sum(recv_syms != send_syms_u) / (1.0 * len(recv_syms))

    np.savez_compressed("data/ser_Au%.2f_%s_%s_v2.npz" % (Au, content, decision), SER_S=SER_S, SER_U=SER_U, **settings)


if __name__ == "__main__":
    argp = argparse.ArgumentParser()
    argp.add_argument(
        "content", choices=("same", "unif"), help="Relation between data content in the two transmitted packets"
    )
    argp.add_argument("decision", choices=("soft", "hard"), help="Bit decision for DSSS decoding (SDD, HDD)")

    args = argp.parse_args()

    if not tools.overwrite_ok("data/ser_Au%.2f_%s_%s_v2.npz" % (Au, args.content, args.decision)):
        sys.exit(0)

    do_gen(args.content, args.decision)
		for phi_idx in range(len(phi_range)):
			recv_chips       = np.empty(2*RECV_CHIPS_I.shape[0])
			recv_chips[ ::2] = np.sign(RECV_CHIPS_I[:,phi_idx])
			recv_chips[1::2] = np.sign(RECV_CHIPS_Q[:,phi_idx])

			sync_chips       = np.empty(2*send_chips.shape[1])
			sync_chips[ ::2] = send_chips[0]
			sync_chips[1::2] = send_chips[1]

			usync_chips       = np.empty(2*send_chips.shape[1])
			usync_chips[ ::2] = send_chips[2]
			usync_chips[1::2] = send_chips[3]

			# ignore chips that are only partially affected here (the outermost two chips)
			BER_U[tau_idx, phi_idx] = np.sum(recv_chips[2:-2] != usync_chips[2:-2]) / (1.0*len(recv_chips[2:-2]))
			BER_S[tau_idx, phi_idx] = np.sum(recv_chips[2:-2] != sync_chips[2:-2])  / (1.0*len(recv_chips[2:-2]))

	np.savez_compressed("data/ber_Au%.2f_%s.npz"%(Au, content), BER_S=BER_S, BER_U=BER_U, **settings)


if __name__ == "__main__":
	argp = argparse.ArgumentParser()
	argp.add_argument("content",  choices=("same", "unif"), help="Relation between data content in the two transmitted packets")

	args = argp.parse_args()

	if not tools.overwrite_ok("data/ber_Au%.2f_%s.npz"%(Au, args.content)):
		exit()

	do_gen(args.content)
Exemple #4
0
        action='store_true',
        help=
        'Wide interval of time offsets used (-4T to 4T instead of -1.5T to 1.5T)'
    )
    argp.add_argument(
        '-n',
        '--numthreads',
        type=int,
        default=1,
        help="Number of threads to start in the worker pool (default:1)")

    args = argp.parse_args()

    wide = ('_wide' if args.wide else '')

    if not tools.overwrite_ok('data/prr_AsAu_%s_%s%s.npz' %
                              (args.content, args.decision, wide)):
        exit()

    pool = mp.Pool(args.numthreads)
    pool.map(
        partial(do_gen,
                content=args.content,
                decision=args.decision,
                wide=wide,
                numthreads=args.numthreads), list(range(args.numthreads)))

    PRR_S, PRR_U = None, None
    SER_S_PHI, SER_U_PHI = None, None

    tau_range = (tau_range_wide if wide else tau_range_norm)
    Au_range = (Au_range_wide if wide else Au_range_norm)
Exemple #5
0
            usync_chips[::2] = send_chips[2]
            usync_chips[1::2] = send_chips[3]

            # ignore chips that are only partially affected here (the outermost two chips)
            BER_U[tau_idx,
                  phi_idx] = np.sum(recv_chips[2:-2] != usync_chips[2:-2]) / (
                      1.0 * len(recv_chips[2:-2]))
            BER_S[tau_idx,
                  phi_idx] = np.sum(recv_chips[2:-2] != sync_chips[2:-2]) / (
                      1.0 * len(recv_chips[2:-2]))

    np.savez_compressed("data/ber_Au%.2f_%s.npz" % (Au, content),
                        BER_S=BER_S,
                        BER_U=BER_U,
                        **settings)


if __name__ == "__main__":
    argp = argparse.ArgumentParser()
    argp.add_argument(
        "content",
        choices=("same", "unif"),
        help="Relation between data content in the two transmitted packets")

    args = argp.parse_args()

    if not tools.overwrite_ok("data/ber_Au%.2f_%s.npz" % (Au, args.content)):
        exit()

    do_gen(args.content)
Exemple #6
0
            recv_syms = pt.detect_syms_corr(recv_chips)[1:-1]

            SER_S[ninterf_, phi_idx] = np.sum(
                recv_syms != send_syms_s) / (1.0 * len(recv_syms))

        print("PRR = ", np.mean((1.0 - SER_S[ninterf_, :])**pktlen))

    np.savez_compressed("data/ser_s_%s_%s_%s.npz" % (content, decision, mode),
                        SER_S=SER_S,
                        **settings)


if __name__ == "__main__":
    argp = argparse.ArgumentParser()
    argp.add_argument(
        "content",
        choices=("same", "unif"),
        help="Relation between data content in the two transmitted packets")
    argp.add_argument("decision",
                      choices=("soft", "hard"),
                      help="Bit decision for DSSS decoding (SDD, HDD)")

    args = argp.parse_args()

    if not tools.overwrite_ok("data/ser_s_%s_%s_n.npy" %
                              (args.content, args.decision)):
        sys.exit()

    gen_n_interf(args.content, args.decision, mode="n")
    gen_n_interf(args.content, args.decision, mode="1")
		tau_range=tau_range, As=As, Au_range=Au_range, phi_range=phi_range,
		pktlen=pktlen, nsteps=nsteps, nbits=nbits)


if __name__ == '__main__':
	# Query user to enter parameter settings, useful to run scripts in parallel
	argp = argparse.ArgumentParser()
	argp.add_argument('content',  choices=('same', 'unif'), help='Relation between data content in the two transmitted packets')
	argp.add_argument('-w', '--wide', action='store_true', help='Wide interval of time offsets used (-4T to 4T instead of -1.5T to 1.5T)')
	argp.add_argument('-n', '--numthreads', type=int, default=1, help="Number of threads to start in the worker pool (default:1)")

	args = argp.parse_args()

	wide = ('_wide' if args.wide else '')

	if not tools.overwrite_ok('data/prr_AsAu_%s%s.npz'%(args.content, wide)):
		exit()

	pool = mp.Pool(args.numthreads)
	pool.map(partial(do_gen, content=args.content, wide=wide, numthreads=args.numthreads), list(range(args.numthreads)))

	PRR_S, PRR_U = None, None

	tau_range   = (tau_range_wide   if wide else tau_range_g)
	Au_range    = (Au_range_wide    if wide else Au_range_g)
	Au_range_dB = (Au_range_wide_dB if wide else Au_range_dB)

	# combine stuff again and cleanup
	for part in range(args.numthreads):
		data = np.load('data/prr_AsAu_%s%s_part%i.npz'%(args.content, wide, part))
	# Query user to enter parameter settings, useful to run scripts in parallel
	argp = argparse.ArgumentParser()
	argp.add_argument("content",  choices=("same", "unif"), help="Relation between data content in the two transmitted packets")
	argp.add_argument("decision", choices=("soft", "hard"), help="Bit decision for DSSS decoding (SDD, HDD)")
	argp.add_argument("-w", "--wide", action="store_true", help="Wide interval of time offsets used (-4T to 4T instead of -1.5T to 1.5T)")
	argp.add_argument("-u", "--ultrawide", action="store_true", help="Extended wide interval of time offsets used (-12T to 12T)")
	argp.add_argument("-n", "--numthreads", type=int, default=1, help="Number of threads to start in the worker pool (default:1)")

	args = argp.parse_args()

	if not args.ultrawide:
		wide = ("_wide" if args.wide else "")
	else:
		wide = "_uwide"

	if not tools.overwrite_ok("data/prr_AsAu_%s_%s%s.npz"%(args.content, args.decision, wide)):
		exit()

	pool = mp.Pool(args.numthreads)
	pool.map(partial(do_gen, content=args.content, decision=args.decision, wide=wide, numthreads=args.numthreads), list(range(args.numthreads)))

	PRR_S, PRR_U = None, None

	tau_range   = (tau_range_wide   if wide else tau_range_norm)
	Au_range    = (Au_range_wide    if wide else Au_range_norm)
	Au_range_dB = (Au_range_wide_dB if wide else Au_range_norm_dB)

	# combine stuff again and cleanup
	for part in range(args.numthreads):
		data = np.load("data/prr_AsAu_%s_%s%s_part%i.npz"%(args.content, args.decision, wide, part))
Exemple #9
0
        if SER_S is None:
            SER_S = ser_s
            SER_U = ser_u
        else:
            SER_S = np.vstack((SER_S, ser_s))
            SER_U = np.vstack((SER_U, ser_u))

    np.savez_compressed('data/ser_Au%.2f_%s_%s_v2.npz' %
                        (Au, content, decision),
                        tau_range=tau_range,
                        phi_range=phi_range,
                        As=As,
                        Au=Au,
                        SER_S=SER_S,
                        SER_U=SER_U,
                        nsyms=nsyms,
                        nsteps=nsteps)


if __name__ == '__main__':
    input_params = (('content', ('same', 'unif'), 'Data content'),
                    ('decision', ('hard', 'soft'), 'Bit decision'))
    content, decision = tools.get_params(input_params)

    if not tools.overwrite_ok('data/ser_u_Au%.2f_%s_%s.npy' %
                              (Au, content, decision)):
        sys.exit(0)

    do_gen(content, decision)
                  phi_idx] = sum(recv_syms != send_syms_s) / (1.0 *
                                                              len(recv_syms))
            SER_U[tau_idx,
                  phi_idx] = sum(recv_syms != send_syms_u) / (1.0 *
                                                              len(recv_syms))

    np.savez_compressed("data/ser_Au%.2f_%s_%s_v2.npz" %
                        (Au, content, decision),
                        SER_S=SER_S,
                        SER_U=SER_U,
                        **settings)


if __name__ == "__main__":
    argp = argparse.ArgumentParser()
    argp.add_argument(
        "content",
        choices=("same", "unif"),
        help="Relation between data content in the two transmitted packets")
    argp.add_argument("decision",
                      choices=("soft", "hard"),
                      help="Bit decision for DSSS decoding (SDD, HDD)")

    args = argp.parse_args()

    if not tools.overwrite_ok("data/ser_Au%.2f_%s_%s_v2.npz" %
                              (Au, args.content, args.decision)):
        sys.exit(0)

    do_gen(args.content, args.decision)
		for phi_idx in range(nsteps):
			recv_chips = np.zeros(2*RECV_CHIPS_I.shape[0])
			recv_chips[ ::2] = RECV_CHIPS_I[:,phi_idx]
			recv_chips[1::2] = RECV_CHIPS_Q[:,phi_idx]

			# slice bits to simulate hard decision decoder
			if decision in ("hard",):
				recv_chips = np.sign(recv_chips)

			recv_syms = pt.detect_syms_corr(recv_chips)[1:-1]

			SER_S[ninterf_, phi_idx] = np.sum(recv_syms != send_syms_s) / (1.0*len(recv_syms))

		print("PRR = ", np.mean((1.0-SER_S[ninterf_,:])**pktlen))

	np.savez_compressed("data/ser_s_%s_%s_%s.npz"%(content, decision, mode), SER_S=SER_S, **settings)

if __name__ == "__main__":
	argp = argparse.ArgumentParser()
	argp.add_argument("content",  choices=("same", "unif"), help="Relation between data content in the two transmitted packets")
	argp.add_argument("decision", choices=("soft", "hard"), help="Bit decision for DSSS decoding (SDD, HDD)")

	args = argp.parse_args()

	if not tools.overwrite_ok("data/ser_s_%s_%s_n.npy"%(args.content, args.decision)):
		sys.exit()

	gen_n_interf(args.content, args.decision, mode="n")
	gen_n_interf(args.content, args.decision, mode="1")