get the coverage fraction of each transcript then return the geometric mean

    :param gpd: Another transcript
    :type gpd: Transcript
    :return: avg_coverage
    :rtype: float
162789
def avg_mutual_coverage(self,gpd):
    
    ov = self.overlap_size(gpd)
    if ov == 0: return 0
    xfrac = float(ov) / float(self.get_length())
    yfrac = float(ov) / float(gpd.get_length())
    return sqrt(xfrac*yfrac)
503346
def get_training_coverage(self):
        
        total = len(self.training_results)
        i = sum(1 for data in self.training_results.values() if not isinstance(data, basestring))
        return i/float(total)
425888
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
        
        # extracting dictionary of coefficients specific to required
        # intensity measure type.
        C = self.COEFFS[imt]
        C_PGA = self.COEFFS[PGA()]
        imt_per = 0 if imt.name == 'PGV' else imt.period
        pga_rock = self._get_pga_on_rock(C_PGA, rup, dists)
        mean = (self._get_magnitude_scaling_term(C, rup) +
                self._get_path_scaling(C, dists, rup.mag) +
                self._get_site_scaling(C, pga_rock, sites, imt_per, dists.rjb))
        stddevs = self._get_stddevs(C, rup, dists, sites, stddev_types)
        return mean, stddevs
887326
def get_rmetric( self, mode_inv = 'svd', return_svd = False ):
        
        if self.H is None:
            self.H, self.G, self.Hvv, self.Hsval = riemann_metric(self.Y, self.L, self.mdimG, invert_h = True, mode_inv = mode_inv)
        if self.G is None:
            self.G, self.Hvv, self.Hsvals,  self.Gsvals = compute_G_from_H( self.H, mode_inv = self.mode_inv )
        if mode_inv is 'svd' and return_svd:
            return self.G, self.Hvv, self.Hsvals, self.Gsvals
        else:
            return self.G
1030233
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
        
        C = self.COEFFS[imt]

        mean = (self._compute_magnitude_term(C, rup.mag) +
                self._compute_distance_term(C, dists.rhypo, rup.mag))
        stddevs = self._get_stddevs(C, dists.rhypo, stddev_types)
        return mean, stddevs
1321442
def hpd_coverage(mu, pdf, thresh):
    '''
    
    '''
    dp = integral_element(mu, pdf)
    bin_mean = (pdf[1:] + pdf[:-1]) / 2.

    return dp[bin_mean > thresh].sum()
147172
def get_aggregation(self):
        
        agg = A(self.agg_type, **self._params)
        if self._metric:
            agg.metric('metric', self._metric)
        return agg
