예제 #1
0
def LoRaFilterBank(dataI, dataQ, fs, Bw, fMix, downSamplingRate):
    n = np.arange(dataI.size)
    cosMix = np.cos((n * 2 * np.pi * fMix / fs) + 0.06287)
    sinMix = np.sin((n * 2 * np.pi * fMix / fs) + 0.06287)
    dataMixI = np.multiply(dataI, cosMix) - np.multiply(dataQ, sinMix)
    dataMixQ = np.multiply(dataQ, cosMix) + np.multiply(dataI, sinMix)
    fftPlot(dataMixI + 1j * dataMixQ, n=1, fs=fs)

    d = signal.firwin(301,
                      cutoff=(1.2 * Bw) / (fs / 2.),
                      window='blackmanharris')
    dataFltI = np.convolve(d, dataMixI)
    dataFltQ = np.convolve(d, dataMixQ)
    dataFltI = dataFltI[::downSamplingRate]
    dataFltQ = dataFltQ[::downSamplingRate]
    fs /= downSamplingRate

    fftPlot(dataFltI + 1j * dataFltQ, n=1, fs=fs)
    #specPlot(dataFltI+1j*dataFltQ, fs=fs)

    return dataFltI, -dataFltQ, fs
예제 #2
0
파일: RkeTestApp.py 프로젝트: abaghbani/DSP
    while True:
        if msvcrt.kbhit():
            c = msvcrt.getch().decode("utf-8")
            print(c)
            c = c.lower()

            if c == 'r':
                [fs, dataI, dataQ] = wav.readWaveFile(filename)
                print('Sampling freq = ', fs)
                print(dataI.shape, dataQ.shape)
                dataI = dataI[int(0.0e6):int(8.5e6)]
                dataQ = dataQ[int(0.0e6):int(8.5e6)]

                data = dataI + 1j * dataQ
                fp.fftPlot(data, n=1, fs=fs)
                fp.specPlot(data, fs=fs)

            elif c == 'b':
                # fileName_local = path + 'SDRSharp_20210704_200704Z_868000000Hz_IQ.wav'
                fileName_local = path + 'RKE/' + 'SDRSharp_20210815_142820Z_868000266Hz_IQ.wav'
                [fs, dataI, dataQ] = wav.readWaveFile(fileName_local)
                print('Sampling freq = ', fs)
                print(dataI.shape, dataQ.shape)

                dataI = dataI[int(0.7e6):int(5.4e6)]
                dataQ = dataQ[int(0.7e6):int(5.4e6)]

                data = dataI + 1j * dataQ
                fp.fftPlot(data, n=1, fs=fs)
                fp.specPlot(data, fs=fs)
예제 #3
0
                print(
                    f'ADC DataI Min/Max (in selected range): {dataI.min()}, {dataI.max()} , {type(dataI[0])}'
                )
                print(
                    f'ADC DataI Min/Max (in selected range): {dataQ.min()}, {dataQ.max()} , {type(dataQ[0])}'
                )
                fs = 30720000 * 2
                data = dataI  #+1j*dataQ

                #filename_local = '../Samples/Wpc/' + 'Wpc_adc2_20211020_130755.bttraw'
                #adcData = rawFile.readRawFile(filename_local, 13)
                #adcData = rawFile.readRawFile(filename1, 13)
                #data = adcData[int(0.0e6):int(26.0e6)].astype('float')
                #print(f'ADC Data Min/Max (in selected range): {data.min()}, {data.max()} , {type(data[0])}')

                fp.fftPlot(data, fs=fs)
                plt.plot(data[1000:10000])
                #plt.plot(data)
                plt.show()

            elif c == 'm':
                n_bit = 4000
                n_loop = 5
                errorlist = []
                for snr_dB in range(5, 10, 1):
                    error = 0
                    run = 0
                    while (run < n_loop):
                        print(f'---------run:{run:2d}-----------')
                        error_run = WpcBER.AskBERtest(n_bit // 2,
                                                      127.0e3,
예제 #4
0
	print('>> ')

	filename = '../Samples/Sound/' + 'test1.wav'
	
	while True:
		if msvcrt.kbhit():
			c = msvcrt.getch().decode("utf-8")
			print(c)
			c = c.lower()
			if c == 's':
				[fs, dataI, dataQ] = readWaveFile(filename)
				specPlot(dataI+1j*dataQ, fs=fs)
			
			elif c == 'a':
				[fs, dataI, dataQ] = readWaveFile(filename)
				fftPlot(dataI+1j*dataQ, fs=fs)
				
			elif c == 'c':
				fs = 1000
				t = np.arange(0,1, 1/fs)
				x = 2*np.cos(2*np.pi*100*t)+0.01*np.cos(2*np.pi*200*t)+0.005*np.cos(2*np.pi*300*t)

				#plt.plot(x)
				#plt.grid()
				#plt.show()

				#mLib.fftPlot(x, fs=1000)
				Thd(x, fs)
				ThdN(x, fs)
			
			elif c == 'w':
예제 #5
0
	while True:
		if msvcrt.kbhit():
			c = msvcrt.getch().decode("utf-8")
			print(c)
			c = c.lower()

			if c == 'r':
				[fs, dataI, dataQ] = wav.readWaveFile(filename)
				print('Sampling freq = ', fs)
				print(dataI.shape, dataQ.shape)
				dataI = dataI[int(0.0e6):int(8.5e6)]
				dataQ = dataQ[int(0.0e6):int(8.5e6)]

				data = dataI+1j*dataQ
				fp.fftPlot(data, n=1, fs=fs)
				fp.specPlot(data, fs=fs)

			elif c == 'k':
				fileName_local = path + 'SDRSharp_20210612_204730Z_433200000Hz_IQ.wav'
				[fs, dataI, dataQ] = wav.readWaveFile(fileName_local)
				print('Sampling freq = ', fs)
				print(dataI.shape, dataQ.shape)

				dataI = dataI[int(3.0e6):int(5.0e6)]
				dataQ = dataQ[int(3.0e6):int(5.0e6)]

				data = dataI+1j*dataQ
				fp.fftPlot(data, n=1, fs=fs)
				fp.specPlot(data, fs=fs)
예제 #6
0
	print('X: Exit')
	print('>> ')

	# mPluto = Pluto(0)
	mPluto = pl(0)

	while True:
		if msvcrt.kbhit():
			c = msvcrt.getch().decode("utf-8")
			print(c)
			c = c.lower()

			if c == 'r':
				[samples, fs] = mPluto.Read(5.0e6, 5.0e6, 868.0e6, 50.0, int(2e6))
				print('sample freq: ', fs, 'sample size: ', samples.size, 'sample min/max: ', samples.min(), samples.max())
				fp.fftPlot(samples.real, n=1, fs=fs)
				np.save('testPluto', samples)

			elif c == 't':
				t = np.arange(10000)/10.0e6
				samples = 0.5*np.exp(2.0j*np.pi*100e3*t)
				samples *= 2**14 # The PlutoSDR expects samples to be between -2^14 and +2^14, not -1 and +1 like some SDRs

				fs = mPluto.Write(10.0e6, 10.0e6, 868.0e6, -30.0, samples, 3)
				fp.fftPlot(samples.real, n=1, fs=fs)

			elif c == 'w':
				t = np.arange(10000)/3.0e6
				samples = 0.99*np.exp(2.0j*np.pi*120e3*t)
				#samples = np.array((np.random.rand(2000) >= 0.5)*0.5)
				#samples = samples.repeat(200)