diff --git a/conf.py b/conf.py index 9582fe1f391e3a08d073c3b905dec6644e3c19c7..3836f837d928278de1ba025d6c8527d229216456 100644 --- a/conf.py +++ b/conf.py @@ -1,5 +1,11 @@ import numpy as np +def test(): + bt = np.arange(265, 275) + thr = np.array([267, 270, 273, 1, 1]) + c = conf_test(bt, thr) + print(c) + def conf_test(rad, thr): ''' @@ -29,20 +35,20 @@ def conf_test(rad, thr): thr = np.full((rad.shape[0], 4), thr[:4]).T coeff = np.power(2, (thr[3] - 1)) - hicut = thr[0, :] + hicut = thr[2, :] beta = thr[1, :] - locut = thr[2, :] + locut = thr[0, :] power = thr[3, :] confidence = np.zeros(rad.shape) alpha, gamma = np.empty(rad.shape), np.empty(rad.shape) flipped = np.zeros(rad.shape) - gamma[hicut > locut] = thr[0, hicut > locut] - alpha[hicut > locut] = thr[2, hicut > locut] + gamma[hicut > locut] = thr[2, hicut > locut] + alpha[hicut > locut] = thr[0, hicut > locut] flipped[hicut > locut] = 0 - gamma[hicut < locut] = thr[2, hicut < locut] - alpha[hicut < locut] = thr[0, hicut < locut] + gamma[hicut < locut] = thr[0, hicut < locut] + alpha[hicut < locut] = thr[2, hicut < locut] flipped[hicut < locut] = 1 # Rad between alpha and beta @@ -51,13 +57,13 @@ def conf_test(rad, thr): 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] = 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. * (beta - gamma) - s1 = (rad - alpha) / range_ + s1 = (rad - gamma) / range_ idx = np.nonzero((rad > beta) & (flipped == 0)) - confidence[idx] = 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]) @@ -176,3 +182,7 @@ def conf_test_dble(rad, coeffs): confidence[confidence < 0] = 0 return confidence + + +if __name__ == "__main__": + test()