[bugfix] improvements to removal of NaNs during Cf calculation

This commit is contained in:
Darius Arnold 2017-09-15 16:28:27 +02:00
parent 6a40eef3fc
commit a7fd239574

View File

@ -228,9 +228,9 @@ class AICcf(CharacteristicFunction):
# print 'Calculating AIC ...'
x = self.getDataArray()
xnp = x[0].data
nn = np.isnan(xnp)
if len(nn) > 1:
xnp[nn] = 0
ind = np.where(~np.isnan(xnp))[0]
if ind.size:
xnp[:ind[0]] = xnp[ind[0]]
datlen = len(xnp)
k = np.arange(1, datlen)
cf = np.zeros(datlen)
@ -345,6 +345,7 @@ class ARZcf(CharacteristicFunction):
cf = tap * cf
io = np.where(cf == 0)
ino = np.where(cf > 0)
if np.size(ino):
cf[io] = cf[ino[0][0]]
self.cf = cf
@ -477,6 +478,7 @@ class ARHcf(CharacteristicFunction):
cf = tap * cf
io = np.where(cf == 0)
ino = np.where(cf > 0)
if np.size(ino):
cf[io] = cf[ino[0][0]]
self.cf = cf
@ -619,6 +621,7 @@ class AR3Ccf(CharacteristicFunction):
cf = tap * cf
io = np.where(cf == 0)
ino = np.where(cf > 0)
if np.size(ino):
cf[io] = cf[ino[0][0]]
self.cf = cf