Skip to content

Commit 9687210

Browse files
committed
changes to address review of #85
1 parent 083227e commit 9687210

3 files changed

Lines changed: 14 additions & 19 deletions

File tree

gnss_lib_py/algorithms/snapshot.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,18 @@ def solve_wls(measurements, weight_type = None,
9191

9292
states = np.array(states)
9393

94-
if np.isnan(states[:,1:]).all():
95-
warnings.warn("No valid state estimate computed in WLS, "\
96-
+ "returning None.", RuntimeWarning)
97-
return None
98-
9994
state_estimate = NavData()
10095
state_estimate["gps_millis"] = states[:,0]
10196
state_estimate["x_rx_m"] = states[:,1]
10297
state_estimate["y_rx_m"] = states[:,2]
10398
state_estimate["z_rx_m"] = states[:,3]
10499
state_estimate["b_rx_m"] = states[:,4]
105100

101+
if np.isnan(states[:,1:]).all():
102+
warnings.warn("No valid state estimate computed in WLS, "\
103+
+ "returning None.", RuntimeWarning)
104+
return state_estimate
105+
106106
lat,lon,alt = ecef_to_geodetic(state_estimate[["x_rx_m","y_rx_m",
107107
"z_rx_m"]].reshape(3,-1))
108108
state_estimate["lat_rx_deg"] = lat

gnss_lib_py/parsers/android.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,13 @@ def solve_kaggle_baseline(navdata):
516516
"y_rx_m",
517517
"z_rx_m",
518518
]
519+
navdata.in_rows(columns)
519520
data_df = (navdata.pandas_df().drop_duplicates(subset='unix_millis')[columns]
520521
.reset_index(drop=True))
521-
lat,lon,alt = ecef_to_geodetic(data_df[["x_rx_m",
522-
"y_rx_m",
523-
"z_rx_m",
524-
]].to_numpy().T)
522+
lat,lon,alt = np.transpose(ecef_to_geodetic(data_df[["x_rx_m",
523+
"y_rx_m",
524+
"z_rx_m",
525+
]].to_numpy()))
525526

526527
state_estimate = NavData()
527528
state_estimate["gps_millis"] = unix_to_gps_millis(

tests/utils/test_coordinates.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def test_android_ecef_to_el_az(navdata):
369369
Instance of AndroidDerived for testing.
370370
371371
"""
372-
372+
373373
for _, _, navdata_subset in navdata.loop_time("gps_millis"):
374374

375375
pos_sv_m = navdata_subset[["x_sv_m","y_sv_m","z_sv_m"]].T
@@ -418,15 +418,9 @@ def test_add_el_az(navdata):
418418
"""
419419

420420
receiver_state = navdata.copy(rows=["gps_millis",
421-
"WlsPositionXEcefMeters",
422-
"WlsPositionYEcefMeters",
423-
"WlsPositionZEcefMeters"])
424-
row_map = {
425-
"WlsPositionXEcefMeters" : "x_rx_m",
426-
"WlsPositionYEcefMeters" : "y_rx_m",
427-
"WlsPositionZEcefMeters" : "z_rx_m",
428-
}
429-
receiver_state.rename(row_map,inplace=True)
421+
"x_rx_m",
422+
"y_rx_m",
423+
"z_rx_m"])
430424
data_el_az = add_el_az(navdata, receiver_state)
431425
np.testing.assert_array_almost_equal(data_el_az["el_sv_deg"],
432426
navdata["el_sv_deg"])

0 commit comments

Comments
 (0)