def get_fixation_unconstrained_kb(S, d, log_kb): """ This uses the Kacser and Burns effect instead of the sign function. """ soft_sign_S = algopy.tanh(algopy.exp(log_kb) * S) D = d * soft_sign_S H = algopy.zeros_like(S) for i in range(H.shape[0]): for j in range(H.shape[1]): H[i, j] = 1. / kimrecessive.denom_piecewise(0.5 * S[i, j], D[i, j]) return H
def get_fixation_unconstrained_kb(S, d, log_kb): """ This uses the Kacser and Burns effect instead of the sign function. """ soft_sign_S = algopy.tanh(algopy.exp(log_kb)*S) D = d * soft_sign_S H = algopy.zeros_like(S) for i in range(H.shape[0]): for j in range(H.shape[1]): H[i, j] = 1. / kimrecessive.denom_piecewise( 0.5*S[i, j], D[i, j]) return H
def get_fixation_unconstrained_kb_fquad( S, d, log_kb, x, w, codon_neighbor_mask): """ This uses the Kacser and Burns effect instead of the sign function. """ #TODO: possibly use a mirror symmetry to double the speed soft_sign_S = algopy.tanh(algopy.exp(log_kb)*S) D = d * soft_sign_S H = algopy.zeros_like(S) for i in range(H.shape[0]): for j in range(H.shape[1]): if codon_neighbor_mask[i, j]: H[i, j] = 1. / kimrecessive.denom_fixed_quad( 0.5*S[i, j], D[i, j], x, w) return H