def peak_minima(x, s): s0 = p.ps(s, p0=x[0] * 18000, p1=x[1] * 18000) s = np.real(s0).flatten() i = np.argmax(s) peak = s[i] mina = np.min(s[i - 100:i]) minb = np.min(s[i:i + 100]) return np.abs(mina - minb)
def peak_minima(x, s): s0 = p.ps(s, p0=x[0]*18000, p1=x[1]*18000) s = np.real(s0).flatten() i = np.argmax(s) peak = s[i] mina = np.min(s[i - 100:i]) minb = np.min(s[i:i + 100]) return np.abs(mina - minb)
def min_entropy(x, data): if data.ndim > 1: return gmean([min_entropy(x, row) for row in data]) _data = p.ps(data, p0=x[0] * 18000, p1=x[1] * 18000).real drv = np.absolute(np.diff(_data)) hst = drv / sum(drv) g = np.ptp(data.real) penalty = np.sum(_data[_data < 0]**2) * g entropy = np.sum(hst * np.log(hst)) + penalty return entropy
def min_entropy(x, data): if data.ndim > 1: return gmean([min_entropy(x, row) for row in data]) _data = p.ps(data,p0=x[0]*18000, p1=x[1]*18000).real drv = np.absolute(np.diff(_data)) hst = drv / sum(drv) g = np.ptp(data.real) penalty = np.sum( _data[_data<0]**2 ) * g entropy = np.sum(hst * np.log(hst)) + penalty return entropy
def whiten(x, data): a = np.abs(p.ps(data, p0=x[0] * 18000, p1=x[1] * 18000).real) t = float(np.mean(a)) return np.sum(a > t)
def min_point(x, data): obj = -p.ps(data, p0=x[0] * 18000, p1=x[1] * 18000).real.min() return obj
def max_integ(x, data): integ = np.trapz(p.ps(data, p0=x[0] * 18000, p1=x[1] * 18000).real) for i in range(1, data.udic['ndim']): integ = np.trapz(integ) return -integ
def whiten(x, data): a = np.abs(p.ps(data, p0=x[0]*18000, p1=x[1]*18000).real) t = float(np.mean(a)) return np.sum(a > t)
def min_point(x, data): obj = -p.ps(data,p0=x[0]*18000, p1=x[1]*18000).real.min() return obj
def max_integ(x, data): integ = np.trapz(p.ps(data, p0=x[0]*18000, p1=x[1]*18000).real) for i in range(1,data.udic['ndim']): integ = np.trapz(integ) return -integ