Debuged AICPicker: Now values equal zero are removed from CF to avoid numerical instabilities.
This commit is contained in:
parent
474622027e
commit
49a248d139
@ -218,12 +218,13 @@ class AICcf(CharacteristicFunction):
|
|||||||
nn = np.isnan(xnp)
|
nn = np.isnan(xnp)
|
||||||
if len(nn) > 1:
|
if len(nn) > 1:
|
||||||
xnp[nn] = 0
|
xnp[nn] = 0
|
||||||
|
i0 = np.where(xnp == 0)
|
||||||
|
i = np.where(xnp > 0)
|
||||||
|
xnp[i0] = xnp[i[0][0]]
|
||||||
datlen = len(xnp)
|
datlen = len(xnp)
|
||||||
k = np.arange(1, datlen)
|
k = np.arange(1, datlen)
|
||||||
cf = np.zeros(datlen)
|
cf = np.zeros(datlen)
|
||||||
cumsumcf = np.cumsum(np.power(xnp, 2))
|
cumsumcf = np.cumsum(np.power(xnp, 2))
|
||||||
i = np.where(cumsumcf == 0)
|
|
||||||
cumsumcf[i] = np.finfo(np.float64).eps
|
|
||||||
cf[k] = ((k - 1) * np.log(cumsumcf[k] / k) + (datlen - k + 1) * \
|
cf[k] = ((k - 1) * np.log(cumsumcf[k] / k) + (datlen - k + 1) * \
|
||||||
np.log((cumsumcf[datlen - 1] - cumsumcf[k - 1]) / (datlen - k + 1)))
|
np.log((cumsumcf[datlen - 1] - cumsumcf[k - 1]) / (datlen - k + 1)))
|
||||||
cf[0] = cf[1]
|
cf[0] = cf[1]
|
||||||
|
Loading…
Reference in New Issue
Block a user