Differential cross section

        dsigma/dEg = Amax(Tp) * F(Tp,Egamma)
337
def _diffsigma(self, Ep, Egamma):
        
        Tp = Ep - self._m_p

        diffsigma = self._Amax(Tp) * self._F(Tp, Egamma)

        if self.nuclear_enhancement:
            diffsigma *= self._nuclear_factor(Tp)

        return diffsigma
719157
def ellipticity2phi_gamma(e1, e2):
    
    phi = np.arctan2(e2, e1)/2
    gamma = np.sqrt(e1**2+e2**2)
    return phi, gamma
591775
protected void computePsiDataPsiGradient(GrayF32 image1, GrayF32 image2,
											 GrayF32 deriv1x, GrayF32 deriv1y,
											 GrayF32 deriv2x, GrayF32 deriv2y,
											 GrayF32 deriv2xx, GrayF32 deriv2yy, GrayF32 deriv2xy,
											 GrayF32 du, GrayF32 dv,
											 GrayF32 psiData, GrayF32 psiGradient ) {
		int N = image1.width * image1.height;

		for( int i = 0; i < N; i++ ) {

			float du_ = du.data[i];
			float dv_ = dv.data[i];

			// compute Psi-data
			float taylor2 = image2.data[i] + deriv2x.data[i]*du_ + deriv2y.data[i]*dv_;
			float v = taylor2 - image1.data[i];

			psiData.data[i] = (float)(1.0/(2.0*Math.sqrt(v*v + EPSILON*EPSILON)));

			// compute Psi-gradient
			float dIx = deriv2x.data[i] + deriv2xx.data[i]*du_ + deriv2xy.data[i]*dv_ - deriv1x.data[i];
			float dIy = deriv2y.data[i] + deriv2xy.data[i]*du_ + deriv2yy.data[i]*dv_ - deriv1y.data[i];
			float dI2 = dIx*dIx +  dIy*dIy;

			psiGradient.data[i] = (float)(1.0/(2.0*Math.sqrt(dI2 + EPSILON*EPSILON)));
		}
	}
726356
def doubleprox_dc_simple(x, y, f, phi, g, K, niter, gamma, mu):
    
    for _ in range(niter):
        f.proximal(gamma)(x + gamma * K.adjoint(y) -
                          gamma * phi.gradient(x), out=x)
        g.convex_conj.proximal(mu)(y + mu * K(x), out=y)
397481
def dBinaryRochedx (r, D, q, F):
    
    return -r[0]*(r[0]*r[0]+r[1]*r[1]+r[2]*r[2])**-1.5 -q*(r[0]-D)*((r[0]-D)*(r[0]-D)+r[1]*r[1]+r[2]*r[2])**-1.5 -q/D/D + F*F*(1+q)*r[0]
1204198
def bruggeman_refractive(m, mix):
    
    f1 = mix[0]/sum(mix)
    f2 = mix[1]/sum(mix)
    e1 = m[0]**2
    e2 = m[1]**2
    a = -2*(f1+f2)
    b = (2*f1*e1 - f1*e2 + 2*f2*e2 - f2*e1)
    c = (f1+f2)*e1*e2
    e_eff = (-b - np.sqrt(b**2-4*a*c))/(2*a)
    return np.sqrt(e_eff)
463897
def gradF_t(X, Y, S, M_E, E, m0, rho):
    ''' 
    '''
    n, r = X.shape
    m, r = Y.shape

    XS = np.dot(X, S)
    YS = np.dot(Y, S.T)
    XSY = np.dot(XS, Y.T)

    Qx = np.dot(np.dot(X.T, ((M_E - XSY) * E)), YS) / n
    Qy = np.dot(np.dot(Y.T, ((M_E - XSY) * E).T), XS) / m

    W = np.dot((XSY - M_E) * E, YS) + np.dot(X, Qx) + rho * Gp(X, m0, r)
    Z = np.dot(((XSY - M_E) * E).T, XS) + np.dot(Y, Qy) + rho * Gp(Y, m0, r)

    return W, Z
966068
def D_ds(self, H_0, Om0, Ode0=None):
        
        lensCosmo = self._get_cosom(H_0, Om0, Ode0)
        return lensCosmo.D_ds
