Skip to content
Snippets Groups Projects
Commit 3bc82d4d authored by Paolo Veglio's avatar Paolo Veglio
Browse files

cleaned conf.py

parent 77a87848
No related branches found
No related tags found
No related merge requests found
"""Module defining confidence computations."""
import numpy as np
def conf_test_new(rad: np.ndarray, thr: np.ndarray) -> np.ndarray:
"""Compute confidence based on thresholds."""
"""Assuming a linear function between min and max confidence level, the plot below shows
how the confidence (y axis) is computed as function of radiance (x axis).
This case illustrates alpha < gamma, obviously in case alpha > gamma, the plot would be
......@@ -50,13 +52,13 @@ def conf_test_new(rad: np.ndarray, thr: np.ndarray) -> np.ndarray:
idx = np.nonzero((rad <= beta) & (flipped == 0))
confidence[idx] = coeff[idx] * np.power(s1[idx], power[idx])
idx = np.nonzero((rad <= beta) & (flipped == 1))
confidence[idx] = 1.0 - coeff[idx] * np.power(s1[idx], power[idx])
confidence[idx] = 1.0 - (coeff[idx] * np.power(s1[idx], power[idx]))
# Rad between beta and gamma
range_ = 2.0 * (beta - gamma)
s1 = (rad - gamma) / range_
idx = np.nonzero((rad > beta) & (flipped == 0))
confidence[idx] = 1.0 - coeff[idx] * np.power(s1[idx], power[idx])
confidence[idx] = 1.0 - (coeff[idx] * np.power(s1[idx], power[idx]))
idx = np.nonzero((rad > beta) & (flipped == 1))
confidence[idx] = coeff[idx] * np.power(s1[idx], power[idx])
......@@ -72,6 +74,7 @@ def conf_test_new(rad: np.ndarray, thr: np.ndarray) -> np.ndarray:
def conf_test(rad, thr):
"""Compute confidence based on thresholds."""
"""
Assuming a linear function between min and max confidence level, the plot below shows
how the confidence (y axis) is computed as function of radiance (x axis).
......@@ -144,6 +147,7 @@ def conf_test(rad, thr):
def conf_test_dble(rad, coeffs):
"""Compute confidence based on thresholds."""
# '''
# gamma1 gamma2
# c 1_______ ________
......@@ -222,31 +226,23 @@ def conf_test_dble(rad, coeffs):
# Value is within range of lower set of limits
range_ = 2 * (beta1 - alpha1)
s1 = (rad - alpha1) / range_
idx = np.nonzero(
(rad > alpha1) & (rad <= gamma1) & (rad <= beta1) & (alpha1 - gamma1 <= 0)
)
idx = np.nonzero((rad > alpha1) & (rad <= gamma1) & (rad <= beta1) & (alpha1 - gamma1 <= 0))
confidence[idx] = 1.0 - coeff[idx] * np.power(s1[idx], power[idx])
range_ = 2 * (beta1 - gamma1)
s1 = (rad - gamma1) / range_
idx = np.nonzero(
(rad > alpha1) & (rad <= gamma1) & (rad > beta1) & (alpha1 - gamma1 <= 0)
)
idx = np.nonzero((rad > alpha1) & (rad <= gamma1) & (rad > beta1) & (alpha1 - gamma1 <= 0))
confidence[idx] = coeff[idx] * np.power(s1[idx], power[idx])
# Values is within range of upper set of limits
range_ = 2 * (beta2 - alpha2)
s1 = (rad - alpha2) / range_
idx = np.nonzero(
(rad > gamma2) & (rad < alpha2) & (rad >= beta2) & (alpha1 - gamma1 <= 0)
)
idx = np.nonzero((rad > gamma2) & (rad < alpha2) & (rad >= beta2) & (alpha1 - gamma1 <= 0))
confidence[idx] = 1.0 - coeff[idx] * np.power(s1[idx], power[idx])
range_ = 2 * (beta2 - gamma2)
s1 = (rad - gamma2) / range_
idx = np.nonzero(
(rad > gamma2) & (rad < alpha2) & (rad < beta2) & (alpha1 - gamma1 <= 0)
)
idx = np.nonzero((rad > gamma2) & (rad < alpha2) & (rad < beta2) & (alpha1 - gamma1 <= 0))
confidence[idx] = coeff[idx] * np.power(s1[idx], power[idx])
confidence[(alpha1 - gamma1 <= 0) & ((rad > gamma1) | (rad < gamma2))] = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment