Commit 79734dc6 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Merge branch 'release/v0.6.7'

parents 7b141e5d e2571391
Pipeline #1513 passed with stages
in 2 minutes and 34 seconds
...@@ -427,7 +427,7 @@ class COREG_LOCAL(object): ...@@ -427,7 +427,7 @@ class COREG_LOCAL(object):
if self.tieP_filter_level > 1: if self.tieP_filter_level > 1:
# flag level 2 outliers # flag level 2 outliers
GDF_filt = GDF[GDF.L2_OUTLIER.__eq__(True)].copy() GDF_filt = GDF[GDF.L2_OUTLIER.__eq__(True)].copy()
plt.scatter(GDF_filt['plt_X'], GDF_filt['plt_Y'], c='r', marker=marker, s=150, alpha=1.0, label='MSSIM') plt.scatter(GDF_filt['plt_X'], GDF_filt['plt_Y'], c='r', marker=marker, s=150, alpha=1.0, label='SSIM')
if self.tieP_filter_level > 2: if self.tieP_filter_level > 2:
# flag level 3 outliers # flag level 3 outliers
GDF_filt = GDF[GDF.L3_OUTLIER.__eq__(True)].copy() GDF_filt = GDF[GDF.L3_OUTLIER.__eq__(True)].copy()
......
...@@ -401,27 +401,28 @@ class Tie_Point_Grid(object): ...@@ -401,27 +401,28 @@ class Tie_Point_Grid(object):
""" """
tbl = self.CoRegPoints_table tbl = self.CoRegPoints_table
tbl = tbl if include_outliers else tbl[~tbl['OUTLIER']].copy() if 'OUTLIER' in tbl.columns else tbl tbl = tbl if include_outliers else tbl[tbl['OUTLIER'] == 0].copy() if 'OUTLIER' in tbl.columns else tbl
shifts = np.array(tbl['ABS_SHIFT']) shifts = np.array(tbl['ABS_SHIFT'])
shifts_sq = [i * i for i in shifts if i != self.outFillVal] shifts_sq = [i * i for i in shifts if i != self.outFillVal]
return np.sqrt(sum(shifts_sq) / len(shifts_sq)) return np.sqrt(sum(shifts_sq) / len(shifts_sq))
def calc_overall_mssim(self, include_outliers=False): def calc_overall_ssim(self, include_outliers=False, after_correction=True):
# type: (bool) -> float # type: (bool, bool) -> float
"""Calculates the median value of all MSSIM values contained in tie point grid. """Calculates the median value of all SSIM values contained in tie point grid.
:param include_outliers: whether to include tie points that have been marked as false-positives :param include_outliers: whether to include tie points that have been marked as false-positives
:param after_correction: whether to compute median SSIM before correction or after
""" """
tbl = self.CoRegPoints_table tbl = self.CoRegPoints_table
tbl = tbl if include_outliers else tbl[~tbl['OUTLIER']].copy() tbl = tbl if include_outliers else tbl[tbl['OUTLIER'] == 0].copy()
mssim_col = np.array(tbl['MSSIM']) ssim_col = np.array(tbl['SSIM_AFTER' if after_correction else 'SSIM_BEFORE'])
mssim_col = [i * i for i in mssim_col if i != self.outFillVal] ssim_col = [i * i for i in ssim_col if i != self.outFillVal]
return float(np.median(mssim_col)) return float(np.median(ssim_col))
def plot_shift_distribution(self, include_outliers=True, unit='m', interactive=False, figsize=None, xlim=None, def plot_shift_distribution(self, include_outliers=True, unit='m', interactive=False, figsize=None, xlim=None,
ylim=None, fontsize=12, title='shift distribution'): ylim=None, fontsize=12, title='shift distribution'):
...@@ -443,7 +444,7 @@ class Tie_Point_Grid(object): ...@@ -443,7 +444,7 @@ class Tie_Point_Grid(object):
tbl = self.CoRegPoints_table tbl = self.CoRegPoints_table
tbl = tbl[tbl['ABS_SHIFT'] != self.outFillVal] tbl = tbl[tbl['ABS_SHIFT'] != self.outFillVal]
tbl_il = tbl[~tbl['OUTLIER']].copy() if 'OUTLIER' in tbl.columns else tbl tbl_il = tbl[tbl['OUTLIER'] == 0].copy() if 'OUTLIER' in tbl.columns else tbl
tbl_ol = tbl[tbl['OUTLIER']].copy() if 'OUTLIER' in tbl.columns else None tbl_ol = tbl[tbl['OUTLIER']].copy() if 'OUTLIER' in tbl.columns else None
x_attr = 'X_SHIFT_M' if unit == 'm' else 'X_SHIFT_PX' x_attr = 'X_SHIFT_M' if unit == 'm' else 'X_SHIFT_PX'
y_attr = 'Y_SHIFT_M' if unit == 'm' else 'Y_SHIFT_PX' y_attr = 'Y_SHIFT_M' if unit == 'm' else 'Y_SHIFT_PX'
......
...@@ -12,8 +12,8 @@ from arosics.Tie_Point_Grid import Tie_Point_Grid ...@@ -12,8 +12,8 @@ from arosics.Tie_Point_Grid import Tie_Point_Grid
__author__ = """Daniel Scheffler""" __author__ = """Daniel Scheffler"""
__email__ = 'daniel.scheffler@gfz-potsdam.de' __email__ = 'daniel.scheffler@gfz-potsdam.de'
__version__ = '0.6.6' __version__ = '0.6.7'
__versionalias__ = '2017-10-26_01' __versionalias__ = '2017-11-15_01'
__all__ = ['COREG', __all__ = ['COREG',
'COREG_LOCAL', 'COREG_LOCAL',
'DESHIFTER', 'DESHIFTER',
......
...@@ -28,7 +28,7 @@ test_requirements = requirements + ['coverage', 'nose', 'nose-htmloutput', 'redn ...@@ -28,7 +28,7 @@ test_requirements = requirements + ['coverage', 'nose', 'nose-htmloutput', 'redn
setup( setup(
name='arosics', name='arosics',
version='0.6.6', version='0.6.7',
description="An Automated and Robust Open-Source Image Co-Registration Software for Multi-Sensor Satellite Data", description="An Automated and Robust Open-Source Image Co-Registration Software for Multi-Sensor Satellite Data",
long_description=readme + '\n\n' + history, long_description=readme + '\n\n' + history,
author="Daniel Scheffler", author="Daniel Scheffler",
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the module arosics.Tie_Point_Grid."""
import unittest
# custom
from .cases import test_cases
from arosics import COREG_LOCAL, Tie_Point_Grid
class Test_Tie_Point_Grid(unittest.TestCase):
@classmethod
def setUp(cls):
CRL = COREG_LOCAL(test_cases['INTER1']['ref_path'], test_cases['INTER1']['tgt_path'],
**test_cases['INTER1']['kwargs_local'])
cls.TPG = Tie_Point_Grid(CRL.COREG_obj, CRL.grid_res,
max_points=100, # limit to 100 to reduce computational load
outFillVal=CRL.outFillVal,
resamp_alg_calc=CRL.rspAlg_calc,
tieP_filter_level=CRL.tieP_filter_level,
outlDetect_settings=dict(
min_reliability=CRL.min_reliability,
rs_max_outlier=CRL.rs_max_outlier,
rs_tolerance=CRL.rs_tolerance),
dir_out=CRL.projectDir,
CPUs=CRL.CPUs,
progress=CRL.progress,
v=CRL.v,
q=CRL.q)
def test_mean_shifts(self):
self.assertIsInstance(self.TPG.mean_x_shift_px, float)
self.assertIsInstance(self.TPG.mean_y_shift_px, float)
self.assertIsInstance(self.TPG.mean_x_shift_map, float)
self.assertIsInstance(self.TPG.mean_y_shift_map, float)
def test_get_CoRegPoints_table(self):
self.TPG.get_CoRegPoints_table()
def test_calc_rmse(self):
self.TPG.calc_rmse(include_outliers=False)
self.TPG.calc_rmse(include_outliers=True)
def test_calc_overall_ssim(self):
self.TPG.calc_overall_ssim(include_outliers=False, after_correction=True)
self.TPG.calc_overall_ssim(include_outliers=True, after_correction=False)
def test_plot_shift_distribution(self):
self.TPG.plot_shift_distribution()
@unittest.SkipTest
def test_dump_CoRegPoints_table(self):
raise NotImplementedError()
def test_to_GCPList(self):
self.TPG.to_GCPList()
@unittest.SkipTest
def test_to_PointShapefile(self):
# TODO requires to delete output later
self.TPG.to_PointShapefile()
@unittest.SkipTest
def test_to_vectorfield(self):
# TODO requires to delete output later
self.TPG.to_vectorfield()
@unittest.SkipTest
def test_to_Raster_using_Kriging(self):
# TODO requires to delete output later
self.TPG.to_Raster_using_Kriging(attrName='X_SHIFT_MAP')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment