def test_generateSamples1(): ''' Sample generation test: - GPS L1/L2 - No noise - Low pass filter type - No group delays - Two process spawning ''' outputFile = file('/dev/null', 'wt') logFile = file('/dev/null', 'wt') sv0 = GPSSatellite(1) sv0.setL1CAEnabled(True) sv0.setL2CEnabled(True) sv_list = [sv0] outputConfig = HighRateConfig encoder = GPSL1L2BitEncoder(outputConfig) time0S = 0. nSamples = 9999 noiseSigma = None tcxo = None filterType = 'lowpass' groupDelays = False threadCount = 2 pbar = None # Execute main sample generation function with all supported SV types and # bands. An error shall lead to the test failure. # This time execution is performed in a separate process. generateSamples(outputFile, sv_list, encoder, time0S, nSamples, outputConfig, noiseSigma, tcxo, filterType, groupDelays, logFile, threadCount, pbar)
def test_computeEnabledBands2(): ''' Bands selection test ''' sv0 = GPSSatellite(1) sv0.setL2CEnabled(True) sv1 = GLOSatellite(0) sv1.setL1Enabled(True) bandMap = computeEnabledBands([sv0, sv1], NormalRateConfig) assert bandMap[NormalRateConfig.GPS.L1.NAME] == False assert bandMap[NormalRateConfig.GPS.L2.NAME] == True assert bandMap[NormalRateConfig.GLONASS.L1.NAME] == True assert bandMap[NormalRateConfig.GLONASS.L2.NAME] == False
def test_generateSamples0(): ''' Sample generation test: - GPS L1/L2 - Noise sigma defined - Band pass filter type - No group delays - No process spawning ''' outputFile = file('/dev/null', 'wt') logFile = file('/dev/null', 'wt') sv0 = GPSSatellite(1) sv0.setL1CAEnabled(True) sv0.setL2CEnabled(True) sv_list = [sv0] outputConfig = HighRateConfig encoder = GPSL1L2BitEncoder(outputConfig) time0S = 0. nSamples = HighRateConfig.SAMPLE_BATCH_SIZE + 10000 noiseSigma = 1. tcxo = None filterType = 'bandpass' groupDelays = False threadCount = 0 class Pbar(object): def update(self, value): pass pbar = Pbar() # Execute main sample generation function with all supported SV types and # bands. An error shall lead to the test failure. # This time execution is performed in the test process. generateSamples(outputFile, sv_list, encoder, time0S, nSamples, outputConfig, noiseSigma, tcxo, filterType, groupDelays, logFile, threadCount, pbar)
def __MapTo_GPSSatellite(self, data): prn = data['prn'] doppler = dopplerOF.fromMapForm(data['doppler']) amplitude = amplitudeOF.fromMapForm(data['amplitude']) l1caEnabled = data['l1caEnabled'] l2cEnabled = data['l2cEnabled'] l1caMessage = messageOF.fromMapForm(data['l1caMessage']) l2cMessage = messageOF.fromMapForm(data['l2cMessage']) clCodeType = data['l2clCodeType'] codeDopplerIgnored = data['codeDopplerIgnored'] satellite = GPSSatellite(prn) satellite.setAmplitude(amplitude) satellite.setDoppler(doppler) satellite.setL1CAEnabled(l1caEnabled) satellite.setL2CEnabled(l2cEnabled) satellite.setL1CAMessage(l1caMessage) satellite.setL2CMessage(l2cMessage) satellite.setL2CLCodeType(clCodeType) satellite.setCodeDopplerIgnored(codeDopplerIgnored) return satellite
def test_GPSSV_bands(): ''' GPS SV band configurations ''' sv = GPSSatellite(1) assert not sv.isBandEnabled(NormalRateConfig.GPS.L1, NormalRateConfig) assert not sv.isBandEnabled(NormalRateConfig.GPS.L2, NormalRateConfig) assert not sv.isBandEnabled(NormalRateConfig.GLONASS.L1, NormalRateConfig) assert not sv.isBandEnabled(NormalRateConfig.GLONASS.L2, NormalRateConfig) assert not sv.isL1CAEnabled() assert not sv.isL2CEnabled() sv.setL1CAEnabled(True) assert sv.isBandEnabled(NormalRateConfig.GPS.L1, NormalRateConfig) assert not sv.isBandEnabled(NormalRateConfig.GPS.L2, NormalRateConfig) assert sv.isL1CAEnabled() assert not sv.isL2CEnabled() sv.setL2CEnabled(True) sv.setL1CAEnabled(False) assert not sv.isBandEnabled(NormalRateConfig.GPS.L1, NormalRateConfig) assert sv.isBandEnabled(NormalRateConfig.GPS.L2, NormalRateConfig) assert not sv.isL1CAEnabled() assert sv.isL2CEnabled()
def test_GPSSV_getBatchSignals3(): ''' GPS SV signal generation: L2C ''' sv = GPSSatellite(1) start = 0. stop = start + (100. / float(NormalRateConfig.SAMPLE_RATE_HZ)) userTimeAll_s = numpy.linspace(start, stop, 100, endpoint=False, dtype=numpy.float) samples = numpy.zeros((2, 100)) noiseParams = NoiseParameters(NormalRateConfig.SAMPLE_RATE_HZ, 1.0) sv.setL2CEnabled(True) result = sv.getBatchSignals(userTimeAll_s, samples, NormalRateConfig, noiseParams, NormalRateConfig.GPS.L2, False) assert len(result) == 1 assert result[0]['type'] == 'GPSL2' assert result[0]['doppler'] is None assert (samples[0] == 0).all() assert (samples[1] != 0).any()
def test_GPSSV_getBatchSignals3(): ''' GPS SV signal generation: L2C ''' sv = GPSSatellite(1) start = 0. stop = start + (100. / float(NormalRateConfig.SAMPLE_RATE_HZ)) userTimeAll_s = numpy.linspace( start, stop, 100, endpoint=False, dtype=numpy.float) samples = numpy.zeros((2, 100)) noiseParams = NoiseParameters(NormalRateConfig.SAMPLE_RATE_HZ, 1.0) sv.setL2CEnabled(True) result = sv.getBatchSignals(userTimeAll_s, samples, NormalRateConfig, noiseParams, NormalRateConfig.GPS.L2, False) assert len(result) == 1 assert result[0]['type'] == 'GPSL2' assert result[0]['doppler'] is None assert (samples[0] == 0).all() assert (samples[1] != 0).any()