Skip to content

Commit

Permalink
Enhance plot_baseline_displacement() function to plot average LSQ value
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyPechnikov committed Apr 11, 2024
1 parent bd5527c commit 46f5c3a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pygmtsar/pygmtsar/Stack_sbas.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,13 +866,15 @@ def plot_baseline_displacement(self, phase, corr=None, caption=None, cmap='turbo
#rmse = np.sqrt(np.sum(errors**2) / errors.size)
rmse = np.sqrt(np.sum(weights * (errors**2)) / np.sum(weights) / errors.size)
#print ('weighted PI-scaled rmse', np.round(rmse / np.pi, 2))
plt.plot(dates, solution, color='black', linestyle='--', linewidth=2, label='LSQ')
lsq_mean = np.nanmean(solution)
plt.plot(dates, solution, color='black', linestyle='--', linewidth=2, label=f'LSQ mean={lsq_mean:0.2f} [{unit}]')
plt.axhline(y=lsq_mean, color='black', linestyle=':')
plt.plot(dates, values, color='blue', linestyle='-', linewidth=2,
label=f'LSQ β1 {velocity:0.1f} and β0={intercept:0.1f} [{unit}/year], P-value={p_value:0.2f}')
label=f'LSQ β1={velocity:0.1f} and β0={intercept:0.1f} [{unit}/year], P-value={p_value:0.2f}')

if stl:
plt.plot(dt_periodic.date, trend, color='blue', linestyle='--', linewidth=2,
label=f'STL β1 {stl_velocity:0.1f} and β0={stl_intercept:0.1f} [{unit}/year]')
label=f'STL β1={stl_velocity:0.1f} and β0={stl_intercept:0.1f} [{unit}/year]')
plt.plot(dt_periodic.date, seasonal, color='green', linestyle='--', linewidth=1, label='STL Seasonal')
plt.plot(dt_periodic.date, resid, color='red', linestyle='--', linewidth=1, label='STL Residual')

Expand Down

0 comments on commit 46f5c3a

Please sign in to comment.