@@ -52,13 +52,14 @@ def __init__(self, input_path,
5252 Parameters
5353 ----------
5454 input_path : string or path-like
55- Path to measurement csv file.
55+ Path to measurement csv or txt file.
5656 filter_measurements : bool
5757 Filter noisy measurements based on known conditions.
5858 measurement_filters : dict
5959 Conditions under which measurements should be filtered. An
6060 emptry dictionary passed into measurement_filters is
61- equivalent to setting filter_measurements to False.
61+ equivalent to setting filter_measurements to False. See the
62+ docstring for ``filter_raw_measurements`` for details.
6263 remove_rx_b_from_pr : bool
6364 If true, removes the estimated initial receiver clock bias
6465 from the pseudorange values.
@@ -73,9 +74,15 @@ def __init__(self, input_path,
7374 pd_df = self .preprocess (input_path )
7475 super ().__init__ (pandas_df = pd_df )
7576
76-
7777 def preprocess (self , input_path ):
78- """Built on the first parts of make_gnss_dataframe and correct_log
78+ """Extract Raw measurements.
79+
80+ Built on the first parts of make_gnss_dataframe and correct_log
81+
82+ Parameters
83+ ----------
84+ input_path : string or path-like
85+ Path to measurement csv or txt file.
7986
8087 """
8188
@@ -109,12 +116,14 @@ def preprocess(self, input_path):
109116 def postprocess (self ):
110117 """Postprocess loaded NavData.
111118
112- Arrival time taken from [2]_.
119+ Strategy for computing the arrival time was taken from an
120+ EUSPA white paper [2]_ and Google's source code
121+ Arrival time taken from [3]_.
113122
114123 References
115124 ----------
116125 .. [2] https://www.euspa.europa.eu/system/files/reports/gnss_raw_measurement_web_0.pdf
117-
126+ .. [3] https://github.com/google/gps-measurement-tools/blob/master/opensource/ProcessGnssMeas.m
118127 """
119128
120129 # rename gnss_id
@@ -136,9 +145,6 @@ def postprocess(self):
136145 self ["gps_millis" ] = unix_to_gps_millis (self ["unix_millis" ])
137146
138147 # calculate pseudorange
139- # Based off of MATLAB code from Google's gps-measurement-tools
140- # repository: https://github.com/google/gps-measurement-tools. Compare
141- # with opensource/ProcessGnssMeas.m
142148 gps_week_nanos = np .floor (- self ["FullBiasNanos" ]* 1e-9 / consts .WEEKSEC )* consts .WEEKSEC * 1E9
143149 tx_rx_gnss_ns = self ["TimeNanos" ] - self ["FullBiasNanos" ,0 ] + self ["TimeOffsetNanos" ] - self ["BiasNanos" ,0 ]
144150
@@ -220,17 +226,53 @@ def postprocess(self):
220226 def filter_raw_measurements (self ,t_rx_secs ):
221227 """Filter noisy measurements.
222228
223- Filters are taken from: [3]_ [4]_ [5]_ [6]_.
224- The State variable options are shown on [5]_.
229+ Filter conditions are set in the ``AndroidRawGnss()``
230+ initialization with the ``measurement_filters`` variable. The
231+ general framework for measurement filters is taken from Google's
232+ ION GNSS+ 2023 workshop presentation [4]_. Google's
233+ gps-measurement-tools opensource software shows a couple of
234+ their implementations with example values [5]_ [6]_.
235+
236+ The possible keys to include in the ``measurement_filters``
237+ dictionary variable include:
238+
239+ * ``bias_valid`` : If true, measurements where FullBiasNanos is
240+ greater or equal to zero will be removed.
241+ * ``bias_uncertainty`` : Any measurements will be
242+ re where BiasUncertaintyNanos is greater than
243+ the set value.
244+ * ``arrival_time`` : If true, measurements where the arrival time
245+ (``t_rx_secs``) is negative or unrealistically large will be
246+ removed.
247+ * ``unknown_constellations`` : If true, measurements with an
248+ unknown_constellation will be removed.
249+ * ``time_valid`` : If true, measurements with where TimeNanos is
250+ empty will be removed.
251+ * ``state_decoded`` : If true, will filter measurements that don't
252+ have the time-of-week decoded [7]_.
253+ * ``sv_time_uncertainty`` : Any measurements will be
254+ removed where ReceivedSvTimeUncertaintyNanos is greater than
255+ the set value.
256+ * ``adr_valid`` : If true, measurements where
257+ ``AccumulatedDeltaRangeState`` is not valid will be removed.
258+ * ``adr_uncertainty`` : Any measurements will be
259+ removed where ReceivedSvTimeUncertaintyNanos is greater than
260+ the set value.
261+
262+ Only keys present in the ``measurement_filters`` dictionary
263+ will be used for the filter. For example if
264+ ````measurement_filters = {``bias_valid`` : True}, then only
265+ measurements will invalid FullBiasNanos will be filtered and no
266+ other measurements will be filtered.
225267
226268 References
227269 ----------
228- .. [3 ] Michael Fu, Mohammed Khider, Frank van Diggelen, Dave
270+ .. [4 ] Michael Fu, Mohammed Khider, Frank van Diggelen, Dave
229271 Orendorff. "Workshop for Google Smartphone Decimeter
230272 Challenge (SDC) 2023-2024." ION GNSS+ 2023.
231- .. [4 ] https://github.com/google/gps-measurement-tools/blob/master/opensource/ProcessGnssMeas.m
232- .. [5 ] https://github.com/google/gps-measurement-tools/blob/master/opensource/SetDataFilter.m
233- .. [6 ] https://developer.android.com/reference/android/location/GnssMeasurement#STATE_TOW_DECODED
273+ .. [5 ] https://github.com/google/gps-measurement-tools/blob/master/opensource/ProcessGnssMeas.m
274+ .. [6 ] https://github.com/google/gps-measurement-tools/blob/master/opensource/SetDataFilter.m
275+ .. [7 ] https://developer.android.com/reference/android/location/GnssMeasurement#STATE_TOW_DECODED
234276 """
235277
236278 filter_idxs = set ()
0 commit comments