Calculate the taub coefficient
550081
def _calc_taub(w, aod700, p):
    """"""
    p0 = 101325.
    tb1 = 1.82 + 0.056*np.log(w) + 0.0071*np.log(w)**2
    tb0 = 0.33 + 0.045*np.log(w) + 0.0096*np.log(w)**2
    tbp = 0.0089*w + 0.13

    taub = tb1*aod700 + tb0 + tbp*np.log(p/p0)

    return taub
1208241
def mw(self):
        """"""
        m = P_TAB[self.symbol].get('std_weight')
        mh = P_TAB['H'].get('std_weight')
        return m + mh * self.H_count
576499
def rmv_normal(mu, tau, size=1):
    

    sig = np.linalg.cholesky(tau)
    mu_size = np.shape(mu)

    if size == 1:
        out = np.random.normal(size=mu_size)
        try:
            flib.dtrsm_wrap(sig, out, 'L', 'T', 'L', 1.)
        except:
            out = np.linalg.solve(sig, out)
        out += mu
        return out
    else:
        if not hasattr(size, '__iter__'):
            size = (size,)
        tot_size = np.prod(size)
        out = np.random.normal(size=(tot_size,) + mu_size)
        for i in xrange(tot_size):
            try:
                flib.dtrsm_wrap(sig, out[i, :], 'L', 'T', 'L', 1.)
            except:
                out[i, :] = np.linalg.solve(sig, out[i,:])
            out[i, :] += mu
        return out.reshape(size + mu_size)
74864
def _get_taulny(self, C, mag):
        
        if mag <= 4.5:
            return C["tau1"]
        elif mag >= 5.5:
            return C["tau2"]
        else:
            return C["tau2"] + (C["tau1"] - C["tau2"]) * (5.5 - mag)
889435
private double u_neg_inf(double x, double tau) {
		return f(boundaryCondition.getValueAtLowerBoundary(model, f_t(tau), f_s(x)), x, tau);
	}
442663
def _g(self, h, xp, s):
        """"""

        nphi = sum(self.phi)

        return (nphi / 2.0) * log(2 * pi) + nphi * \
            log(s) + 0.5 * sum((h - xp) ** 2) / (s ** 2)
1082823
def _get_tau(self, C, mag):
        
        if mag < 6.5:
            return C["tau1"]
        elif mag < 7.:
            return C["tau1"] + (C["tau2"] - C["tau1"]) * ((mag - 6.5) / 0.5)
        else:
            return C["tau2"]
1060027
def radiance2tb(self, rad):
        
        #
        # Tb = C2 * νc/{α * log[C1*νc**3 / L + 1]} - β/α
        #
        # C1 = 2 * h * c**2 and C2 = hc/k
        #
        c_1 = 2 * H_PLANCK * C_SPEED ** 2
        c_2 = H_PLANCK * C_SPEED / K_BOLTZMANN

        vc_ = SEVIRI[self.bandname][self.platform_name][0]
        # Multiply by 100 to get SI units!
        vc_ *= 100.0
        alpha = SEVIRI[self.bandname][self.platform_name][1]
        beta = SEVIRI[self.bandname][self.platform_name][2]

        tb_ = c_2 * vc_ / \
            (alpha * np.log(c_1 * vc_ ** 3 / rad + 1)) - beta / alpha

        return tb_
831608
def fap_baluev(Z, fmax, t, y, dy, normalization='standard'):
    
    cdf = cdf_single(Z, len(t), normalization)
    tau = tau_davies(Z, fmax, t, y, dy, normalization=normalization)
    return 1 - cdf * np.exp(-tau)
