コード例 #1
0
ファイル: math.py プロジェクト: Freidrichs/topaz
 def method_erfc(self, space, value):
     return space.newfloat(rfloat.erfc(value))
コード例 #2
0
ファイル: math.py プロジェクト: grubermeister/kamina-script
 def method_erfc(self, space, value):
     return space.newfloat(rfloat.erfc(value))
コード例 #3
0
ファイル: test_math.py プロジェクト: Fleurer/topaz
 def test_erfc(self, space):
     w_res = space.execute("return [Math.erfc(-1), Math.erfc(0), Math.erfc(1.5)]")
     assert self.unwrap(space, w_res) == [rfloat.erfc(-1), 1.0, rfloat.erfc(1.5)]
コード例 #4
0
    return start, end

# reverse complementary of sequence
# waston crick pair
wcp = {'a': 'T', 'A': 'T', 'g': 'C', 'G': 'C',
       't': 'A', 'T': 'A', 'c': 'G', 'C': 'G'}


def rc(s):
    n = len(s)
    return ''.join([wcp.get(s[elem], 'N') for elem in xrange(n - 1, -1, -1)])


# cdf of normal distribution
ncdf = lambda x: erfc(-x / 1.4142135623730951) / 2


# the sum, mean and std of an array/list
def sum(x):
    flag = 0
    #a = [[1] * 100 for elem in xrange(pow(10, 6))]
    for i in x:
        flag += i
        # a.append(i)
    return flag

mean = lambda x: 1. * sum(x) / len(x)


def std(x):
コード例 #5
0
ファイル: test_math.py プロジェクト: smcabrera/topaz
 def test_erfc(self, space):
     w_res = space.execute(
         "return [Math.erfc(-1), Math.erfc(0), Math.erfc(1.5)]")
     assert self.unwrap(space,
                        w_res) == [rfloat.erfc(-1), 1.0,
                                   rfloat.erfc(1.5)]