Skip to content

Commit 1f8f2fb

Browse files
committed
Merge branch 'main' into ramya/timeconversions
2 parents 7c99511 + f28d1b5 commit 1f8f2fb

11 files changed

Lines changed: 452 additions & 759 deletions

File tree

docs/source/img/skyplot.png

-1.67 KB
Loading

docs/source/requirements.txt

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,88 +2,89 @@ alabaster==0.7.12; python_version >= "3.6"
22
appnope==0.1.3; platform_system == "Darwin" and python_version >= "3.8" and sys_platform == "darwin"
33
argon2-cffi-bindings==21.2.0; python_version >= "3.7"
44
argon2-cffi==21.3.0; python_version >= "3.7"
5-
astroid==2.11.5; python_full_version >= "3.6.2"
6-
asttokens==2.0.5; python_version >= "3.8"
7-
atomicwrites==1.4.0; python_version >= "3.6" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.4.0"
8-
attrs==21.4.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
9-
babel==2.10.1; python_version >= "3.6"
5+
astroid==2.11.7; python_full_version >= "3.7.2"
6+
asttokens==2.0.7; python_version >= "3.8"
7+
atomicwrites==1.4.1; python_version >= "3.6" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.4.0"
8+
attrs==22.1.0; python_version >= "3.7"
9+
babel==2.10.3; python_version >= "3.6"
1010
backcall==0.2.0; python_version >= "3.8"
1111
beautifulsoup4==4.11.1; python_full_version >= "3.6.0" and python_version >= "3.7"
12-
bleach==5.0.0; python_version >= "3.7"
13-
certifi==2022.5.18.1; python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.8"
14-
cffi==1.15.0; implementation_name == "pypy" and python_version >= "3.7"
15-
charset-normalizer==2.0.12; python_full_version >= "3.6.0" and python_version >= "3.6"
16-
colorama==0.4.4; sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.6.2" and (python_version >= "3.6" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.5.0") and (python_version >= "3.8" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.8" and python_full_version >= "3.5.0")
17-
coverage==6.4.2; python_version >= "3.7"
12+
bleach==5.0.1; python_version >= "3.7"
13+
certifi==2022.6.15; python_version >= "3.8" and python_version < "4"
14+
cffi==1.15.1; implementation_name == "pypy" and python_version >= "3.7"
15+
charset-normalizer==2.1.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
16+
colorama==0.4.5; sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.7.2" and (python_version >= "3.6" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.5.0") and (python_version >= "3.8" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.8" and python_full_version >= "3.5.0")
17+
coverage==6.4.3; python_version >= "3.7"
1818
cycler==0.11.0; python_version >= "3.7"
19-
datetime==4.4
20-
debugpy==1.6.0; python_version >= "3.7"
19+
datetime==4.5
20+
debugpy==1.6.2; python_version >= "3.7"
2121
decorator==5.1.1; python_version >= "3.8"
2222
defusedxml==0.7.1; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
23-
dill==0.3.5.1; python_full_version >= "3.7.0"
23+
dill==0.3.5.1; python_full_version >= "3.7.2"
2424
docutils==0.16; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
2525
entrypoints==0.4; python_version >= "3.7"
26-
executing==0.8.3; python_version >= "3.8"
27-
fastjsonschema==2.15.3; python_version >= "3.7"
28-
fonttools==4.33.3; python_version >= "3.7"
26+
executing==0.9.1; python_version >= "3.8"
27+
fastjsonschema==2.16.1; python_version >= "3.7"
28+
fonttools==4.34.4; python_version >= "3.7"
2929
georinex==1.16.1; python_version >= "3.7"
3030
hatanaka==2.8.0; python_version >= "3.7"
31-
idna==3.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
32-
imagesize==1.3.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
33-
importlib-metadata==4.11.4; python_version < "3.10" and python_version >= "3.7"
34-
importlib-resources==5.7.1; python_version < "3.9" and python_version >= "3.7"
31+
idna==3.3; python_version >= "3.7" and python_version < "4"
32+
imagesize==1.4.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
33+
importlib-metadata==4.12.0; python_version < "3.10" and python_version >= "3.7"
34+
importlib-resources==5.9.0; python_version < "3.9" and python_version >= "3.7"
3535
iniconfig==1.1.1; python_version >= "3.6"
36-
ipykernel==6.13.0; python_version >= "3.7"
36+
ipykernel==6.15.1; python_version >= "3.7"
3737
ipython-genutils==0.2.0; python_version >= "3.7"
38-
ipython==8.3.0; python_version >= "3.8"
39-
ipywidgets==7.7.0
40-
isort==5.10.1; python_full_version >= "3.6.2" and python_version < "4.0"
38+
ipython==8.4.0; python_version >= "3.8"
39+
ipywidgets==7.7.1
40+
isort==5.10.1; python_full_version >= "3.7.2" and python_version < "4.0"
4141
jedi==0.18.1; python_version >= "3.8"
4242
jinja2==3.1.2; python_version >= "3.7"
43-
jsonschema==4.5.1; python_version >= "3.7"
44-
jupyter-client==7.3.1; python_full_version >= "3.7.0" and python_version >= "3.7"
45-
jupyter-console==6.4.3; python_version >= "3.6"
46-
jupyter-core==4.10.0; python_version >= "3.7"
43+
jsonschema==4.9.1; python_version >= "3.7"
44+
jupyter-client==7.3.4; python_full_version >= "3.7.0" and python_version >= "3.7"
45+
jupyter-console==6.4.4; python_version >= "3.7"
46+
jupyter-core==4.11.1; python_version >= "3.7"
4747
jupyter==1.0.0
4848
jupyterlab-pygments==0.2.2; python_version >= "3.7"
49-
jupyterlab-widgets==1.1.0; python_version >= "3.6"
50-
kiwisolver==1.4.2; python_version >= "3.7"
51-
lazy-object-proxy==1.7.1; python_version >= "3.6" and python_full_version >= "3.6.2"
49+
jupyterlab-widgets==1.1.1; python_version >= "3.6"
50+
kiwisolver==1.4.4; python_version >= "3.7"
51+
lazy-object-proxy==1.7.1; python_version >= "3.6" and python_full_version >= "3.7.2"
5252
markupsafe==2.1.1; python_version >= "3.7"
5353
matplotlib-inline==0.1.3; python_version >= "3.8"
5454
matplotlib==3.5.2; python_version >= "3.7"
55-
mccabe==0.7.0; python_version >= "3.6" and python_full_version >= "3.6.2"
55+
mccabe==0.7.0; python_version >= "3.6" and python_full_version >= "3.7.2"
5656
mistune==0.8.4; python_version >= "3.7"
57-
nbclient==0.6.3; python_full_version >= "3.7.0" and python_version >= "3.7"
57+
nbclient==0.6.6; python_full_version >= "3.7.0" and python_version >= "3.7"
5858
nbconvert==6.5.0; python_version >= "3.7"
5959
nbformat==5.4.0; python_full_version >= "3.7.0" and python_version >= "3.7"
6060
nbsphinx-link==1.3.0
6161
nbsphinx==0.8.9; python_version >= "3.6"
6262
ncompress==1.0.0; python_version >= "3.7"
6363
nest-asyncio==1.5.5; python_full_version >= "3.7.0" and python_version >= "3.7"
64-
notebook==6.4.11; python_version >= "3.7"
65-
numpy==1.22.4; python_version >= "3.8"
64+
notebook==6.4.12; python_version >= "3.7"
65+
numpy==1.23.1; python_version >= "3.8"
6666
packaging==21.3; python_version >= "3.8"
67-
pandas==1.4.2; python_version >= "3.8"
67+
pandas==1.4.3; python_version >= "3.8"
6868
pandocfilters==1.5.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
6969
parso==0.8.3; python_version >= "3.8"
7070
pexpect==4.8.0; sys_platform != "win32" and python_version >= "3.8"
7171
pickleshare==0.7.5; python_version >= "3.8"
72-
pillow==9.1.1; python_version >= "3.7"
73-
platformdirs==2.5.2; python_version >= "3.7" and python_full_version >= "3.6.2"
74-
plotly==5.8.0; python_version >= "3.6"
72+
pillow==9.2.0; python_version >= "3.7"
73+
pkgutil-resolve-name==1.3.10; python_version < "3.9" and python_version >= "3.7"
74+
platformdirs==2.5.2; python_version >= "3.7" and python_full_version >= "3.7.2"
75+
plotly==5.9.0; python_version >= "3.6"
7576
pluggy==1.0.0; python_version >= "3.6"
7677
pockets==0.9.1
7778
prometheus-client==0.14.1; python_version >= "3.7"
78-
prompt-toolkit==3.0.29; python_full_version >= "3.6.2" and python_version >= "3.8"
79+
prompt-toolkit==3.0.30; python_full_version >= "3.6.2" and python_version >= "3.8"
7980
psutil==5.9.1; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
8081
ptyprocess==0.7.0; os_name != "nt" and python_version >= "3.8" and sys_platform != "win32"
8182
pure-eval==0.2.2; python_version >= "3.8"
8283
py==1.11.0; python_version >= "3.7" and python_full_version < "3.0.0" and implementation_name == "pypy" or python_full_version >= "3.5.0" and python_version >= "3.7" and implementation_name == "pypy"
8384
pycparser==2.21; python_version >= "3.7" and python_full_version < "3.0.0" and implementation_name == "pypy" or implementation_name == "pypy" and python_version >= "3.7" and python_full_version >= "3.4.0"
8485
pygments==2.12.0; python_version >= "3.8"
8586
pylint-exit==1.2.0
86-
pylint==2.13.9; python_full_version >= "3.6.2"
87+
pylint==2.14.5; python_full_version >= "3.7.2"
8788
pynmea2==1.18.0
8889
pyparsing==3.0.9; python_full_version >= "3.6.8" and python_version >= "3.8"
8990
pyproj==3.3.1; python_version >= "3.8"
@@ -94,15 +95,15 @@ pytest==6.2.5; python_version >= "3.6"
9495
python-dateutil==2.8.2; python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.8"
9596
pytz==2022.1; python_version >= "3.8"
9697
pywin32==304; sys_platform == "win32" and platform_python_implementation != "PyPy" and python_version >= "3.7"
97-
pywinpty==2.0.5; os_name == "nt" and python_version >= "3.7"
98-
pyzmq==23.0.0; python_version >= "3.7"
99-
qtconsole==5.3.0; python_version >= "3.7"
98+
pywinpty==2.0.7; os_name == "nt" and python_version >= "3.7"
99+
pyzmq==23.2.0; python_version >= "3.7"
100+
qtconsole==5.3.1; python_version >= "3.7"
100101
qtpy==2.1.0; python_version >= "3.7"
101102
reindent==3.5.1
102-
requests==2.27.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
103-
scipy==1.8.1; python_version >= "3.8" and python_version < "3.11"
103+
requests==2.28.1; python_version >= "3.7" and python_version < "4"
104+
scipy==1.9.0; python_version >= "3.8" and python_version < "3.12"
104105
send2trash==1.8.0; python_version >= "3.7"
105-
setuptools-scm==6.4.2; python_version >= "3.7"
106+
setuptools-scm==7.0.5; python_version >= "3.7"
106107
six==1.16.0; python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.8"
107108
snowballstemmer==2.2.0; python_version >= "3.6"
108109
soupsieve==2.3.2.post1; python_full_version >= "3.6.0" and python_version >= "3.7"
@@ -115,21 +116,22 @@ sphinxcontrib-jsmath==1.0.1; python_version >= "3.6"
115116
sphinxcontrib-napoleon==0.7
116117
sphinxcontrib-qthelp==1.0.3; python_version >= "3.6"
117118
sphinxcontrib-serializinghtml==1.1.5; python_version >= "3.6"
118-
stack-data==0.2.0; python_version >= "3.8"
119+
stack-data==0.3.0; python_version >= "3.8"
119120
tenacity==8.0.1; python_version >= "3.6"
120121
terminado==0.15.0; python_version >= "3.7"
121122
tinycss2==1.1.1; python_version >= "3.7"
122123
toml==0.10.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6"
123-
tomli==2.0.1; python_version < "3.11" and python_full_version >= "3.6.2" and python_version >= "3.7" and python_full_version <= "3.11.0a6"
124-
tornado==6.1; python_version >= "3.7"
125-
traitlets==5.2.1.post0; python_full_version >= "3.7.0" and python_version >= "3.8"
126-
typing-extensions==4.2.0; python_version < "3.10" and python_full_version >= "3.6.2" and python_version >= "3.7"
124+
tomli==2.0.1; python_version < "3.11" and python_full_version >= "3.7.2" and python_version >= "3.7" and python_full_version <= "3.11.0a6"
125+
tomlkit==0.11.2; python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.7.2"
126+
tornado==6.2; python_version >= "3.7"
127+
traitlets==5.3.0; python_full_version >= "3.7.0" and python_version >= "3.8"
128+
typing-extensions==4.3.0; python_version < "3.10" and python_full_version >= "3.7.2" and python_version >= "3.7"
127129
unlzw3==0.2.1; python_version >= "3.7"
128-
urllib3==1.26.9; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.6"
130+
urllib3==1.26.11; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.7"
129131
wcwidth==0.2.5; python_full_version >= "3.6.2" and python_version >= "3.8"
130132
webencodings==0.5.1; python_version >= "3.7"
131-
widgetsnbextension==3.6.0
132-
wrapt==1.14.1; python_full_version >= "3.6.2"
133-
xarray==2022.3.0; python_version >= "3.8"
134-
zipp==3.8.0; python_version < "3.10" and python_version >= "3.7"
133+
widgetsnbextension==3.6.1
134+
wrapt==1.14.1; python_full_version >= "3.7.2"
135+
xarray==2022.6.0; python_version >= "3.8"
136+
zipp==3.8.1; python_version < "3.10" and python_version >= "3.7"
135137
zope.interface==5.4.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"

gnss_lib_py/parsers/android.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@ def __init__(self, input_path):
3333
Loaded measurements with consistent column names
3434
"""
3535

36-
pd_df = pd.read_csv(input_path)
37-
col_map = self._column_map()
38-
pd_df.rename(columns=col_map, inplace=True)
39-
40-
super().__init__(pandas_df=pd_df)
41-
self.postprocess()
36+
super().__init__(csv_path=input_path)
4237

4338
def postprocess(self):
4439
"""Android derived specific postprocessing
@@ -57,15 +52,15 @@ def postprocess(self):
5752
self['corr_pr_m'] = pr_corrected
5853

5954
@staticmethod
60-
def _column_map():
55+
def _row_map():
6156
"""Map of column names from loaded to gnss_lib_py standard
6257
6358
Returns
6459
-------
65-
col_map : Dict
60+
row_map : Dict
6661
Dictionary of the form {old_name : new_name}
6762
"""
68-
col_map = {'collectionName' : 'trace_name',
63+
row_map = {'collectionName' : 'trace_name',
6964
'phoneName' : 'rx_name',
7065
'constellationType' : 'gnss_id',
7166
'svid' : 'sv_id',
@@ -84,7 +79,7 @@ def _column_map():
8479
'ionoDelayM' : 'iono_delay_m',
8580
'tropoDelayM' : 'tropo_delay_m',
8681
}
87-
return col_map
82+
return row_map
8883

8984

9085
class AndroidRawImu(NavData):
@@ -137,19 +132,18 @@ def preprocess(self, input_path):
137132
#NOTE: Assuming pandas index corresponds to measurements order
138133
#NOTE: Override times of gyro measurements with corresponding
139134
# accel times
140-
measurements.rename(columns=self._column_map(), inplace=True)
141135
return measurements
142136

143137
@staticmethod
144-
def _column_map():
145-
col_map = {'AccelXMps2' : 'acc_x_mps2',
138+
def _row_map():
139+
row_map = {'AccelXMps2' : 'acc_x_mps2',
146140
'AccelYMps2' : 'acc_y_mps2',
147141
'AccelZMps2' : 'acc_z_mps2',
148142
'GyroXRadPerSec' : 'ang_vel_x_radps',
149143
'GyroYRadPerSec' : 'ang_vel_y_radps',
150144
'GyroZRadPerSec' : 'ang_vel_z_radps',
151145
}
152-
return col_map
146+
return row_map
153147

154148

155149
class AndroidRawFixes(NavData):

gnss_lib_py/parsers/navdata.py

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def __init__(self, csv_path=None, pandas_df=None, numpy_array=None,
5151
else:
5252
self.build_navdata()
5353

54+
self.rename(self._row_map())
55+
5456
self.postprocess()
5557

5658
def postprocess(self):
@@ -125,6 +127,23 @@ def from_numpy_array(self, numpy_array):
125127
for row_num in range(numpy_array.shape[0]):
126128
self.__setitem__(str(row_num), numpy_array[row_num,:])
127129

130+
@staticmethod
131+
def _row_map():
132+
"""Map of column names from loaded to gnss_lib_py standard
133+
134+
Initializes as an emptry dictionary, must be reimplemented for
135+
custom parsers.
136+
137+
Returns
138+
-------
139+
row_map : Dict
140+
Dictionary of the form {old_name : new_name}
141+
"""
142+
143+
row_map = {}
144+
145+
return row_map
146+
128147
def pandas_df(self):
129148
"""Return pandas DataFrame equivalent to class
130149
@@ -236,14 +255,14 @@ def _get_str_rows(self, rows):
236255
row_str : list
237256
List of boolean values indicating which rows contain strings
238257
"""
239-
str_bool = self.str_bool
258+
_row_idx_str_bool = self._row_idx_str_bool
240259
if isinstance(rows, slice):
241260
slice_idx = rows.indices(self.shape[0])
242261
row_list = np.arange(slice_idx[0], slice_idx[1], slice_idx[2])
243-
row_str = [str_bool[row] for row in row_list]
262+
row_str = [_row_idx_str_bool[row] for row in row_list]
244263
else:
245264
row_list = list(rows)
246-
row_str = [str_bool[row] for row in rows]
265+
row_str = [_row_idx_str_bool[row] for row in rows]
247266
return row_list, row_str
248267

249268
def __getitem__(self, key_idx):
@@ -296,6 +315,7 @@ def __setitem__(self, key_idx, newvalue):
296315
#Creating an entire new row
297316
if isinstance(newvalue, np.ndarray) and newvalue.dtype==object:
298317
# Adding string values
318+
# print("\n",key_idx,"\n",newvalue)
299319
self.fillna(newvalue)
300320
new_str_vals = len(np.unique(newvalue))*np.ones(np.shape(newvalue),
301321
dtype=self.arr_dtype)
@@ -308,6 +328,7 @@ def __setitem__(self, key_idx, newvalue):
308328
self.array = np.vstack((self.array, np.reshape(new_str_vals, [1, -1])))
309329
self.map[key_idx] = self.shape[0]-1
310330
else:
331+
# print("\n",key_idx,"\n")#,newvalue)
311332
if not isinstance(newvalue, int) and not isinstance(newvalue, float):
312333
assert not isinstance(np.asarray(newvalue)[0], str), \
313334
"Cannot set a row with list of strings, please use np.ndarray with dtype=object"
@@ -612,19 +633,42 @@ def rows(self):
612633

613634

614635
@property
615-
def str_bool(self):
636+
def _row_idx_str_bool(self):
616637
"""Dictionary of index : if data entry is string.
617638
618639
Row has string values if the string map is nonempty for a
619640
given row.
620641
621642
Returns
622643
-------
623-
str_bool : Dict
644+
_row_idx_str_bool : Dict
624645
Dictionary of whether data at row number key is string or not
625646
"""
626-
str_bool = {self.map[k]: bool(len(self.str_map[k])) for k in self.str_map.keys()}
627-
return str_bool
647+
_row_idx_str_bool = {self.map[k]: bool(len(self.str_map[k])) for k in self.str_map.keys()}
648+
return _row_idx_str_bool
649+
650+
def is_str(self, row_name):
651+
"""Check whether a row contained string values.
652+
653+
Parameters
654+
----------
655+
row_name : string
656+
Name of the row to check whether it contains string values.
657+
658+
Returns
659+
-------
660+
contains_str : bool
661+
True if the row contains string values, False otherwise.
662+
663+
"""
664+
665+
if row_name not in self.map:
666+
raise KeyError("'" + str(row_name) \
667+
+ "' key doesn't exist in NavData class")
668+
669+
contains_str = self._row_idx_str_bool[self.map[row_name]]
670+
671+
return contains_str
628672

629673
@property
630674
def inv_map(self):
@@ -665,7 +709,7 @@ def rename(self, mapper):
665709
for key, value in mapper.items():
666710
if not isinstance(value, str):
667711
raise TypeError("Column names must be strings")
668-
if key not in self.map.keys():
712+
if key not in self.map:
669713
raise KeyError("'" + str(key) \
670714
+ "' key doesn't exist in NavData class")
671715

0 commit comments

Comments
 (0)