Calculate a flux density from pure free-free emission.
778291
def calc_freefree_snu_ujy(ne, t, width, elongation, dist, ghz):
    
    hz = ghz * 1e9
    eta = calc_freefree_eta(ne, t, hz)
    kappa = calc_freefree_kappa(ne, t, hz)
    snu = calc_snu(eta, kappa, width, elongation, dist)
    ujy = snu * cgs.jypercgs * 1e6
    return ujy
273276
def mag_to_fnu(self, mag):
        
        if self.native_flux_kind == 'flam':
            return flam_ang_to_fnu_cgs(self.mag_to_flam(mag), self.pivot_wavelength())
        raise PKError('dont\'t know how to get f_ν from mag for bandpass %s/%s',
                      self.telescope, self.band)
652909
def get_fba_obj_flux(self, objective):
        """"""
        flux_result = self.solve_fba(objective)
        return flux_result.get_value(self._v_wt[objective])
1113853
def _c0(self):
        ""
        h_df = self.df / 2
        p, S = self._p, self.S

        return h_df * (logdet(S) + p * logtwo) + lpgamma(p, h_df)
1128870
def resample(grid, wl, flux):
    
    flux_rs = (interpolate.interp1d(wl, flux))(grid)
    return flux_rs
787346
def density_angle(rho0: Density, rho1: Density) -> bk.BKTensor:
    """"""
    return fubini_study_angle(rho0.vec, rho1.vec)
1040833
def _get_rho(self, v):
        
        v_mol = vol_uc2mol(v, self.z)  # in m^3
        rho = self.mass / v_mol * 1.e-6  # in g/cm^3
        return rho
1257103
def get_density(self):
        """"""
        strc = self.get_output_structure()
        density = sum(strc.get_masses()) / strc.get_volume() * 1.660539040
        return Property(scalars=[Scalar(value=density)], units="g/(cm^3)")
145466
def fluxfrac(*mags):
    
    Ftot = 0
    for mag in mags:
        Ftot += 10**(-0.4*mag)
    F1 = 10**(-0.4*mags[0])
    return F1/Ftot
580025
private int getHydrogenCount(IAtomContainer ac, IAtom atom) {
        List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
        int hcounter = 0;
        for (IAtom neighbour : neighbours) {
            if (neighbour.getSymbol().equals("H")) {
                hcounter += 1;
            }
        }
        return hcounter;
    }
506948
def tas2eas(Vtas, H):
    """"""
    rho = density(H)
    Veas = Vtas * np.sqrt(rho/rho0)
    return Veas
1354590
def _get_flux_bounds(self, r_id, model, flux_limits, equation):
        
        if r_id not in flux_limits or flux_limits[r_id][0] is None:
            if equation.direction == Direction.Forward:
                lower = 0
            else:
                lower = -model.default_flux_limit
        else:
            lower = flux_limits[r_id][0]

        if r_id not in flux_limits or flux_limits[r_id][1] is None:
            if equation.direction == Direction.Reverse:
                upper = 0
            else:
                upper = model.default_flux_limit
        else:
            upper = flux_limits[r_id][1]

        if lower % 1 == 0:
            lower = int(lower)
        if upper % 1 == 0:
            upper = int(upper)
        return text_type(lower), text_type(upper)
1319644
def solar_constant(self):
        """"""
        if self.wavenumber is not None:
            return np.trapz(self.irradiance, self.wavenumber)
        elif self.wavelength is not None:
            return np.trapz(self.irradiance, self.wavelength)
        else:
            raise TypeError('Neither wavelengths nor wavenumbers available!')
759924
def get_flux(self, reaction):
        """"""
        return self._prob.result.get_value(self._v(reaction))
699384
double getBetheFreeEnergy() {
        // 
        // G_{Bethe} = \sum_a \sum_{x_a} - b(x_a) ln \chi(x_a)
        //              + \sum_a \sum_{x_a} b(x_a) ln b(x_a)
        //              + \sum_i (n_i - 1) \sum_{x_i} b(x_i) ln b(x_i)
        //           = \sum_a \sum_{x_a} b(x_a) ln (b(x_a) / \chi(x_a))
        //              + \sum_i (n_i - 1) \sum_{x_i} b(x_i) ln b(x_i)
        //
        //     where n_i is the number of neighbors of the variable x_i,
        //     b(x_a) and b(x_i) are normalized distributions and x_a is 
        //     the set of variables participating in factor a. 
        //
                
        double bethe = 0.0;
        for (int a=0; a<fg.getFactors().size(); a++) {
            Factor f = fg.getFactors().get(a);
            if (!(f instanceof GlobalFactor)) {
                int numConfigs = f.getVars().calcNumConfigs();
                VarTensor beliefs = getFactorBeliefs(a);
                for (int c=0; c<numConfigs; c++) {                
                    // Since we want multiplication by 0 to always give 0 (not the case for Double.POSITIVE_INFINITY or Double.NaN.
                    double b_c = beliefs.getValue(c);
                    if (b_c != s.zero()) {
                        double r_b_c = s.toReal(b_c);
                        double log_b_c = s.toLogProb(b_c);
                        double log_chi_c = f.getLogUnormalizedScore(c);
                        bethe += r_b_c * (log_b_c - log_chi_c);
                    }
                }
            } else {
                VarTensor[] inMsgs = getMsgs(f.getId(), msgs, IN_MSG);
                bethe += ((GlobalFactor) f).getExpectedLogBelief(inMsgs);
            }
        }
        for (int v=0; v<fg.getVars().size(); v++) {
            Var var = fg.getVars().get(v);
            int numNeighbors = bg.numNbsT1(v);
            VarTensor beliefs = getVarBeliefs(v);
            double sum = 0.0;
            for (int c=0; c<var.getNumStates(); c++) {
                double b_c = beliefs.getValue(c);
                if (b_c != s.zero()) {
                    double r_b_c = s.toReal(b_c);
                    double log_b_c = s.toLogProb(b_c);
                    sum += r_b_c * log_b_c;
                }
            }
            bethe -= (numNeighbors - 1) * sum;
        }
        
        assert !Double.isNaN(bethe);        
        return bethe;
    }
137442
def _gamma(self, R, phi):
        """"""
        return self._N * (phi - self._phi_ref - np.log(R / self._r_ref) / self._tan_alpha)
964984
def major_flux(self, fraction=0.9):
        

        """
        (paths, pathfluxes) = self.pathways(fraction=fraction)
        return self._pathways_to_flux(paths, pathfluxes, n=self.nstates)