Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Scheffler
arosics
Commits
e2571391
Commit
e2571391
authored
Nov 15, 2017
by
Daniel Scheffler
Browse files
Merge branch 'feature/fix_plot_shift_distribution' into develop
parents
7b141e5d
9a0714c8
Changes
5
Hide whitespace changes
Inline
Side-by-side
arosics/CoReg_local.py
View file @
e2571391
...
...
@@ -427,7 +427,7 @@ class COREG_LOCAL(object):
if
self
.
tieP_filter_level
>
1
:
# flag level 2 outliers
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
=
'
M
SSIM'
)
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
:
# flag level 3 outliers
GDF_filt
=
GDF
[
GDF
.
L3_OUTLIER
.
__eq__
(
True
)].
copy
()
...
...
arosics/Tie_Point_Grid.py
View file @
e2571391
...
...
@@ -401,27 +401,28 @@ class Tie_Point_Grid(object):
"""
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_sq
=
[
i
*
i
for
i
in
shifts
if
i
!=
self
.
outFillVal
]
return
np
.
sqrt
(
sum
(
shifts_sq
)
/
len
(
shifts_sq
))
def
calc_overall_
m
ssim
(
self
,
include_outliers
=
False
):
# type: (bool) -> float
"""Calculates the median value of all
M
SSIM values contained in tie point grid.
def
calc_overall_ssim
(
self
,
include_outliers
=
False
,
after_correction
=
True
):
# type: (
bool,
bool) -> float
"""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 after_correction: whether to compute median SSIM before correction or after
"""
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
()
m
ssim_col
=
np
.
array
(
tbl
[
'
M
SSIM'
])
m
ssim_col
=
[
i
*
i
for
i
in
m
ssim_col
if
i
!=
self
.
outFillVal
]
ssim_col
=
np
.
array
(
tbl
[
'SSIM
_AFTER'
if
after_correction
else
'SSIM_BEFORE
'
])
ssim_col
=
[
i
*
i
for
i
in
ssim_col
if
i
!=
self
.
outFillVal
]
return
float
(
np
.
median
(
m
ssim_col
))
return
float
(
np
.
median
(
ssim_col
))
def
plot_shift_distribution
(
self
,
include_outliers
=
True
,
unit
=
'm'
,
interactive
=
False
,
figsize
=
None
,
xlim
=
None
,
ylim
=
None
,
fontsize
=
12
,
title
=
'shift distribution'
):
...
...
@@ -443,7 +444,7 @@ class Tie_Point_Grid(object):
tbl
=
self
.
CoRegPoints_table
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
x_attr
=
'X_SHIFT_M'
if
unit
==
'm'
else
'X_SHIFT_PX'
y_attr
=
'Y_SHIFT_M'
if
unit
==
'm'
else
'Y_SHIFT_PX'
...
...
arosics/__init__.py
View file @
e2571391
...
...
@@ -12,8 +12,8 @@ from arosics.Tie_Point_Grid import Tie_Point_Grid
__author__
=
"""Daniel Scheffler"""
__email__
=
'daniel.scheffler@gfz-potsdam.de'
__version__
=
'0.6.
6
'
__versionalias__
=
'2017-1
0-26
_01'
__version__
=
'0.6.
7
'
__versionalias__
=
'2017-1
1-15
_01'
__all__
=
[
'COREG'
,
'COREG_LOCAL'
,
'DESHIFTER'
,
...
...
setup.py
View file @
e2571391
...
...
@@ -28,7 +28,7 @@ test_requirements = requirements + ['coverage', 'nose', 'nose-htmloutput', 'redn
setup
(
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"
,
long_description
=
readme
+
'
\n\n
'
+
history
,
author
=
"Daniel Scheffler"
,
...
...
tests/test_tie_point_grid.py
0 → 100644
View file @
e2571391
#!/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'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment