Skip to content

Commit

Permalink
Merge pull request swift-nav#19 from pmiettinen/i161-l1ca-l2c-trackin…
Browse files Browse the repository at this point in the history
…g-test

Develop L1CA and L2C tracking test further
  • Loading branch information
adel-mamin committed Apr 26, 2016
2 parents 315615b + c9aada6 commit 661196c
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 52 deletions.
4 changes: 1 addition & 3 deletions peregrine/analysis/tracking_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

import argparse
import sys

from peregrine.samples import load_samples
from peregrine.acquisition import AcquisitionResult
from peregrine import defaults
Expand Down Expand Up @@ -75,8 +75,6 @@ def main():
freq_profile = defaults.freq_profile_normal_rate
elif args.profile == 'high_rate':
freq_profile = defaults.freq_profile_high_rate
else:
raise NotImplementedError()

isL1CA = (args.signal == L1CA)
isL2C = (args.signal == L2C)
Expand Down
1 change: 1 addition & 0 deletions peregrine/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def __call__(self, parser, namespace, file_hnd, option_string=None):
file_hnd.close()



def populate_peregrine_cmd_line_arguments(parser):
if sys.stdout.isatty():
progress_bar_default = 'stdout'
Expand Down
13 changes: 4 additions & 9 deletions peregrine/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,12 @@ def start(self):

logger.info("[PRN: %d (%s)] Tracking is started. "
"IF: %.1f, Doppler: %.1f, code phase: %.1f, "
"sample channel: %d sample index: %d" %
"sample index: %d" %
(self.prn + 1,
self.signal,
self.IF,
self.acq.doppler,
self.acq.code_phase,
self.acq.sample_channel,
self.acq.sample_index))

def get_index(self):
Expand Down Expand Up @@ -358,6 +357,7 @@ def run(self, samples):
"""

self.start()
self.samples = samples

if self.sample_index < samples['sample_index']:
Expand Down Expand Up @@ -518,14 +518,13 @@ def run(self, samples):
self.track_result.ms_tracked[self.i] = self.samples_tracked * 1e3 / \
self.sampling_freq

self.track_result.status = 'T'

self.i += 1
if self.i >= self.results_num:
self.dump()

self.sample_index += samples_processed
self.track_result.status = 'T'
if self.i > 0:
self.dump()

return self._get_result()

Expand Down Expand Up @@ -1084,10 +1083,6 @@ def __init__(self, n_points, prn, signal):
self.signal = signal
self.ms_tracked = np.zeros(n_points)

def __str__(self):
return "PRN %2d (%s) %s" % \
(self.prn + 1, self.signal, self.status)

def dump(self, output_file, size):
"""
Store tracking result to file system.
Expand Down
41 changes: 39 additions & 2 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,34 @@
from mock import patch


def fileformat_to_bands(file_format):
if file_format == '1bit':
bands = ['l1ca']
elif file_format == '1bit_x2':
bands = ['l1ca', 'l2c']
elif file_format == '2bits':
bands = ['l1ca']
elif file_format == '2bits_x2':
bands = ['l1ca', 'l2c']
elif file_format == '2bits_x4':
bands = ['l1ca', 'l2c']
return bands


def get_skip_params(skip_samples, skip_ms):
if skip_samples is not None:
skip_param = '--skip-samples'
skip_val = skip_samples
elif skip_ms is not None:
skip_param = '--skip-ms'
skip_val = skip_ms
else:
skip_param = '--skip-ms'
skip_val = 0
return (skip_param, skip_val)



def generate_2bits_x4_sample_file(filename):
sample_block_size = 4 # [bits]
s_file = np.memmap(filename, offset=0, dtype=np.uint8, mode='r')
Expand Down Expand Up @@ -120,21 +148,30 @@ def generate_sample_file(gps_sv_prn, init_doppler,
def run_peregrine(file_name, file_format, freq_profile,
skip_param, skip_val,
skip_tracking=True,
skip_navigation=True):
skip_navigation=True,
pipelining=None,
short_long_cycles=None):

parameters = [
'peregrine',
'--file', file_name,
'--file-format', file_format,
'--profile', freq_profile,
skip_param, str(skip_val)
skip_param, str(skip_val),
'--progress-bar', 'stdout'
]
if skip_tracking:
parameters += ['-t']

if skip_navigation:
parameters += ['-n']

if pipelining:
parameters += ['--pipelining', str(pipelining)]

if short_long_cycles:
parameters += ['--short-long-cycles', str(short_long_cycles)]

# Replace argv with args to skip tracking and navigation.
with patch.object(sys, 'argv', parameters):
print "sys.argv = ", sys.argv
Expand Down
Loading

0 comments on commit 661196c

Please sign in to comment.