当前位置: 首页>>代码示例>>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;未经允许,请勿转载。