Exemplo n.º 1
0
def test_GLOSv_getBatchSignals3():
  '''
  GLONASS SV signal generation: L2
  '''
  sv = GLOSatellite(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((4, 100))
  noiseParams = NoiseParameters(NormalRateConfig.SAMPLE_RATE_HZ, 1.0)
  sv.setL2Enabled(True)
  result = sv.getBatchSignals(userTimeAll_s,
                              samples,
                              NormalRateConfig,
                              noiseParams,
                              NormalRateConfig.GLONASS.L2,
                              False)
  assert len(result) == 1
  assert result[0]['type'] == 'GLOL2'
  assert result[0]['doppler'] is None
  assert (samples[0] == 0).all()
  assert (samples[1] == 0).all()
  assert (samples[2] == 0).all()
  assert (samples[3] != 0).any()
Exemplo n.º 2
0
def test_GLOSv_getBatchSignals3():
    '''
  GLONASS SV signal generation: L2
  '''
    sv = GLOSatellite(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((4, 100))
    noiseParams = NoiseParameters(NormalRateConfig.SAMPLE_RATE_HZ, 1.0)
    sv.setL2Enabled(True)
    result = sv.getBatchSignals(userTimeAll_s, samples, NormalRateConfig,
                                noiseParams, NormalRateConfig.GLONASS.L2,
                                False)
    assert len(result) == 1
    assert result[0]['type'] == 'GLOL2'
    assert result[0]['doppler'] is None
    assert (samples[0] == 0).all()
    assert (samples[1] == 0).all()
    assert (samples[2] == 0).all()
    assert (samples[3] != 0).any()
Exemplo n.º 3
0
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
Exemplo n.º 4
0
def test_GLOSV_str():
    '''
  GLONASS SV string representation
  '''
    sv = GLOSatellite(3)
    value = str(sv)
    assert value.find('GLONASS') >= 0
    assert value.find('3') >= 0
Exemplo n.º 5
0
def test_GLOSv_getBatchSignals1():
    '''
  GLONASS SV signal generation: not available
  '''
    sv = GLOSatellite(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((4, 100))
    noiseParams = NoiseParameters(NormalRateConfig.SAMPLE_RATE_HZ, 1.0)
    result = sv.getBatchSignals(userTimeAll_s, samples, NormalRateConfig,
                                noiseParams, NormalRateConfig.GPS.L1, False)
    assert len(result) == 0
    assert (samples == 0).all()
Exemplo n.º 6
0
def test_GLOSv_init():
    '''
  GLONASS SV initialization test
  '''
    sv = GLOSatellite(1)
    assert isinstance(sv, SVBase)
    assert sv.prn == 1
    assert sv.svName == "GLONASS1"
    assert isinstance(sv.amplitude, AmplitudeBase)
    assert isinstance(sv.doppler, DopplerBase)
Exemplo n.º 7
0
def test_GLOSv_getBatchSignals0():
  '''
  GLONASS SV signal generation: not enabled
  '''
  sv = GLOSatellite(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((4, 100))
  noiseParams = NoiseParameters(NormalRateConfig.SAMPLE_RATE_HZ, 1.0)
  result = sv.getBatchSignals(userTimeAll_s,
                              samples,
                              NormalRateConfig,
                              noiseParams,
                              NormalRateConfig.GLONASS.L1,
                              False)
  assert len(result) == 0
  assert (samples == 0).all()
Exemplo n.º 8
0
        def __call__(self, parser, namespace, values, option_string=None):
            # Initialize SV list if not yet done
            if namespace.gps_sv is None:
                namespace.gps_sv = []

            # Add SV to the tail of the list.
            if option_string == '--gps-sv':
                sv = GPSSatellite(int(values))
            elif option_string == '--glo-sv':
                sv = GLOSatellite(int(values))
            else:
                raise ValueError("Option value is not supported: %s" %
                                 option_string)
            namespace.gps_sv.append(sv)

            # Reset all configuration parameters
            namespace.l2cl_code_type = '01'
            namespace.ignore_code_doppler = False

            # Doppler
            namespace.doppler_type = "zero"
            namespace.doppler_value = 0.
            namespace.doppler_speed = 0.
            namespace.distance = None
            namespace.tec = 50.
            namespace.doppler_amplitude = 0.
            namespace.doppler_period = 1.
            namespace.symbol_delay = None
            namespace.chip_delay = None

            # Source message data
            namespace.message_type = "zero"
            namespace.message_file = None

            # Amplitude parameters
            namespace.amplitude_type = "poly"
            namespace.amplitude_unis = "snr-db"
            namespace.amplitude_a0 = None
            namespace.amplitude_a1 = None
            namespace.amplitude_a2 = None
            namespace.amplitude_a3 = None
            namespace.amplitude_period = None
Exemplo n.º 9
0
def test_GLOSV_messages():
    '''
  GLONASS SV messages test
  '''
    sv = GLOSatellite(1)
    assert sv.l1Message == sv.getL1Message()
    assert sv.l2Message == sv.getL2Message()
    msg = GLOMessage(1)
    sv.setL1Message(msg)
    assert sv.l1Message == sv.getL1Message() == msg
    assert sv.l2Message == sv.getL2Message() == msg
    msg2 = GLOMessage(3)
    sv.setL2Message(msg)
    assert sv.l1Message == sv.getL1Message() != msg2
    assert sv.l2Message == sv.getL2Message() != msg2
Exemplo n.º 10
0
def test_GLOSV_bands():
    '''
  GLONASS SV band configurations
  '''
    sv = GLOSatellite(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.isL1Enabled()
    assert not sv.isL2Enabled()
    sv.setL1Enabled(True)
    assert sv.isBandEnabled(NormalRateConfig.GLONASS.L1, NormalRateConfig)
    assert not sv.isBandEnabled(NormalRateConfig.GLONASS.L2, NormalRateConfig)
    assert sv.isL1Enabled()
    assert not sv.isL2Enabled()
    sv.setL2Enabled(True)
    sv.setL1Enabled(False)
    assert not sv.isBandEnabled(NormalRateConfig.GLONASS.L1, NormalRateConfig)
    assert sv.isBandEnabled(NormalRateConfig.GLONASS.L2, NormalRateConfig)
    assert not sv.isL1Enabled()
    assert sv.isL2Enabled()
Exemplo n.º 11
0
def test_GLOSV_messages():
  '''
  GLONASS SV messages test
  '''
  sv = GLOSatellite(1)
  assert sv.l1Message == sv.getL1Message()
  assert sv.l2Message == sv.getL2Message()
  msg = GLOMessage(1)
  sv.setL1Message(msg)
  assert sv.l1Message == sv.getL1Message() == msg
  assert sv.l2Message == sv.getL2Message() == msg
  msg2 = GLOMessage(3)
  sv.setL2Message(msg)
  assert sv.l1Message == sv.getL1Message() != msg2
  assert sv.l2Message == sv.getL2Message() != msg2
Exemplo n.º 12
0
def test_GLOSV_bands():
  '''
  GLONASS SV band configurations
  '''
  sv = GLOSatellite(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.isL1Enabled()
  assert not sv.isL2Enabled()
  sv.setL1Enabled(True)
  assert sv.isBandEnabled(NormalRateConfig.GLONASS.L1, NormalRateConfig)
  assert not sv.isBandEnabled(NormalRateConfig.GLONASS.L2, NormalRateConfig)
  assert sv.isL1Enabled()
  assert not sv.isL2Enabled()
  sv.setL2Enabled(True)
  sv.setL1Enabled(False)
  assert not sv.isBandEnabled(NormalRateConfig.GLONASS.L1, NormalRateConfig)
  assert sv.isBandEnabled(NormalRateConfig.GLONASS.L2, NormalRateConfig)
  assert not sv.isL1Enabled()
  assert sv.isL2Enabled()