Table 6 and equation 19 of 2013 report.
355227
def _get_SRF_tau(self, imt_per):
        
        if imt_per < 1:
            srf = 0.87
        elif 1 <= imt_per < 5:
            srf = self._interp_function(0.58, 0.87, 5, 1, imt_per)
        elif 5 <= imt_per <= 10:
            srf = 0.58
        else:
            srf = 1

        return srf
1159441
def _titancna_summary(call, data):
    
    out = {}
    for svtype, coords in get_coords(data):
        cur_calls = {k: collections.defaultdict(int) for k in coords.keys()}
        with open(call["subclones"]) as in_handle:
            header = in_handle.readline().strip().split()
            for line in in_handle:
                val = dict(zip(header, line.strip().split()))
                start = int(val["Start_Position.bp."])
                end = int(val["End_Position.bp."])
                for region, cur_coords in coords.items():
                    if val["Chromosome"] == cur_coords[0] and are_overlapping((start, end), cur_coords[1:]):
                        cur_calls[region][_check_copy_number_changes(svtype, _to_cn(val["Copy_Number"]),
                                                                     _to_cn(val["MinorCN"]), data)] += 1
        out[svtype] = {r: _merge_cn_calls(c, svtype) for r, c in cur_calls.items()}

    with open(call["hetsummary"]) as in_handle:
        vals = dict(zip(in_handle.readline().strip().split("\t"), in_handle.readline().strip().split("\t")))
    out["purity"] = vals["purity"]
    out["ploidy"] = vals["ploidy"]
    return out
877109
def summary(self):
        
        df = pd.DataFrame(index=self.cumulative_hazards_.columns)

        betas, se = self._compute_slopes()
        df["slope(coef)"] = betas
        df["se(slope(coef))"] = se
        return df
1308835
function calculateTimeIntervals(timeColumn) {
  // First we find the last time for all of the data (this is an optomisation for the calculateAvailability operation.
  const endTime = timeColumn.values.reduce(function(latest, value, index) {
    const current = finishFromIndex(timeColumn, index);
    if (
      !defined(latest) ||
      (defined(current) && JulianDate.greaterThan(current, latest))
    ) {
      return current;
    }
    return latest;
  }, finishFromIndex(timeColumn, 0));

  return timeColumn.values.map(function(value, index) {
    return calculateAvailability(timeColumn, index, endTime);
  });
}
949666
void combine(final MomentStatistics b) {
		requireNonNull(b);

		final double m2 = _m2.value();
		final double m3 = _m3.value();

		final double pn = _n;
		final double n = _n + b._n;
		final double nn = n*n;

		final double d = b._m1.value() - _m1.value();
		final double dd = d*d;

		_n += b._n;

		_m1.add(d*b._n/n);

		_m2.add(b._m2).add(dd*pn*b._n/n);

		_m3.add(b._m3)
			.add(dd*d*(pn*b._n*(pn - b._n)/nn))
			.add(3.0*d*(pn*b._m2.value() - b._n*m2)/n);

		final double bnbn = (double)b._n*(double)b._n;

		_m4.add(b._m4)
			.add(dd*dd*(pn*b._n*(pn*pn - pn*b._n + bnbn)/(nn*n)))
			.add(6.0*dd*(pn*pn*b._m2.value() + bnbn*m2)/nn)
			.add(4.0*d*(pn*b._m3.value() - b._n*m3)/n);
	}
160053
def ets(self):
        """"""
        r = (self.table[0, 0] + self.table[0, 1]) * (self.table[0, 0] + self.table[1, 0]) / self.N
        return (self.table[0, 0] - r) / (self.table[0, 0] + self.table[0, 1] + self.table[1, 0] - r)
792051
def linOriginRegression(points):
    
    j = sum([ i[0] for i in points ])
    k = sum([ i[1] for i in points ])
    if j != 0:
        return k/j, j, k
    return 1, j, k
1309130
def _scale_tdb_minus_tt(self, mjd, eop):
        
        jd = mjd + Date.JD_MJD
        jj = Date._julian_century(jd)
        m = radians(357.5277233 + 35999.05034 * jj)
        delta_lambda = radians(246.11 + 0.90251792 * (jd - 2451545.))
        return 0.001657 * sin(m) + 0.000022 * sin(delta_lambda)
374493
def edf_totdev(N, m, alpha):
    
    alpha = int(alpha)
    if alpha in [0, -1, -2]:
        # alpha  0 WFM
        # alpha -1 FFM
        # alpha -2 RWFM
        NIST_SP1065_table7 = [(1.50, 0.0), (1.17, 0.22), (0.93, 0.36)]
        (b, c) = NIST_SP1065_table7[int(abs(alpha))]
        return b*(float(N)/float(m))-c
    else:
        return edf_simple(N, m, alpha)
