Example #1
0
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_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 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)
Example #4
0
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)
Example #5
0
def main(args=None):
  default_logging_config()

  parser = prepareArgsParser()
  args = parser.parse_args(args)

  if args.no_run:
    return 0

  if args.output is None:
    parser.print_help()
    return 0

  outputConfig = selectOutputConfig(args.profile)
  printOutputConfig(outputConfig, args)

  # Check which signals are enabled on each of satellite to select proper
  # output encoder
  enabledBands = computeEnabledBands(args.gps_sv, outputConfig)

  enabledGPSL1 = enabledBands[outputConfig.GPS.L1.NAME]
  enabledGPSL2 = enabledBands[outputConfig.GPS.L2.NAME]

  # Configure data encoder
  encoder = selectEncoder(args.encoder, outputConfig, enabledBands)

  if enabledGPSL1:
    signal = signals.GPS.L1CA
  elif enabledGPSL2:
    signal = signals.GPS.L2C
  else:
    signal = signals.GPS.L1CA

  # Compute time delay for the needed bit/chip number
  # This delay is computed for the first satellite
  initial_symbol_idx = 0  # Initial symbol index
  initial_chip_idx = 0  # Initial chip index
  if args.chip_delay is not None:
    initial_chip_idx = args.chip_delay
  if args.symbol_delay is not None:
    initial_chip_idx = args.symbol_delay

  time0_s = computeTimeDelay(args.gps_sv[0].doppler,
                             initial_symbol_idx,
                             initial_chip_idx,
                             signal)
  logger.debug("Computed symbol/chip delay={} seconds".format(time0_s))

  startTime_s = time.time()
  n_samples = long(outputConfig.SAMPLE_RATE_HZ * args.generate)

  logger.debug("Generating {} samples for {} seconds".
               format(n_samples, args.generate))

  pbar = makeProgressBar(args.progress_bar, n_samples)

  generateSamples(args.output,
                  args.gps_sv,
                  encoder,
                  time0_s,
                  n_samples,
                  outputConfig,
                  tcxo=args.tcxo,
                  noiseSigma=args.noise_sigma,
                  filterType=args.filter_type,
                  groupDelays=args.group_delays,
                  logFile=args.debug,
                  threadCount=args.jobs,
                  pbar=pbar)
  args.output.close()
  if pbar is not None:
    pbar.finish()

  duration_s = time.time() - startTime_s
  ratio = n_samples / duration_s
  logger.debug("Total time = {} sec. Ratio={} samples per second".
               format(duration_s, ratio))
Example #6
0
def main(args=None):
    default_logging_config()

    parser = prepareArgsParser()
    args = parser.parse_args(args)

    if args.no_run:
        return 0

    if args.output is None:
        parser.print_help()
        return 0

    outputConfig = selectOutputConfig(args.profile)
    printOutputConfig(outputConfig, args)

    # Check which signals are enabled on each of satellite to select proper
    # output encoder
    enabledBands = computeEnabledBands(args.gps_sv, outputConfig)

    enabledGPSL1 = enabledBands[outputConfig.GPS.L1.NAME]
    enabledGPSL2 = enabledBands[outputConfig.GPS.L2.NAME]

    # Configure data encoder
    encoder = selectEncoder(args.encoder, outputConfig, enabledBands)

    if enabledGPSL1:
        signal = signals.GPS.L1CA
    elif enabledGPSL2:
        signal = signals.GPS.L2C
    else:
        signal = signals.GPS.L1CA

    # Compute time delay for the needed bit/chip number
    # This delay is computed for the first satellite
    initial_symbol_idx = 0  # Initial symbol index
    initial_chip_idx = 0  # Initial chip index
    if args.chip_delay is not None:
        initial_chip_idx = args.chip_delay
    if args.symbol_delay is not None:
        initial_chip_idx = args.symbol_delay

    time0_s = computeTimeDelay(args.gps_sv[0].doppler, initial_symbol_idx,
                               initial_chip_idx, signal)
    logger.debug("Computed symbol/chip delay={} seconds".format(time0_s))

    startTime_s = time.time()
    n_samples = long(outputConfig.SAMPLE_RATE_HZ * args.generate)

    logger.debug("Generating {} samples for {} seconds".format(
        n_samples, args.generate))

    pbar = makeProgressBar(args.progress_bar, n_samples)

    generateSamples(args.output,
                    args.gps_sv,
                    encoder,
                    time0_s,
                    n_samples,
                    outputConfig,
                    tcxo=args.tcxo,
                    noiseSigma=args.noise_sigma,
                    filterType=args.filter_type,
                    groupDelays=args.group_delays,
                    logFile=args.debug,
                    threadCount=args.jobs,
                    pbar=pbar)
    args.output.close()
    if pbar is not None:
        pbar.finish()

    duration_s = time.time() - startTime_s
    ratio = n_samples / duration_s
    logger.debug("Total time = {} sec. Ratio={} samples per second".format(
        duration_s, ratio))