def doUpdate(self, sv, parser, namespace, values, option_string): if isinstance(sv, GPSSatellite): if sv.l1caEnabled: signal = signals.GPS.L1CA elif sv.l2cEnabled: signal = signals.GPS.L2C else: raise ValueError("Signal band must be specified before doppler") elif isinstance(sv, GLOSatellite): if sv.isL1Enabled(): frequency_hz = signals.GLONASS.L1S[sv.prn].CENTER_FREQUENCY_HZ elif sv.isL2Enabled(): frequency_hz = signals.GLONASS.L2S[sv.prn].CENTER_FREQUENCY_HZ else: raise ValueError("Signal band must be specified before doppler") else: raise ValueError("Signal band must be specified before doppler") frequency_hz = signal.CENTER_FREQUENCY_HZ # Select distance: either from a distance parameter or from delays if namespace.symbol_delay is not None or namespace.chip_delay is not None: distance = computeDistanceDelay(namespace.symbol_delay, namespace.chip_delay, signal) else: distance = namespace.distance if namespace.distance is not None else 0. if namespace.doppler_type == "zero": doppler = zeroDoppler(distance, namespace.tec, frequency_hz) elif namespace.doppler_type == "const": doppler = constDoppler(distance, namespace.tec, frequency_hz, namespace.doppler_value) elif namespace.doppler_type == "linear": doppler = linearDoppler(distance, namespace.tec, frequency_hz, namespace.doppler_value, namespace.doppler_speed) elif namespace.doppler_type == "sine": doppler = sineDoppler(distance, namespace.tec, frequency_hz, namespace.doppler_value, namespace.doppler_amplitude, namespace.doppler_period) else: raise ValueError("Unsupported doppler type") sv.doppler = doppler
def doUpdate(self, sv, parser, namespace, values, option_string): if isinstance(sv, GPSSatellite): if sv.l1caEnabled: signal = signals.GPS.L1CA elif sv.l2cEnabled: signal = signals.GPS.L2C else: raise ValueError( "Signal band must be specified before doppler") elif isinstance(sv, GLOSatellite): if sv.isL1Enabled(): frequency_hz = signals.GLONASS.L1S[ sv.prn].CENTER_FREQUENCY_HZ elif sv.isL2Enabled(): frequency_hz = signals.GLONASS.L2S[ sv.prn].CENTER_FREQUENCY_HZ else: raise ValueError( "Signal band must be specified before doppler") else: raise ValueError( "Signal band must be specified before doppler") frequency_hz = signal.CENTER_FREQUENCY_HZ # Select distance: either from a distance parameter or from delays if namespace.symbol_delay is not None or namespace.chip_delay is not None: distance = computeDistanceDelay(namespace.symbol_delay, namespace.chip_delay, signal) else: distance = namespace.distance if namespace.distance is not None else 0. if namespace.doppler_type == "zero": doppler = zeroDoppler(distance, namespace.tec, frequency_hz) elif namespace.doppler_type == "const": doppler = constDoppler(distance, namespace.tec, frequency_hz, namespace.doppler_value) elif namespace.doppler_type == "linear": doppler = linearDoppler(distance, namespace.tec, frequency_hz, namespace.doppler_value, namespace.doppler_speed) elif namespace.doppler_type == "sine": doppler = sineDoppler(distance, namespace.tec, frequency_hz, namespace.doppler_value, namespace.doppler_amplitude, namespace.doppler_period) else: raise ValueError("Unsupported doppler type") sv.doppler = doppler
def test_DopplerPoly_computeDopplerShiftHz1(): ''' Test phase shift for zero order polynomial doppler ''' doppler = constDoppler(1000., # Distance 45., # TEC GPS.L1CA.CENTER_FREQUENCY_HZ, # F 1.) # constant Hz userTimeAll_s = numpy.asarray([0., 1., 2., 3.]) shift = doppler.computeDopplerShiftHz(userTimeAll_s, GPS.L1CA) assert abs(1. - shift[0]) < EPSILON assert abs(1. - shift[1]) < EPSILON assert abs(1. - shift[2]) < EPSILON assert abs(1. - shift[3]) < EPSILON
def test_Helper_constDoppler(): ''' Helper method test ''' doppler = constDoppler(1000., 77., 1e9, 100.) assert isinstance(doppler, DopplerPoly) assert isinstance(doppler, DopplerBase) assert doppler.distance0_m == 1000. assert doppler.tec_epm2 == 77. assert len(doppler.distancePoly.coeffs) == 2 assert len(doppler.speedPoly.coeffs) == 1 speed_mps = -scipy.constants.c / 1e7 speedCoeffs = numpy.asarray([speed_mps], dtype=numpy.float) distCoeffs = numpy.asarray([speed_mps, 0.], dtype=numpy.float) assert (numpy.abs(doppler.distancePoly.coeffs - distCoeffs) < EPSILON).all() assert (numpy.abs(doppler.speedPoly.coeffs == speedCoeffs) < EPSILON).all()
def test_DopplerConst_batch(): ''' Verifies execution of the batch computation with const doppler. ''' doppler = constDoppler(1000., 50., GPS.L1CA.CENTER_FREQUENCY_HZ, 100.) userTimeAll_s = numpy.linspace(10., 10. + NormalRateConfig.SAMPLE_BATCH_SIZE / NormalRateConfig.SAMPLE_RATE_HZ, NormalRateConfig.SAMPLE_BATCH_SIZE, endpoint=False) amplitude = AmplitudePoly(AmplitudeBase.UNITS_AMPLITUDE, ()) noiseParams = NoiseParameters(GPS.L1CA.CENTER_FREQUENCY_HZ, 0.) message = Message(1) code = PrnCode(1) res = doppler.computeBatch(userTimeAll_s, amplitude, noiseParams, GPS.L1CA, NormalRateConfig.GPS.L1.INTERMEDIATE_FREQUENCY_HZ, message, code, NormalRateConfig, True) signal1, doppler1 = res doppler.setCodeDopplerIgnored(True) res = doppler.computeBatch(userTimeAll_s, amplitude, noiseParams, GPS.L1CA, NormalRateConfig.GPS.L1.INTERMEDIATE_FREQUENCY_HZ, message, code, NormalRateConfig, True) signal2, doppler2 = res assert (doppler1 == doppler2).all() assert (signal1 != signal2).any()