201138
def _make_summary_tables(self):
        
        try:
            self._Bhat
        except:
            raise Exception("Regression hasn't been fit yet.  run .fit()")
        else:
            # check degrees of freedom
            num_pcs = self._basis_object.get_params()['num_components']
            total_dof = self._X.shape[0] - self._X.shape[1] - num_pcs
            if total_dof <= 0.0:
                raise ValueError("degrees of freedom <= 0, Hotellings T2 not defined")

            # print catalog and basis info
            cat_table = self._catalog_object.get_params().items()
            bas_table = self._basis_object.get_params().items()
            print tabulate(cat_table+bas_table,tablefmt='plain')

            # then print pvalues
            # make T^2 & pvalue table
            headers = self._results[0]
            table   = self._results[1:]
            print tabulate(table, headers, tablefmt="rst")
            print "Formula Used: %s" % self._designmatrix_object._formula
            print "Degrees of Freedom (n - p - k): %s" % str(total_dof)
            print "Condition Number of X^T*X: %.2f" % np.linalg.cond(np.dot(self._X.T, self._X))
23878
private int ssPivot(int Td, int PA, int first, int last) {
        int middle;// SA pointer
        int t = last - first;
        middle = first + t / 2;

        if (t <= 512) {
            if (t <= 32) {
                return ssMedian3(Td, PA, first, middle, last - 1);
            } else {
                t >>= 2;
                return ssMedian5(Td, PA, first, first + t, middle, last - 1 - t, last - 1);
            }
        }
        t >>= 3;
        first = ssMedian3(Td, PA, first, first + t, first + (t << 1));
        middle = ssMedian3(Td, PA, middle - t, middle, middle + t);
        last = ssMedian3(Td, PA, last - 1 - (t << 1), last - 1 - t, last - 1);
        return ssMedian3(Td, PA, first, middle, last);
    }
1250221
def Mu(i, j, s, N, excluded_mu=[]):
    
    if i == j:
        if s == -1:
            if i == 1:
                return 0
            else:
                mes = 'There is no population rhoii with i='+str(i)+'.'
                raise ValueError(mes)
        mu = i-1
    elif i > j and s == 1:
        mu = i - j + sum([N-k for k in range(1, j)])+N-1
    elif i > j and s == -1:
        mu = i - j + sum([N-k for k in range(1, j)])+N-1 + N*(N-1)/2
    else:
        mes = 'i='+str(i)+', j='+str(j)
        mes += ' Equations for i<j are not calculated.'+str(s)
        raise ValueError(mes)

    if excluded_mu != []:
        mu = mu-len([ii for ii in excluded_mu if ii < mu])
    return mu
718388
def summary(self):
        """"""

        res = ("nlive: {:d}\n"
               "niter: {:d}\n"
               "ncall: {:d}\n"
               "eff(%): {:6.3f}\n"
               "logz: {:6.3f} +/- {:6.3f}"
               .format(self.nlive, self.niter, sum(self.ncall),
                       self.eff, self.logz[-1], self.logzerr[-1]))

        print('Summary\n=======\n'+res)
471592
def summary(self, St=None):
        

        St = self.St if St is None else St
        if self.options:
            payoffs = [op.payoff(St=St) for op in self.options]
            profits = [op.profit(St=St) for op in self.options]
            strikes = [op.K for op in self.options]
            prices = [op.price for op in self.options]
            exprs = [St] * len(self.options)
            kinds = [op.kind for op in self.options]
            poss = [op.pos for op in self.options]
            res = OrderedDict(
                [
                    ("kind", kinds),
                    ("position", poss),
                    ("strike", strikes),
                    ("price", prices),
                    ("St", exprs),
                    ("payoff", payoffs),
                    ("profit", profits),
                ]
            )

            return DataFrame(res)
        else:
            return None
863663
function report(stream, metrics, thresholds) {
  const target = (!elv(thresholds)) ? -1 : thresholds.target;
  const dimensions = tableDimensions(metrics);
  const border = divider(dimensions);
  let value = header(dimensions);

  for (let i = 0; i < metrics.length; i++) {
    if (i > 0) value += border;
    const metric = metrics[i];
    value += row(metric, dimensions, i === target);
  }

  value += divider(dimensions, 'bottom');
  value += '\n';

  stream.write(value);
}
602042
function calculateColumnAverage(inputMatrix)
{
	var rows = inputMatrix.rows();
	
	var averages = new Array();
	for(var i = 1; i <= inputMatrix.cols(); i++)
	{
		var sum = 0;
		for(var j = 1; j <= inputMatrix.rows(); j++)
		{
			sum += inputMatrix.e(j, i);
		}
		averages[i-1] = sum/rows;
	}
	
	return $V(averages);
}
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