22
33"""
44
5- __authors__ = "Shubh Gupta, Adam Dai, Ashwin Kanhere "
5+ __authors__ = "Ashwin Kanhere, Shubh Gupta, Adam Dai"
66__date__ = "02 Nov 2021"
77
88
@@ -22,23 +22,22 @@ class AndroidDerived2021(NavData):
2222
2323 Inherits from NavData().
2424 """
25- def __init__ (self , input_path , remove_bad_measures = True ):
25+ def __init__ (self , input_path , remove_timing_outliers = True ):
2626 """Android specific loading and preprocessing
2727
2828 Parameters
2929 ----------
3030 input_path : string
3131 Path to measurement csv file
32-
33- remove_bad_measures : bool
32+ remove_timing_outliers : bool
3433 Flag for whether to remove measures that are too close or
3534 too far away in time. Code from the competition hosts used
36- to implement changes
35+ to implement changes. See note.
3736
3837 Notes
3938 -----
4039 Removes duplicate rows using correction 5 from competition hosts
41- implemented from https://www.kaggle.com/c/google-smartphone-decimeter-challenge/data
40+ implemented from https://www.kaggle.com/code/gymf123/tips-notes-from-the-competition-hosts/notebook
4241 retrieved on 10 August, 2022
4342
4443 """
@@ -52,7 +51,7 @@ def __init__(self, input_path, remove_bad_measures=True):
5251
5352
5453 # Correction 5 implemented verbatim from competition tips
55- if remove_bad_measures :
54+ if remove_timing_outliers :
5655 delta_millis = pd_df ['millisSinceGpsEpoch' ] - pd_df ['receivedSvTimeInGpsNanos' ] / 1e6
5756 where_good_signals = (delta_millis > 0 ) & (delta_millis < 300 )
5857 pd_df = pd_df [where_good_signals ].copy ()
@@ -68,11 +67,11 @@ def postprocess(self):
6867 implemented from https://www.kaggle.com/c/google-smartphone-decimeter-challenge/data
6968 retrieved on 10 August, 2022
7069 """
71- pr_corrected = self ['raw_pr_m' , : ] \
72- + self ['b_sv_m' , : ] \
73- - self ['intersignal_bias_m' , : ] \
74- - self ['tropo_delay_m' , : ] \
75- - self ['iono_delay_m' , : ]
70+ pr_corrected = self ['raw_pr_m' ] \
71+ + self ['b_sv_m' ] \
72+ - self ['intersignal_bias_m' ] \
73+ - self ['tropo_delay_m' ] \
74+ - self ['iono_delay_m' ]
7675 self ['corr_pr_m' ] = pr_corrected
7776
7877 @staticmethod
@@ -134,11 +133,11 @@ def postprocess(self):
134133 implemented from https://www.kaggle.com/c/google-smartphone-decimeter-challenge/data
135134 retrieved on 10 August, 2022
136135 """
137- pr_corrected = self ['raw_pr_m' , : ] \
138- + self ['b_sv_m' , : ] \
139- - self ['intersignal_bias_m' , : ] \
140- - self ['tropo_delay_m' , : ] \
141- - self ['iono_delay_m' , : ]
136+ pr_corrected = self ['raw_pr_m' ] \
137+ + self ['b_sv_m' ] \
138+ - self ['intersignal_bias_m' ] \
139+ - self ['tropo_delay_m' ] \
140+ - self ['iono_delay_m' ]
142141 self ['corr_pr_m' ] = pr_corrected
143142
144143 @staticmethod
@@ -202,27 +201,29 @@ def postprocess(self):
202201 """
203202 # Correcting reported altitude
204203 self ['alt_gt_m' ] = self ['alt_gt_m' ] - 61.
205- gt_lla = np .transpose (np .vstack ([self ['lat_gt_deg' ], self ['long_gt_deg' ], self ['alt_gt_m' ]]))
204+ gt_lla = np .transpose (np .vstack ([self ['lat_gt_deg' ],
205+ self ['long_gt_deg' ],
206+ self ['alt_gt_m' ]]))
206207 gt_ecef = geodetic_to_ecef (gt_lla )
207208 self ["x_gt_m" ] = gt_ecef [:,0 ]
208209 self ["y_gt_m" ] = gt_ecef [:,1 ]
209210 self ["z_gt_m" ] = gt_ecef [:,2 ]
210211
211212 @staticmethod
212213 def _row_map ():
213- """Map of row names from loaded ground truth to gnss_lib_py standard
214+ """Map of row names from loaded ground truth to gnss_lib_py standard
214215
215- Returns
216- -------
217- row_map : Dict
218- Dictionary of the form {old_name : new_name}
219- """
220- row_map = {'latDeg' : 'lat_gt_deg' ,
221- 'lngDeg' : 'long_gt_deg' ,
222- 'heightAboveWgs84EllipsoidM' : 'alt_gt_m' ,
223- 'millisSinceGpsEpoch' : 'gps_millis'
224- }
225- return row_map
216+ Returns
217+ -------
218+ row_map : Dict
219+ Dictionary of the form {old_name : new_name}
220+ """
221+ row_map = {'latDeg' : 'lat_gt_deg' ,
222+ 'lngDeg' : 'long_gt_deg' ,
223+ 'heightAboveWgs84EllipsoidM' : 'alt_gt_m' ,
224+ 'millisSinceGpsEpoch' : 'gps_millis'
225+ }
226+ return row_map
226227
227228
228229class AndroidGroundTruth2022 (AndroidGroundTruth2021 ):
@@ -240,7 +241,9 @@ def postprocess(self):
240241 if np .any (np .isnan (self ['alt_gt_m' ])):
241242 warnings .warn ("Some altitude values were missing, using 0m " , RuntimeWarning )
242243 self ['alt_gt_m' ] = np .nan_to_num (self ['alt_gt_m' ])
243- gt_lla = np .transpose (np .vstack ([self ['lat_gt_deg' ], self ['long_gt_deg' ], self ['alt_gt_m' ]]))
244+ gt_lla = np .transpose (np .vstack ([self ['lat_gt_deg' ],
245+ self ['long_gt_deg' ],
246+ self ['alt_gt_m' ]]))
244247 gt_ecef = geodetic_to_ecef (gt_lla )
245248 self ["x_gt_m" ] = gt_ecef [:,0 ]
246249 self ["y_gt_m" ] = gt_ecef [:,1 ]
@@ -249,19 +252,19 @@ def postprocess(self):
249252
250253 @staticmethod
251254 def _row_map ():
252- """Map of row names from loaded ground truth to gnss_lib_py standard
253-
254- Returns
255- -------
256- row_map : Dict
257- Dictionary of the form {old_name : new_name}
258- """
259- row_map = {'LatitudeDegrees' : 'lat_gt_deg' ,
260- 'LongitudeDegrees' : 'long_gt_deg' ,
261- 'AltitudeMeters' : 'alt_gt_m' ,
262- 'UnixTimeMillis' : 'unix_millis'
263- }
264- return row_map
255+ """Map row names from loaded data to gnss_lib_py standard
256+
257+ Returns
258+ -------
259+ row_map : Dict
260+ Dictionary of the form {old_name : new_name}
261+ """
262+ row_map = {'LatitudeDegrees' : 'lat_gt_deg' ,
263+ 'LongitudeDegrees' : 'long_gt_deg' ,
264+ 'AltitudeMeters' : 'alt_gt_m' ,
265+ 'UnixTimeMillis' : 'unix_millis'
266+ }
267+ return row_map
265268
266269class AndroidRawImu (NavData ):
267270 """Class handling IMU measurements from raw Android dataset.
@@ -304,11 +307,14 @@ def preprocess(self, input_path):
304307 elif row [0 ] == 'Gyro' :
305308 gyro .append (row [1 :])
306309
307- accel = pd .DataFrame (accel [1 :], columns = accel [0 ], dtype = np .float64 )
308- gyro = pd .DataFrame (gyro [1 :], columns = gyro [0 ], dtype = np .float64 )
310+ accel = pd .DataFrame (accel [1 :], columns = accel [0 ],
311+ dtype = np .float64 )
312+ gyro = pd .DataFrame (gyro [1 :], columns = gyro [0 ],
313+ dtype = np .float64 )
309314
310315 #Drop common columns from gyro and keep values from accel
311- gyro .drop (columns = ['utcTimeMillis' , 'elapsedRealtimeNanos' ], inplace = True )
316+ gyro .drop (columns = ['utcTimeMillis' , 'elapsedRealtimeNanos' ],
317+ inplace = True )
312318 measurements = pd .concat ([accel , gyro ], axis = 1 )
313319 #NOTE: Assuming pandas index corresponds to measurements order
314320 #NOTE: Override times of gyro measurements with corresponding
@@ -413,4 +419,4 @@ def make_csv(input_path, output_directory, field, show_path=False):
413419 if show_path : #pragma: no cover
414420 print (output_path )
415421
416- return output_path
422+ return output_path
0 commit comments