656768
def dim_dc(self, pars):
        
        """
        self._set_parameters(pars)
        # term 1
        num1a = self.m * np.sin(self.ang) * np.log(self.w * self.tau)\
            * self.otc
        num1b = self.m * self.otc * np.pi / 2 * np.cos(np.pi / 2)
        term1 = self.sigma0 * (-num1a - num1b) / self.denom

        # term 2
        num2a = -self.m * self.otc * np.cos(self.ang)
        num2b = -2 * np.log(self.w * self.tau) * self.otc * np.cos(self.ang)
        num2c = 2 * self.otc * np.pi / 2 * np.cos(self.ang)
        num2d = 2 * np.log(self.w * self.tau) * self.otc2
        numerator = num2a * (num2b + num2c) + num2d
        term2 = self.sigma0 * numerator / (self.denom ** 2)

        result = term1 + term2

        return result
1221958
def dim_dtau(self, pars):
        
        """
        self._set_parameters(pars)
        # term 1
        num1 = -self.m * (self.w ** self.c) * self.c\
            * (self.tau ** (self.c - 1)) * np.sin(self.ang)
        term1 = self.sigmai * num1 / self.denom

        # term 2
        num2a = -self.m * self.otc * np.sin(self.ang)
        num2b = 2 * (self.w ** 2.0) * self.c * (self.tau ** (self.c - 1)) *\
            np.cos(self.ang)
        num2c = 2 * self.c * (self.w ** (self.c * 2)) *\
            (self.tau ** (2 * self.c - 1))
        term2 = self.sigma0 * num2a * (num2b + num2c) / (self.denom ** 2)

        result = term1 + term2

        return result
144133
def sigma_s2(self, r, R, r_ani, a, gamma, rho0_r0_gamma):
        
        beta = self._beta_ani(r, r_ani)
        return (1 - beta * R**2/r**2) * self.sigma_r2(r, a, gamma, rho0_r0_gamma, r_ani)
574169
private double[][] estimateGamma(double[][][] xi) {
        double[][] gamma = new double[xi.length + 1][numStates];

        for (int t = 0; t < xi.length; t++) {
            for (int i = 0; i < numStates; i++) {
                for (int j = 0; j < numStates; j++) {
                    gamma[t][i] += xi[t][i][j];
                }
            }
        }

        int n = xi.length - 1;
        for (int j = 0; j < numStates; j++) {
            for (int i = 0; i < numStates; i++) {
                gamma[xi.length][j] += xi[n][i][j];
            }
        }

        return gamma;
    }
401020
def get_gammadot(F, mc, q, e):
    

    # chirp mass
    mc *= SOLAR2S

    #total mass
    m = (((1+q)**2)/q)**(3/5) * mc

    dgdt = 6*np.pi*F * (2*np.pi*F*m)**(2/3) / (1-e**2) * \
        (1 + 0.25*(2*np.pi*F*m)**(2/3)/(1-e**2)*(26-15*e**2))

    return dgdt
1021871
def dim_dsigmai(self, pars):
        
        """
        self._set_parameters(pars)
        result = np.sum(- self.m * self.otc * np.sin(self.ang) / self.denom,
                        axis=1)

        return result
598560
public static double digamma(double x) {
        final double C7[][] = {
            {
                1.3524999667726346383e4, 4.5285601699547289655e4,
                4.5135168469736662555e4, 1.8529011818582610168e4,
                3.3291525149406935532e3, 2.4068032474357201831e2,
                5.1577892000139084710, 6.2283506918984745826e-3
            },
            {
                6.9389111753763444376e-7, 1.9768574263046736421e4,
                4.1255160835353832333e4, 2.9390287119932681918e4,
                9.0819666074855170271e3, 1.2447477785670856039e3,
                6.7429129516378593773e1, 1.0
            }
        };

        final double C4[][] = {
            {
                -2.728175751315296783e-15, -6.481571237661965099e-1,
                -4.486165439180193579, -7.016772277667586642,
                -2.129404451310105168
            },
            {
                7.777885485229616042, 5.461177381032150702e1,
                8.929207004818613702e1, 3.227034937911433614e1,
                1.0
            }
        };

        double prodPj = 0.0;
        double prodQj = 0.0;
        double digX = 0.0;

        if (x >= 3.0) {
            double x2 = 1.0 / (x * x);
            for (int j = 4; j >= 0; j--) {
                prodPj = prodPj * x2 + C4[0][j];
                prodQj = prodQj * x2 + C4[1][j];
            }
            digX = Math.log(x) - (0.5 / x) + (prodPj / prodQj);

        } else if (x >= 0.5) {
            final double X0 = 1.46163214496836234126;
            for (int j = 7; j >= 0; j--) {
                prodPj = x * prodPj + C7[0][j];
                prodQj = x * prodQj + C7[1][j];
            }
            digX = (x - X0) * (prodPj / prodQj);

        } else {
            double f = (1.0 - x) - Math.floor(1.0 - x);
            digX = digamma(1.0 - x) + Math.PI / Math.tan(Math.PI * f);
        }

        return digX;
    }
1131832
def TP0(dv, u):
    ''''''
    return np.linalg.norm(np.array(dv)) + np.linalg.norm(np.array(u))
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)