Loading converters/rtklib2avg.py +11 −2 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ import sys import os import re import numpy as np dir_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(dir_path, '..')) Loading @@ -11,8 +12,15 @@ def print_usage(): print(' python rtklib2matlab.py [rover.pos]') sys.exit(1) def split_line(line): if '|' in line: return line.split('|') if '\t' in line: return line.split('\t') return re.sub(' +', ' ', line).split(' ') def parseline(line, names): values = line.split() values = split_line(line) converters = [int] + [float]*4 + [int]*2 + [float]*8 conv_vals = [c(v) for c, v in zip(converters, values) ] return dict(zip(names, conv_vals)) Loading Loading @@ -53,7 +61,7 @@ if __name__ == '__main__': for line in f: if line.startswith('%'): if 'ratio' in line: names = [fix_name(name) for name in line[1:].split()] names = [fix_name(name) for name in split_line(line.strip('% '))] if 'gpst' in names: names.insert(0, 'week') continue Loading Loading @@ -93,6 +101,7 @@ if __name__ == '__main__': name_start_ix = ix break print('') print('Std : %s' % np.std(valid_arr, axis=1)[:3]) print('Mean:') print('\t'.join(names[name_start_ix:name_start_ix+3])) llh = np.mean(valid_arr, axis=1)[:3] Loading converters/rtklib2matlab.py +12 −4 Original line number Diff line number Diff line Loading @@ -2,18 +2,26 @@ import sys import os import re from scipy.io import savemat dir_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(dir_path, '..')) def print_usage(): print('Usage:') print(' python rtklib2matlab.py [rover.pos]') sys.exit(1) def parseline(line, names): def split_line(line): if '|' in line: return line.split('|') if '\t' in line: return line.split('\t') return re.sub(' +', ' ', line).split(' ') values = line.split('|') def parseline(line, names): values = split_line(line) converters = [int] + [float]*4 + [int]*2 + [float]*8 conv_vals = [c(v) for c, v in zip(converters, values) ] return dict(zip(names, conv_vals)) Loading @@ -38,7 +46,7 @@ if __name__ == '__main__': infile = sys.argv[1] outfile = os.path.splitext(infile)[0] + '.mat' print('Converting %s to to %s' % (infile, outfile)) print('Converting %s to %s' % (infile, outfile)) names = ['week', 'tow', 'ecef_x', 'ecef_y', 'ecef_z', 'Q', 'ns', 'sdx', 'sdy', 'sdz', 'sdxy', 'sdyz', 'sdzx', 'age', 'ratio'] Loading @@ -58,7 +66,7 @@ if __name__ == '__main__': for line in f: if line.startswith('%'): if 'age' in line: names = [handle_name(name) for name in line.strip('% ').split('|')] names = [handle_name(name) for name in split_line(line.strip('% '))] if names[0] == 'gpst': names.insert(0, 'week') continue Loading Loading
converters/rtklib2avg.py +11 −2 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ import sys import os import re import numpy as np dir_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(dir_path, '..')) Loading @@ -11,8 +12,15 @@ def print_usage(): print(' python rtklib2matlab.py [rover.pos]') sys.exit(1) def split_line(line): if '|' in line: return line.split('|') if '\t' in line: return line.split('\t') return re.sub(' +', ' ', line).split(' ') def parseline(line, names): values = line.split() values = split_line(line) converters = [int] + [float]*4 + [int]*2 + [float]*8 conv_vals = [c(v) for c, v in zip(converters, values) ] return dict(zip(names, conv_vals)) Loading Loading @@ -53,7 +61,7 @@ if __name__ == '__main__': for line in f: if line.startswith('%'): if 'ratio' in line: names = [fix_name(name) for name in line[1:].split()] names = [fix_name(name) for name in split_line(line.strip('% '))] if 'gpst' in names: names.insert(0, 'week') continue Loading Loading @@ -93,6 +101,7 @@ if __name__ == '__main__': name_start_ix = ix break print('') print('Std : %s' % np.std(valid_arr, axis=1)[:3]) print('Mean:') print('\t'.join(names[name_start_ix:name_start_ix+3])) llh = np.mean(valid_arr, axis=1)[:3] Loading
converters/rtklib2matlab.py +12 −4 Original line number Diff line number Diff line Loading @@ -2,18 +2,26 @@ import sys import os import re from scipy.io import savemat dir_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(dir_path, '..')) def print_usage(): print('Usage:') print(' python rtklib2matlab.py [rover.pos]') sys.exit(1) def parseline(line, names): def split_line(line): if '|' in line: return line.split('|') if '\t' in line: return line.split('\t') return re.sub(' +', ' ', line).split(' ') values = line.split('|') def parseline(line, names): values = split_line(line) converters = [int] + [float]*4 + [int]*2 + [float]*8 conv_vals = [c(v) for c, v in zip(converters, values) ] return dict(zip(names, conv_vals)) Loading @@ -38,7 +46,7 @@ if __name__ == '__main__': infile = sys.argv[1] outfile = os.path.splitext(infile)[0] + '.mat' print('Converting %s to to %s' % (infile, outfile)) print('Converting %s to %s' % (infile, outfile)) names = ['week', 'tow', 'ecef_x', 'ecef_y', 'ecef_z', 'Q', 'ns', 'sdx', 'sdy', 'sdz', 'sdxy', 'sdyz', 'sdzx', 'age', 'ratio'] Loading @@ -58,7 +66,7 @@ if __name__ == '__main__': for line in f: if line.startswith('%'): if 'age' in line: names = [handle_name(name) for name in line.strip('% ').split('|')] names = [handle_name(name) for name in split_line(line.strip('% '))] if names[0] == 'gpst': names.insert(0, 'week') continue Loading