Skip to content

Commit

Permalink
NPI-3655 updates to getVelPoly() variable names based on PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
treefern committed Dec 19, 2024
1 parent 50ae880 commit 96f9c11
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gnssanalysis/gn_io/sp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,17 +477,17 @@ def getVelPoly(sp3Df: _pd.DataFrame, deg: int = 35) -> _pd.DataFrame:
"""
est = sp3Df.unstack(1).EST[["X", "Y", "Z"]]
time_values = est.index.get_level_values("J2000").values
xyz_positions = est.values
times = est.index.get_level_values("J2000").values
positions = est.values

# map from input scale to [-1,1]
offset, scale_factor = mapparm([time_values.min(), time_values.max()], [-1, 1])
offset, scale_factor = mapparm([times.min(), times.max()], [-1, 1])

normalised_time_values = offset + scale_factor * (time_values)
coeff = _np.polyfit(x=normalised_time_values, y=xyz_positions, deg=deg)
normalised_times = offset + scale_factor * (times)
coeff = _np.polyfit(x=normalised_times, y=positions, deg=deg)

time_prev = offset + scale_factor * (time_values - 1)
time_next = offset + scale_factor * (time_values + 1)
time_prev = offset + scale_factor * (times - 1)
time_next = offset + scale_factor * (times + 1)

time_prev_sqrd_combined = _np.broadcast_to((time_prev)[None], (deg + 1, time_prev.shape[0]))
time_next_sqrd_combined = _np.broadcast_to((time_next)[None], (deg + 1, time_prev.shape[0]))
Expand All @@ -498,7 +498,7 @@ def getVelPoly(sp3Df: _pd.DataFrame, deg: int = 35) -> _pd.DataFrame:
res_prev = coeff.T.dot(inputs_prev)
res_next = coeff.T.dot(inputs_next)
vel_i = _pd.DataFrame(
(((xyz_positions - res_prev.T) + (res_next.T - xyz_positions)) / 2),
(((positions - res_prev.T) + (res_next.T - positions)) / 2),
columns=est.columns,
index=est.index,
).stack(future_stack=True)
Expand Down

0 comments on commit 96f9c11

Please sign in to comment.