Skip to content

Commit 06be080

Browse files
committed
interpolate inplace, add verbose option
1 parent ef400d2 commit 06be080

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

gnss_lib_py/parsers/android.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,10 @@ def prepare_kaggle_submission(state_estimate, trip_id="trace/phone"):
564564
output["LongitudeDegrees"] = state_estimate[wildcards["lon_*_deg"]]
565565

566566
output.interpolate("UnixTimeMillis",["LatitudeDegrees",
567-
"LongitudeDegrees"])
567+
"LongitudeDegrees"],inplace=True)
568568
return output
569569

570-
def solve_kaggle_dataset(folder_path, solver, *args):
570+
def solve_kaggle_dataset(folder_path, solver, verbose=False, *args):
571571
"""Run solver on all kaggle traces.
572572
573573
Additional ``*args`` arguments are passed into the ``solver``
@@ -583,6 +583,9 @@ def solve_kaggle_dataset(folder_path, solver, *args):
583583
AndroidDerived2022 and outputs a state_estimate NavData object.
584584
Additional ``*args`` arguments are passed into this ``solver``
585585
function.
586+
verbose : bool
587+
If verbose, will print each trace trajectory name and phone name
588+
pair when it is solving the state estimate for that pair.
586589
587590
Returns
588591
-------
@@ -606,6 +609,9 @@ def solve_kaggle_dataset(folder_path, solver, *args):
606609
# convert data to Measurement class
607610
derived_data = AndroidDerived2022(data_path)
608611

612+
if verbose:
613+
print("solving:",trace_name,phone_type)
614+
609615
# compute state estimate using provided solver function
610616
state_estimate = solver(derived_data, *args)
611617

tests/parsers/test_android.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -712,14 +712,17 @@ def test_solve_kaggle_dataset(root_path):
712712
solve_wls,
713713
solve_gnss_ekf,
714714
]:
715-
solution = android.solve_kaggle_dataset(folder_path, solver)
715+
for verbose in [True, False]:
716+
solution = android.solve_kaggle_dataset(folder_path, solver,
717+
verbose)
716718

717-
solution.in_rows(["tripId","UnixTimeMillis",
718-
"LatitudeDegrees","LongitudeDegrees"])
719+
solution.in_rows(["tripId","UnixTimeMillis",
720+
"LatitudeDegrees","LongitudeDegrees"])
719721

720-
assert solution.shape[1] == 6
722+
assert solution.shape[1] == 6
721723

722-
expected = np.array([1619735725999,1619735726999,1619735727999,
723-
1619735728999,1619735729999,1619735730999])
724-
np.testing.assert_array_equal(solution["UnixTimeMillis"],
725-
expected)
724+
expected = np.array([1619735725999,1619735726999,
725+
1619735727999,1619735728999,
726+
1619735729999,1619735730999])
727+
np.testing.assert_array_equal(solution["UnixTimeMillis"],
728+
expected)

0 commit comments

Comments
 (0)