[bugfix] improvements to removal of NaNs during Cf calculation
This commit is contained in:
parent
6a40eef3fc
commit
a7fd239574
@ -228,9 +228,9 @@ class AICcf(CharacteristicFunction):
|
|||||||
# print 'Calculating AIC ...'
|
# print 'Calculating AIC ...'
|
||||||
x = self.getDataArray()
|
x = self.getDataArray()
|
||||||
xnp = x[0].data
|
xnp = x[0].data
|
||||||
nn = np.isnan(xnp)
|
ind = np.where(~np.isnan(xnp))[0]
|
||||||
if len(nn) > 1:
|
if ind.size:
|
||||||
xnp[nn] = 0
|
xnp[:ind[0]] = xnp[ind[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)
|
||||||
@ -345,6 +345,7 @@ class ARZcf(CharacteristicFunction):
|
|||||||
cf = tap * cf
|
cf = tap * cf
|
||||||
io = np.where(cf == 0)
|
io = np.where(cf == 0)
|
||||||
ino = np.where(cf > 0)
|
ino = np.where(cf > 0)
|
||||||
|
if np.size(ino):
|
||||||
cf[io] = cf[ino[0][0]]
|
cf[io] = cf[ino[0][0]]
|
||||||
|
|
||||||
self.cf = cf
|
self.cf = cf
|
||||||
@ -477,6 +478,7 @@ class ARHcf(CharacteristicFunction):
|
|||||||
cf = tap * cf
|
cf = tap * cf
|
||||||
io = np.where(cf == 0)
|
io = np.where(cf == 0)
|
||||||
ino = np.where(cf > 0)
|
ino = np.where(cf > 0)
|
||||||
|
if np.size(ino):
|
||||||
cf[io] = cf[ino[0][0]]
|
cf[io] = cf[ino[0][0]]
|
||||||
|
|
||||||
self.cf = cf
|
self.cf = cf
|
||||||
@ -619,6 +621,7 @@ class AR3Ccf(CharacteristicFunction):
|
|||||||
cf = tap * cf
|
cf = tap * cf
|
||||||
io = np.where(cf == 0)
|
io = np.where(cf == 0)
|
||||||
ino = np.where(cf > 0)
|
ino = np.where(cf > 0)
|
||||||
|
if np.size(ino):
|
||||||
cf[io] = cf[ino[0][0]]
|
cf[io] = cf[ino[0][0]]
|
||||||
|
|
||||||
self.cf = cf
|
self.cf = cf
|
||||||
|
Loading…
Reference in New Issue
Block a user