r"""Returns the main pathway part of the net flux comprising
        at most the requested fraction of the full flux.
964984
def major_flux(self, fraction=0.9):
        

        """
        (paths, pathfluxes) = self.pathways(fraction=fraction)
        return self._pathways_to_flux(paths, pathfluxes, n=self.nstates)
1038803
public function getPercentagePartial()
    {
        $total = $this->getTotal();

        return round((($this->score->getValid() + $this->score->getPartial())/$total) * 100);
    }
1255883
def evaluate(self, x, y, flux, x_0, y_0):
        """"""

        if self.xname is None:
            dx = x - x_0
        else:
            dx = x
            setattr(self.psfmodel, self.xname, x_0)

        if self.xname is None:
            dy = y - y_0
        else:
            dy = y
            setattr(self.psfmodel, self.yname, y_0)

        if self.fluxname is None:
            return (flux * self._psf_scale_factor *
                    self._integrated_psfmodel(dx, dy))
        else:
            setattr(self.psfmodel, self.yname, flux * self._psf_scale_factor)
            return self._integrated_psfmodel(dx, dy)
816775
private int calculateMaxPendingSplits(int splitAffinity, int totalDepth)
    {
        if (totalDepth == 0) {
            return maxPendingSplitsPerTask;
        }
        // Use half the queue for any split
        // Reserve the other half for splits that have some amount of network affinity
        double queueFraction = 0.5 * (1.0 + splitAffinity / (double) totalDepth);
        return (int) Math.ceil(maxPendingSplitsPerTask * queueFraction);
    }
319157
def full_path(self):
        ''''''
        with self._mutex:
            if self._parent:
                return self._parent.full_path + [self._name]
            else:
                return [self._name]
471561
def partsphere(self, x):
        """"""
        self.counter += 1
        # return np.random.rand(1)[0]**0 * sum(x**2) + 1 * np.random.rand(1)[0]
        dim = len(x)
        x = array([x[i % dim] for i in xrange(2 * dim)])
        N = 8
        i = self.counter % dim
        # f = sum(x[i:i + N]**2)
        f = sum(x[np.random.randint(dim, size=N)]**2)
        return f
1288740
def detect_best_flux_limit(model):
    
    flux_limit_count = Counter()

    for reaction in model.reactions:
        if reaction.id not in model.limits:
            continue

        equation = reaction.properties['equation']
        if equation is None:
            continue

        _, lower, upper = model.limits[reaction.id]
        if upper is not None and upper > 0 and equation.direction.forward:
            flux_limit_count[upper] += 1
        if lower is not None and -lower > 0 and equation.direction.reverse:
            flux_limit_count[-lower] += 1

    if len(flux_limit_count) == 0:
        return None

    best_flux_limit, _ = flux_limit_count.most_common(1)[0]
    return best_flux_limit
609462
def _compute_fluxes(self):
        ''' '''
        self.emission = self._compute_emission()
        self.emission_sfc = self._compute_emission_sfc()
        fromspace = self._from_space()
        self.flux_down = self.trans.flux_down(fromspace, self.emission)
        self.flux_reflected_up = self.trans.flux_reflected_up(self.flux_down, self.albedo_sfc)
        # this ensure same dimensions as other fields
        self.flux_to_sfc = self.flux_down[..., -1, np.newaxis]
        self.flux_from_sfc = (self.emission_sfc +
                              self.flux_reflected_up[..., -1, np.newaxis])
        self.flux_up = self.trans.flux_up(self.flux_from_sfc,
                            self.emission + self.flux_reflected_up[...,0:-1])
        self.flux_net = self.flux_up - self.flux_down
        # absorbed radiation (flux convergence) in W / m**2 (per band)
        self.absorbed = np.diff(self.flux_net, axis=-1)
        self.absorbed_total = np.sum(self.absorbed, axis=-1)
        self.flux_to_space = self._compute_flux_top()
1012361
private double getHydrograph( int k, double[][] Qpartial, double localdelay, double delay, int tp )

    {

        double Qmax = 0;
        double tmin = rainData[0][0]; /* [min] */
        int j = 0;
        double t = tmin;
        double Q;
        double rain;
        int maxRain = 0;
        if (tMax == tpMaxCalibration) {
            maxRain = rainData.length;
        } else {
            maxRain = tp / dt;
        }
        double tMaxApproximate = ModelsEngine.approximate2Multiple(tMax, dt);

        for( t = tmin, j = 0; t <= tMaxApproximate; t += dt, ++j ) {
            Q = 0;

            for( int i = 0; i <= maxRain - 1; ++i ) {

                // [ l / s ]

                rain = rainData[i][1] * networkPipes[k].getDrainArea() * networkPipes[k].getRunoffCoefficient()
                        * HAOVERH_TO_METEROVERS;

                if (t <= i * dt) {
                    Q += 0;
                } else if (t <= (i + 1) * dt) {
                    Q += rain * pFunction(k, t - i * dt, localdelay, delay);
                } else {
                    Q += rain * (pFunction(k, t - i * dt, localdelay, delay) - pFunction(k, t - (i + 1) * dt, localdelay, delay));
                }
            }

            Qpartial[j][k] = Q;
            if (Q >= Qmax) {
                Qmax = Q;
            }

        }
        return Qmax;

    }
129847
def flux_expr(self, reaction):
        """"""
        if isinstance(reaction, dict):
            return self._v.expr(iteritems(reaction))
        return self._v(reaction)
1349827
def _proportions(self):
        """"""
        return self._slice.proportions(
            axis=self._axis, include_mr_cat=self._include_mr_cat
        )
550134
def full_route(self):
        '''
        '''
        if self._parent:
            return self._parent.full_route + self._route
        else:
            return self._route
437081
def get_spatially_integrated_flux( self, energies):
    
        
       
        if not isinstance(energies, np.ndarray):
            energies = np.array(energies, ndmin=1)

        # Get the differential flux from the spectral components

        results = [self.spatial_shape.get_total_spatial_integral(energies) * component.shape(energies) for component in self.components.values()]

        if isinstance(energies, u.Quantity):

            # Slow version with units

            # We need to sum like this (slower) because using np.sum will not preserve the units
            # (thanks astropy.units)

            differential_flux = sum(results)

        else:

            # Fast version without units, where x is supposed to be in the same units as currently defined in
            # units.get_units()

            differential_flux = np.sum(results, 0)

        return differential_flux
372625
def flux_r(q_vars: List[fl.Var], i: int, j: int):
    """"""
    return fl.sqrt(flux_r2(q_vars, i, j))
1324121
def get_residuals(ds, m):
    
    model_spectra = get_model_spectra(ds, m)
    resid = ds.test_flux - model_spectra
    return resid
749411
def steady_state(self):
        """"""
        v, w = linalg.eigs(self.P.transpose(), which='LR')
        ssf = np.real(w[:, v.argmax()])
        ssf /= ssf.sum()
        return ssf
1186931
def get_net():
    """"""
    net = gluon.nn.Sequential()
    with net.name_scope():
        net.add(gluon.nn.Dense(50, activation="relu"))
        net.add(gluon.nn.Dense(1))
    net.initialize()
    return net