166322
def compute_avg_adj_deg(G):
    
    """
    return np.sum(np.dot(G.A, G.A), axis=1) / (np.sum(G.A, axis=1) + 1.)
391667
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
        
        mean, stds = self._get_mean_and_stddevs(sites, rup, dists, imt,
                                                stddev_types)
        stddevs = [np.ones(len(dists.repi))*get_sigma(imt)]
        return mean, stddevs
727358
def averages(self):
        
        if not self.mesh._compute_at_vertices:
            return None

        return np.mean(self.vertices_per_triangle, axis=1)
544174
def __get_gp_plan(self, gp):
        
        query = urlencode({'gp': gp})
        response = requests.get('{}/plan?'.format(self.__planner) + query, headers={'Accept': 'text/turtle'})
        graph = Graph()
        try:
            graph.parse(source=StringIO.StringIO(response.text), format='turtle')
        except BadSyntax:
            pass
        return graph
874121
def acq(self, graph):
        ''' 
        '''
        mean, std = self.gpr.predict(np.array([graph.extract_descriptor()]))
        if self.optimizemode is OptimizeMode.Maximize:
            return mean + self.beta * std
        return mean - self.beta * std
443778
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
        
        C = self.COEFFS[imt]

        M = rup.mag - 6
        R = np.sqrt(dists.rjb ** 2 + C['h'] ** 2)

        # In the original formulation of the GMPE, distinction is only made
        # between rock and soil sites, which I assumed separated by the Vs30
        # value of 910m/s (see equation 5 of the paper)
        gamma = np.array([0 if v > 910. else 1 for v in sites.vs30])

        mean = np.zeros_like(R)

        mean += C['b1'] + \
                C['b2'] * M + \
                C['b3'] * M ** 2 + \
                C['b5'] * np.log10(R) + \
                C['b6'] * gamma

        # Convert from base 10 to base e
        mean /= np.log10(np.e)

        # Converting PSV to PSA
        if imt != PGA() and imt != PGV():
            omega = 2.*np.pi/imt.period
            mean += np.log(omega/(gravity*100))

        # Computing standard deviation
        stddevs = self._get_stddevs(C, stddev_types,  dists.rjb.shape[0])

        # Convert from base 10 to base e
        stddevs = [sd/np.log10(np.e) for sd in stddevs]

        return mean, stddevs
474681
def _compute_mean(self, C, g, mag, hypo_depth, dists, imt):
        

        delta = 0.00750 * 10 ** (0.507 * mag)

        # computing R for different values of mag
        if mag < 6.5:
            R = np.sqrt(dists.rhypo ** 2 + delta ** 2)
        else:
            R = np.sqrt(dists.rrup ** 2 + delta ** 2)

        mean = (
            # 1st term
            C['c1'] + C['c2'] * mag +
            # 2nd term
            C['c3'] * R -
            # 3rd term
            C['c4'] * np.log10(R) +
            # 4th term
            C['c5'] * hypo_depth
        )
        # convert from base 10 to base e
        if imt == PGV():
            mean = np.log(10 ** mean)
        else:
            # convert from cm/s**2 to g
            mean = np.log((10 ** mean) * 1e-2 / g)
        return mean
1311611
def coverage_lineplot (self):
        
        # Add line graph to section
        data = list()
        data_labels = list()
        if len(self.rna_seqc_norm_high_cov) > 0:
            data.append(self.rna_seqc_norm_high_cov)
            data_labels.append({'name': 'High Expressed'})
        if len(self.rna_seqc_norm_medium_cov) > 0:
            data.append(self.rna_seqc_norm_medium_cov)
            data_labels.append({'name': 'Medium Expressed'})
        if len(self.rna_seqc_norm_low_cov) > 0:
            data.append(self.rna_seqc_norm_low_cov)
            data_labels.append({'name': 'Low Expressed'})
        pconfig = {
            'id': 'rna_seqc_mean_coverage_plot',
            'title': 'RNA-SeQC: Gene Body Coverage',
            'ylab': '% Coverage',
            'xlab': "Gene Body Percentile (5' -> 3')",
            'xmin': 0,
            'xmax': 100,
            'tt_label': "<strong>{point.x}% from 5'</strong>: {point.y:.2f}",
            'data_labels': data_labels
        }
        if len(data) > 0:
            self.add_section (
                name = 'Gene Body Coverage',
                anchor = 'rseqc-rna_seqc_mean_coverage',
                helptext = 'The metrics are calculated across the transcripts with tiered expression levels.',
                plot = linegraph.plot(data, pconfig)
            )
1343512
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
        
        C = self.COEFFS[imt]
        mean = (
            self._get_magnitude_term(C, rup.mag) +
            self._get_distance_term(C, rup.mag, dists.rrup) +
            self._get_style_of_faulting_term(C, rup.rake) +
            self._get_site_response_term(C, sites.vs30))

        stddevs = self._get_stddevs(C, stddev_types, len(sites.vs30))
        return mean, stddevs
93092
def mavg(data, xseq, **params):
    
    window = params['method_args']['window']

    # The first average comes after the full window size
    # has been swept over
    rolling = data['y'].rolling(**params['method_args'])
    y = rolling.mean()[window:]
    n = len(data)
    stderr = rolling.std()[window:]
    x = data['x'][window:]
    data = pd.DataFrame({'x': x, 'y': y})
    data.reset_index(inplace=True, drop=True)

    if params['se']:
        df = n - window  # Original - Used
        data['ymin'], data['ymax'] = tdist_ci(
            y, df, stderr, params['level'])
        data['se'] = stderr

    return data