Commit af3c65da authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Raise useful error message when trying to compute statistics and all tie...


Raise useful error message when trying to compute statistics and all tie points are flagged as false-positives.
Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 715c2d3b
Pipeline #30151 passed with stages
in 10 minutes and 27 seconds
......@@ -467,6 +467,9 @@ class Tie_Point_Grid(object):
tbl = self.CoRegPoints_table
tbl = tbl if include_outliers else tbl[tbl['OUTLIER'] == 0].copy() if 'OUTLIER' in tbl.columns else tbl
if not include_outliers and tbl.empty:
raise RuntimeError('Cannot compute the RMSE because all tie points are flagged as false-positives.')
shifts = np.array(tbl['ABS_SHIFT'])
shifts_sq = [i * i for i in shifts if i != self.outFillVal]
......@@ -487,6 +490,9 @@ class Tie_Point_Grid(object):
tbl = self.CoRegPoints_table
tbl = tbl if include_outliers else tbl[tbl['OUTLIER'] == 0].copy()
if not include_outliers and tbl.empty:
raise RuntimeError('Cannot compute the overall SSIM because all tie points are flagged as false-positives.')
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]
......@@ -577,6 +583,10 @@ class Tie_Point_Grid(object):
tbl = tbl if include_outliers else tbl[tbl['OUTLIER'] == 0].copy() if 'OUTLIER' in tbl.columns else tbl
tbl = tbl.copy().replace(self.outFillVal, np.nan)
if not include_outliers and tbl.empty:
raise RuntimeError('Cannot compute overall statistics '
'because all tie points are flagged as false-positives.')
def RMSE(shifts):
shifts_sq = shifts ** 2
return np.sqrt(sum(shifts_sq) / len(shifts_sq))
......
Supports Markdown
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