コード例 #1
0
                                           100.0) + '% done\n'

        sampleRate = float(data['sample rate'])  # (samples/s)
        dt = 1.0 / sampleRate  # (s)
        Idata = IQbin[0::2]
        Qdata = IQbin[1::2]

        mag_V2 = Idata**2 + Qdata**2
        power_W = mag_V2 / 100.0
        power_dBm = 10.0 * np.log10(power_W) + 30.0
        time_ms = np.array([i * dt * 1000.0
                            for i in range(len(power_dBm))])  # (ms)

        #%% Calculate the power in the signal in the time and frequency domains
        #   with and without thresholding.
        noiseFloor_W = determineNoiseFloor(power_W)
        noiseFloor_dBm = 10.0 * np.log10(noiseFloor_W) + 30.0

        # Calculate total power in the signal without thresholding.
        powerIntegrated_W = averagePowerTimeDomain(power_W)
        powerIntegrated_dBm = 10.0 * np.log10(powerIntegrated_W) + 30.0
        print 'Total average power time             = ' + str(
            powerIntegrated_dBm) + ' dBm'
        #        print 'Total average power time             = ' + str(powerIntegrated_W) + ' W'

        # Calculate the total integrated average thresholded power in the signal.
        powerIntegratedThreshold_W = averagePowerThresholdTimeDomain(
            power_W, noiseFloor_W)
        powerIntegratedThreshold_dBm = 10.0 * np.log10(
            powerIntegratedThreshold_W) + 30.0
        print 'Total average power time threshold   = ' + str(
コード例 #2
0
nBitsRel = float(dataRel['nBits'])
sampleRateRel_Hz = float(dataRel['sample rate'])
slideFactorRel = float(dataRel['slideFactor'])
ftxRel_Hz = float(dataRel['PN_chip_rate_Hz'])
bandwidthRel_Hz = 2.0 * ftxRel_Hz / slideFactorRel
RtRel = ftxRel_Hz / (slideFactorRel * (2.0**nBitsRel - 1.0))
# Time between peaks e.g. post correlation PDP rate
TpdpRel = 1.0 / RtRel
dtRel_s = 1.0 / sampleRateRel_Hz  # (s)
nPointsPDPRel = int(TpdpRel * sampleRateRel_Hz)

APDPRel_W = np.zeros(nPointsPDPRel)

#%% Calculate the noise floor of the signal to threshold power in the time domain.
noiseFloorRel_W = determineNoiseFloor(powerRel_W)

# Detect the PDP peaks.
# Only detect peaks that are slightly lesser or greater than the
# expected PDP rate because they may not fall exactly where expected.
peakIndsRel = detect_peaks(powerRel_W,
                           mph=noiseFloorRel_W,
                           mpd=nPointsPDPRel - 10,
                           edge='rising')
nPDPsRel = len(peakIndsRel)

peakOffset = 0
for i in range(nPDPsRel - 1):
    APDPRel_W += powerRel_W[peakIndsRel[i] - peakOffset:peakIndsRel[i] -
                            peakOffset + nPointsPDPRel]
# Complete calculating the averaged PDP.
コード例 #3
0
                Rt = ftx / (k * (2.0**nBits - 1.0))
                # Time between peaks
                Tpdp = 1.0 / Rt
                sampleRate = float(data['sample rate'])
                slideFactor = float(data['slideFactor'])
                dt_s = 1.0 / sampleRate  # (s)
                nPointsPDP = int(Tpdp * sampleRate)
                averagedPDP_W = np.zeros(nPointsPDP)

            #%% Calculate the power from the IQ data.
            Idata = IQbin[0::2]
            Qdata = IQbin[1::2]
            power_W = (Idata**2 + Qdata**2) / 100.0

            #%% Detect the PDP peaks.
            noiseFloor_W = determineNoiseFloor(power_W)
            # Only detect peaks that are slightly less or greater than the
            # expected PDP rate because they don't fall exactly where expected.
            peakInds = detect_peaks(power_W,
                                    mph=noiseFloor_W,
                                    mpd=nPointsPDP - 10,
                                    edge='rising')
            # Exclude the first PDP peak because sometimes an incorrect peak is
            # detected in the noise.
            # Exclude the last PDP peak to ensure only full PDPs are averaged.
            peakInds = peakInds[1:-1]

            #%% Plot the full PDP with peaks identified.
            #            power_dBm = 10.0*np.log10(power_W) + 30.0
            #            time_s = np.arange(len(power_dBm))*dt_s/slideFactor
            #            plt.figure()
コード例 #4
0
#            power_dBm = 10.0*np.log10(power_W) + 30.0
#            print 'power_dBm           = ' + str(power_dBm) + ' dBm'
#            print ''
            
           
    if nValidPDPs > 0:
        averagedPDP_W /= nValidPDPs
        averagedPDP_dBm = 10.0*np.log10(averagedPDP_W) + 30.0
        
        voltComplexAvg_V /= nValidPDPs
        voltRealAvg_W = (np.real(voltComplexAvg_V)**2+np.imag(voltComplexAvg_V)**2)/100.0
        voltRealAvg_dBm = 10.0*np.log10(voltRealAvg_W)+30
            
        # Calculate the noise floor of the signal
#        noiseFloor_W = determineNoiseFloor(voltRealAvg_W)
        noiseFloor_W = determineNoiseFloor(averagedPDP_W)
        noiseFloor_dBm = 10.0*np.log10(noiseFloor_W) + 30.0
                
        # Calculate the power of the signal via FFT with thresholding in the 
        # time domain and filtering in the frequency domain.
        sampleRate = 1.0*float(data['sample rate']) # (samples/s)
        dt = 1.0/sampleRate # (s)
        
        powerAvgTime_W = averagePowerThresholdTimeDomain(averagedPDP_W, noiseFloor_W)
        powerAvgTime_dBm = 10.0*np.log10(powerAvgTime_W) + 30.0
        print 'powerAvgTime_dBm       = ' + str(powerAvgTime_dBm) + ' dBm'
        
        powerAvgFreqThresh_W = averagePowerThresholdFreqDomain(voltComplexAvg_V, dt, noiseFloor_W)
        powerAvgFreqThresh_dBm = 10.0*np.log10(powerAvgFreqThresh_W) + 30.0
        print 'powerAvgFreqThresh_dBm = ' + str(powerAvgFreqThresh_dBm) + ' dBm'
        
コード例 #5
0
        nBits = float(data['nBits'])
        sampleRate_Hz = float(data['sample rate'])
        slideFactor = float(data['slideFactor'])
        ftx_Hz = float(data['PN_chip_rate_Hz'])
        bandwidth_Hz = 2.0 * ftx_Hz / slideFactor
        Rt = ftx_Hz / (slideFactor * (2.0**nBits - 1.0))
        # Time between peaks e.g. post correlation PDP rate
        Tpdp = 1.0 / Rt
        dt_s = 1.0 / sampleRate_Hz  # (s)
        nPointsPDP = int(Tpdp * sampleRate_Hz)

        #%% Calculate the noise floor of the signal to threshold power in the time domain.
        #        noiseFloor_W = determineNoiseFloor(power_W)
        time_mus = [i * dt_s / slideFactor * 1E6 for i in range(len(power_W))]
        noiseFloor_W = determineNoiseFloor(power_W, time_mus)
        noiseFloor_dBm = 10.0 * np.log10(noiseFloor_W) + 30.0

#        #%% Calculate the power in the signal via the various methods.
#        T = (len(power_W)-1)*dt_s
#
#        powerAvgTime_W = averagePowerTimeDomain(power_W, dt_s)
#        powerAvgTime_dBm = 10.0*np.log10(powerAvgTime_W) + 30.0
#        print 'averagePowerTimeDomain                          = ' + str(powerAvgTime_dBm) + ' dBm'
#
#        powerAvgFreq_W = averagePowerFreqDomain(voltComplex_V, dt_s)
#        powerAvgFreq_dBm = 10.0*np.log10(powerAvgFreq_W) + 30.0
#        print 'averagePowerFreqDomain                          = ' + str(powerAvgFreq_dBm) + ' dBm'
#
#        powerAvgFreqComplex_W = averagePowerThresholdFilterFreqDomainComplexAveraging(voltComplex_V, dt_s, bandwidth_Hz, nPointsPDP)
#        powerAvgFreqComplex_dBm = 10.0*np.log10(powerAvgFreqComplex_W) + 30.0