當前位置: 首頁>>代碼示例>>Python>>正文


Python scipy.sign方法代碼示例

本文整理匯總了Python中scipy.sign方法的典型用法代碼示例。如果您正苦於以下問題:Python scipy.sign方法的具體用法?Python scipy.sign怎麽用?Python scipy.sign使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scipy的用法示例。


在下文中一共展示了scipy.sign方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _classify

# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import sign [as 別名]
def _classify(self):
        if self.dimension == 2:
            print "Use fixedpoint_2D class"

        real_evals = (isreal(self.evals[0]), isreal(self.evals[1]))
        equal_evals = abs(self.evals[0] - self.evals[1]) < self.eps
        zero_evals = (abs(self.evals[0]) < self.eps,
                      abs(self.evals[1]) < self.eps)
##        if alltrue(real_evals):
##            sign_evals = (sign(self.evals[0]), sign(self.evals[1]))
##            if sign_evals[0] == sign_evals[1]:
##                self.classification = 'node-like'
##            else:
##                self.classification = 'saddle-like'
##        else:
##            self.classification = 'spiral-like'
        real_parts = real(self.evals)
        if alltrue(real_parts<0):
            self.stability = 's'
        elif alltrue(real_parts==0):
            self.stability = 'c'
        else:
            self.stability = 'u'
        self.degenerate = sometrue(zero_evals) or equal_evals 
開發者ID:robclewley,項目名稱:compneuro,代碼行數:26,代碼來源:phaseplane.py

示例2: get_beta

# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import sign [as 別名]
def get_beta(pval_read, raw_beta, beta_read, line_dict, header_dict, se, 
             z_from_se, N, eff_type, se_inferred_zscores):
    if eff_type=='BLUP':
        return raw_beta
    if z_from_se:
        assert se in header_dict, "SE was not specified in summary statistics provided, which is necessary when the 'z_from_se' flag is used."
        se_read = float(line_dict[header_dict[se]])
        if se_read==0 or not isfinite(se_read):
            return None
        se_inferred_zscores += 1
        return get_beta_from_se(beta_read, se_read, eff_type, raw_beta, N)
    else:
        if pval_read==0 or not isfinite(stats.norm.ppf(pval_read)):
            #Attempt to Parse SEs to infer Z-score
            if not se in header_dict:
                return None
            else:
                se_read = float(line_dict[header_dict[se]])
                if se_read==0 or not isfinite(se_read):
                    return None

                se_inferred_zscores += 1
                return get_beta_from_se(beta_read, se_read, eff_type, raw_beta, N)
        else:               
            return sp.sign(raw_beta) * stats.norm.ppf(pval_read / 2.0)/ sp.sqrt(N) 
開發者ID:bvilhjal,項目名稱:ldpred,代碼行數:27,代碼來源:sum_stats_parsers.py

示例3: find_tick_directions

# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import sign [as 別名]
def find_tick_directions(list, f, g, side, start, stop, full_angle=False, extra_angle=0, turn_relative=False):
    """
    finds tick directions and angles
    """
    angles = []
    # following two values make unit vector
    dx_units = []
    dy_units = []
    turn = _determine_turn_(f=f, g=g, start=start, stop=stop, side=side, turn_relative=turn_relative)
    for idx, u in enumerate(list):
        if u != list[-1]:
            du = (list[idx + 1] - list[idx]) * 1e-6
        else:
            if len(list) > 1:
                du = (list[-1] - list[-2]) * 1e-6
            else:  # only one element in list
                du = abs(stop - start) * 1e-6
        # print u
        dx = (f(u + du) - f(u)) * turn
        dy = (g(u + du) - g(u)) * turn
        dx_unit = dx / math.sqrt(dx ** 2 + dy ** 2)
        dy_unit = dy / math.sqrt(dx ** 2 + dy ** 2)
        if not full_angle:
            if dy_unit != 0.0:
                angle = -math.atan(dx_unit / dy_unit) * 180.0 / math.pi
            else:
                angle = 0.0
        if full_angle:
            if dy_unit != 0.0:
                angle = -math.atan(dx_unit / dy_unit) * 180.0 / math.pi
            else:
                angle = 0.0
            if scipy.sign(dx_unit) < 0.0 and scipy.sign(dy_unit) < 0.0:
                angle = angle - 180.0
            if scipy.sign(dy_unit) < 0.0 <= scipy.sign(dx_unit):
                angle += 180.0
        angle += extra_angle
        dx_units.append(dx_unit)
        dy_units.append(dy_unit)
        angles.append(angle)
    return dx_units, dy_units, angles 
開發者ID:lefakkomies,項目名稱:pynomo,代碼行數:43,代碼來源:nomo_axis.py

示例4: concavity

# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import sign [as 別名]
def concavity(self, xdata):
        """Concavity scalar +/- 1 or 0 at x is returned for scalar x,
        otherwise array of such scalars for 1D array x.

        Positive values mean concave "up" in the plane."""
        return np.sign(self.curvature(xdata)) 
開發者ID:robclewley,項目名稱:compneuro,代碼行數:8,代碼來源:phaseplane.py

示例5: execute

# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import sign [as 別名]
def execute(self, train_data, test_data):
        self.train_data = self._data_process(train_data)
        self.train_data_mask = scipy.sign(self.train_data)
        init = tf.global_variables_initializer()
        self.sess.run(init)
        for epoch in range(self.epochs):
            if self.verbose:
                print("Epoch: %04d;" % (epoch))
            self.train(train_data)
            if (epoch) % self.T == 0:
                print("Epoch: %04d; " % (epoch), end='')
                self.test(test_data) 
開發者ID:cheungdaven,項目名稱:DeepRec,代碼行數:14,代碼來源:autorec.py

示例6: get_beta_from_se

# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import sign [as 別名]
def get_beta_from_se(beta_read, se_read, eff_type, raw_beta, N):
    if se_read==0:
        return 
    if eff_type=='LINREG' or eff_type=='LOGOR':
        abs_beta = sp.absolute(beta_read)/se_read
    elif eff_type=='OR':
        abs_beta = sp.absolute(1-beta_read)/se_read
    else: 
        raise Exception('Unknown effect type')      
    return sp.sign(raw_beta) * abs_beta/ sp.sqrt(N) 
開發者ID:bvilhjal,項目名稱:ldpred,代碼行數:12,代碼來源:sum_stats_parsers.py


注:本文中的scipy.sign方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。