293506
def mass1_from_tau0_tau3(tau0, tau3, f_lower):
    """
    mtotal = mtotal_from_tau0_tau3(tau0, tau3, f_lower)
    eta = eta_from_tau0_tau3(tau0, tau3, f_lower)
    return mass1_from_mtotal_eta(mtotal, eta)
282309
def kullback_leibler(c1, c2):
    """"""
    d = c2.log_det_sigma - c1.log_det_sigma
    d += np.trace(c2.inv_sigma.dot(c1.sigma))
    mean_diff = c1.mu - c2.mu
    d += mean_diff.transpose().dot(c2.inv_sigma).dot(mean_diff)
    d -= len(c1.mu)

    return 0.5 * d
99673
def step(self, t, w, dt):
        

        # Runge-Kutta Fehlberg formulas (see: Numerical Recipes)
        F = lambda t, w: self.F(t, w, *self._func_args)

        K = np.zeros((6,)+w.shape)
        K[0] = dt * F(t, w)
        K[1] = dt * F(t + A[1]*dt, w + B[1][0]*K[0])
        K[2] = dt * F(t + A[2]*dt, w + B[2][0]*K[0] + B[2][1]*K[1])
        K[3] = dt * F(t + A[3]*dt, w + B[3][0]*K[0] + B[3][1]*K[1] + B[3][2]*K[2])
        K[4] = dt * F(t + A[4]*dt, w + B[4][0]*K[0] + B[4][1]*K[1] + B[4][2]*K[2] + B[4][3]*K[3])
        K[5] = dt * F(t + A[5]*dt, w + B[5][0]*K[0] + B[5][1]*K[1] + B[5][2]*K[2] + B[5][3]*K[3] + B[5][4]*K[4])

        # shift
        dw = np.zeros_like(w)
        for i in range(6):
            dw = dw + C[i]*K[i]

        return w + dw
1068503
def mtotal_from_tau0_tau3(tau0, tau3, f_lower,
                          in_seconds=False):
    """
    mtotal = (tau3 / _a3(f_lower)) / (tau0 / _a0(f_lower))
    if not in_seconds:
        # convert back to solar mass units
        mtotal /= lal.MTSUN_SI
    return mtotal
753585
def f(self, v, t):
        
        ret = np.zeros(8)
        ret[0] = v[4]
        ret[4] = (self.He1*self.ke1*(self.g1*self.S(v[1]-v[2]) + self.u_mean) -
                  2*self.ke1*v[4] - self.ke1*self.ke1*v[0])

        ret[1] = v[5]
        ret[5] = (self.He2*self.ke2*(self.g2*self.S(v[0]) + self.p_mean) -
                  2*self.ke2*v[5] - self.ke2*self.ke2*v[1])

        ret[2] = v[6]
        ret[6] = (self.Hi*self.ki*self.g4*self.S(v[3]) - 2*self.ki*v[6] -
                  self.ki*self.ki*v[2])

        ret[3] = v[7]
        ret[7] = (self.He3*self.ke3*self.g3*self.S(v[1]-v[2]) -
                  2*self.ke3*v[7] - self.ke3*self.ke3*v[3])
        return ret
250766
def rhalf_normal(tau, size=None):
    

    return abs(np.random.normal(0, np.sqrt(1 / tau), size))
659575
def _proc_sym_top(self):
        
        if abs(self.eigvals[0] - self.eigvals[1]) < self.eig_tol:
            ind = 2
        elif abs(self.eigvals[1] - self.eigvals[2]) < self.eig_tol:
            ind = 0
        else:
            ind = 1
        logger.debug("Eigenvalues = %s." % self.eigvals)
        unique_axis = self.principal_axes[ind]
        self._check_rot_sym(unique_axis)
        logger.debug("Rotation symmetries = %s" % self.rot_sym)
        if len(self.rot_sym) > 0:
            self._check_perpendicular_r2_axis(unique_axis)

        if len(self.rot_sym) >= 2:
            self._proc_dihedral()
        elif len(self.rot_sym) == 1:
            self._proc_cyclic()
        else:
            self._proc_no_rot_sym()
240641
def u(self):
        ''
        self._check_estimated()
        u_mod = self.u_pc_1
        N = self._R.shape[0]
        u_input = np.zeros(N+1)
        u_input[0:N] = self._R.dot(u_mod[0:-1])  # in input basis
        u_input[N] = u_mod[-1] - self.mean.dot(self._R.dot(u_mod[0:-1]))
        return u_input