bad0872cd3912a9a37b3c2f0056e9101d77d71f5
[qpalma.git] / python / compute_donacc.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 import math
5 from numpy.matlib import zeros,isinf
6 from penalty_lookup_new import *
7
8 def compute_donacc(donor_supp, acceptor_supp, d, a):
9
10 assert(len(donor_supp)==len(acceptor_supp))
11 size = len(donor_supp)
12
13 donor = [0.0]*size
14 acceptor = [0.0]*size
15
16 for idx in range(size):
17 if isinf(donor_supp[idx]):
18 donor[idx] = donor_supp[idx]
19 else:
20 donor[idx] = penalty_lookup_new(d, donor_supp[idx])
21
22 if isinf(acceptor_supp[idx]):
23 acceptor[idx] = acceptor_supp[idx]
24 else:
25 acceptor[idx] = penalty_lookup_new(a,acceptor_supp[idx])
26
27 return donor,acceptor