+ removed several index bugs
[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,inf
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
12 donor = zeros((len(donor_supp),1))
13 acceptor= zeros((len(acceptor_supp),1))
14
15 for idx in range(len(donor_supp)):
16 if donor_supp[idx] == inf:
17 donor[idx] = donor_supp[idx]
18 else:
19 donor[idx] = penalty_lookup_new(d, donor_supp[idx])
20
21 if acceptor_supp[idx] == inf:
22 acceptor[idx] = acceptor_supp[idx]
23 else:
24 acceptor[idx] = penalty_lookup_new(a,acceptor_supp[idx])
25
26 return donor,acceptor