Skip to content

Commit

Permalink
Merge branch 'enhancement/fix_missing_gridlines' into 'master'
Browse files Browse the repository at this point in the history
Fix missing grid and frame lines in Tie_Point_Grid.plot_shift_distribution().

See merge request danschef/arosics!27
  • Loading branch information
Daniel Scheffler committed Aug 19, 2022
2 parents 4348cae + 8431844 commit abd9fe2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
7 changes: 7 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
History
=======

1.7.8 (2022-08-19)
------------------

* Fixed missing grid and frame lines of Tie_Point_Grid.plot_shift_distribution() (!27).
* Remove deprecated sphinx_autodoc_typehints option.


1.7.7 (2022-07-21)
------------------

Expand Down
2 changes: 1 addition & 1 deletion arosics/CoReg.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def __init__(self,
with warnings.catch_warnings(record=True) as w:
_ = self.footprint_poly # execute getter

if len(w) > 0 and 'disjunct polygone(s) outside' in str(w[-1].message):
if len(w) > 0 and 'disjunct polygon(s) outside' in str(w[-1].message):
warnings.warn('The footprint of the %s contains multiple separate image parts. '
'AROSICS will only process the largest image part.' % self.imName)
# FIXME use a convex hull as footprint poly
Expand Down
18 changes: 10 additions & 8 deletions arosics/Tie_Point_Grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Tie_Point_Grid(object):
Spatial shifts are calculated for each point in grid of which the parameters can be adjusted using keyword
arguments. Shift correction performs a polynomial transformation using te calculated shifts of each point in the
grid as GCPs. Thus 'Tie_Point_Grid' can be used to correct for locally varying geometric distortions of the target
grid as GCPs. Thus, 'Tie_Point_Grid' can be used to correct for locally varying geometric distortions of the target
image.
See help(Tie_Point_Grid) for documentation!
Expand Down Expand Up @@ -727,12 +727,14 @@ def plot_shift_distribution(self,

# add text box containing RMSE of plotted shifts
xlim, ylim = ax.get_xlim(), ax.get_ylim()
plt.text(xlim[1] - (xlim[1] / 20), -ylim[1] + (ylim[1] / 20),
'RMSE: %s m / %s px' % (np.round(rmse, 2), np.round(rmse / self.shift.xgsd, 2)),
ha='right', va='bottom', fontsize=fontsize, bbox=dict(facecolor='w', pad=None, alpha=0.8))
ax.text(xlim[1] - (xlim[1] / 20), -ylim[1] + (ylim[1] / 20),
'RMSE: %s m / %s px' % (np.round(rmse, 2), np.round(rmse / self.shift.xgsd, 2)),
ha='right', va='bottom', fontsize=fontsize, bbox=dict(facecolor='w', pad=None, alpha=0.8))

# add grid and increase linewidth of middle line
plt.grid()
ax.grid(b=True)
ax.spines["right"].set_visible(True)
ax.spines["top"].set_visible(True)
xgl = ax.get_xgridlines()
middle_xgl = xgl[int(np.median(np.array(range(len(xgl)))))]
middle_xgl.set_linewidth(2)
Expand All @@ -746,16 +748,16 @@ def plot_shift_distribution(self,
ax.set_title(title, fontsize=fontsize)
[tick.label1.set_fontsize(fontsize) for tick in ax.xaxis.get_major_ticks()]
[tick.label1.set_fontsize(fontsize) for tick in ax.yaxis.get_major_ticks()]
plt.xlabel('x-shift [%s]' % 'meters' if unit == 'm' else 'pixels', fontsize=fontsize)
plt.ylabel('y-shift [%s]' % 'meters' if unit == 'm' else 'pixels', fontsize=fontsize)
ax.set_xlabel('x-shift [%s]' % 'meters' if unit == 'm' else 'pixels', fontsize=fontsize)
ax.set_ylabel('y-shift [%s]' % 'meters' if unit == 'm' else 'pixels', fontsize=fontsize)

# add legend with labels in the right order
handles, labels = ax.get_legend_handles_labels()
leg = plt.legend(reversed(handles), reversed(labels), fontsize=fontsize, loc='upper right', scatterpoints=3)
leg.get_frame().set_edgecolor('black')

# remove white space around the figure
plt.subplots_adjust(top=.94, bottom=.06, right=.96, left=.09)
fig.subplots_adjust(top=.94, bottom=.06, right=.96, left=.09)

if savefigPath:
fig.savefig(savefigPath, dpi=savefigDPI, pad_inches=0.3, bbox_inches='tight')
Expand Down
4 changes: 2 additions & 2 deletions arosics/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
# limitations under the License.


__version__ = '1.7.7'
__versionalias__ = '2022-07-21_01'
__version__ = '1.7.8'
__versionalias__ = '2022-08-19_01'
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ def setup(app):
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False,
'set_type_checking_flag': True # option of sphinx_autodoc_typehints extension
'titles_only': False
}

# Add any paths that contain custom themes here, relative to this directory.
Expand Down

0 comments on commit abd9fe2

Please sign in to comment.