def nget_diploid_lik(pstart, bfreqs, ustacks, counts):
hetero, errors = pstart<EOL>if (hetero <= <NUM_LIT:0.>) or (errors <= <NUM_LIT:0.>):<EOL><INDENT>score = np.exp(<NUM_LIT:100>)<EOL><DEDENT>else:<EOL><INDENT>lik1 = (<NUM_LIT:1.>-hetero) * likelihood1(errors, bfreqs, ustacks)<EOL>lik2 = (hetero) * nlikelihood2(errors, bfreqs, ustacks)<EOL>liks = lik1 + lik2<EOL>logliks = np.log(liks[liks > <NUM_LIT:0>]) * counts[liks > <NUM_LIT:0>]<EOL>score = -logliks.sum()<EOL><DEDENT>return score<EOL>
Log likelihood score given values [H,E]